github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6@v6.2.0/expressroutecircuits_client.go (about) 1 //go:build go1.18 2 // +build go1.18 3 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // Licensed under the MIT License. See License.txt in the project root for license information. 6 // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. 7 // Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9 package armnetwork 10 11 import ( 12 "context" 13 "errors" 14 "github.com/Azure/azure-sdk-for-go/sdk/azcore" 15 "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" 16 "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" 17 "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" 18 "net/http" 19 "net/url" 20 "strings" 21 ) 22 23 // ExpressRouteCircuitsClient contains the methods for the ExpressRouteCircuits group. 24 // Don't use this type directly, use NewExpressRouteCircuitsClient() instead. 25 type ExpressRouteCircuitsClient struct { 26 internal *arm.Client 27 subscriptionID string 28 } 29 30 // NewExpressRouteCircuitsClient creates a new instance of ExpressRouteCircuitsClient with the specified values. 31 // - subscriptionID - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription 32 // ID forms part of the URI for every service call. 33 // - credential - used to authorize requests. Usually a credential from azidentity. 34 // - options - pass nil to accept the default values. 35 func NewExpressRouteCircuitsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExpressRouteCircuitsClient, error) { 36 cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) 37 if err != nil { 38 return nil, err 39 } 40 client := &ExpressRouteCircuitsClient{ 41 subscriptionID: subscriptionID, 42 internal: cl, 43 } 44 return client, nil 45 } 46 47 // BeginCreateOrUpdate - Creates or updates an express route circuit. 48 // If the operation fails it returns an *azcore.ResponseError type. 49 // 50 // Generated from API version 2024-05-01 51 // - resourceGroupName - The name of the resource group. 52 // - circuitName - The name of the circuit. 53 // - parameters - Parameters supplied to the create or update express route circuit operation. 54 // - options - ExpressRouteCircuitsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginCreateOrUpdate 55 // method. 56 func (client *ExpressRouteCircuitsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, options *ExpressRouteCircuitsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExpressRouteCircuitsClientCreateOrUpdateResponse], error) { 57 if options == nil || options.ResumeToken == "" { 58 resp, err := client.createOrUpdate(ctx, resourceGroupName, circuitName, parameters, options) 59 if err != nil { 60 return nil, err 61 } 62 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitsClientCreateOrUpdateResponse]{ 63 FinalStateVia: runtime.FinalStateViaAzureAsyncOp, 64 Tracer: client.internal.Tracer(), 65 }) 66 return poller, err 67 } else { 68 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExpressRouteCircuitsClientCreateOrUpdateResponse]{ 69 Tracer: client.internal.Tracer(), 70 }) 71 } 72 } 73 74 // CreateOrUpdate - Creates or updates an express route circuit. 75 // If the operation fails it returns an *azcore.ResponseError type. 76 // 77 // Generated from API version 2024-05-01 78 func (client *ExpressRouteCircuitsClient) createOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, options *ExpressRouteCircuitsClientBeginCreateOrUpdateOptions) (*http.Response, error) { 79 var err error 80 const operationName = "ExpressRouteCircuitsClient.BeginCreateOrUpdate" 81 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 82 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 83 defer func() { endSpan(err) }() 84 req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, circuitName, parameters, options) 85 if err != nil { 86 return nil, err 87 } 88 httpResp, err := client.internal.Pipeline().Do(req) 89 if err != nil { 90 return nil, err 91 } 92 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { 93 err = runtime.NewResponseError(httpResp) 94 return nil, err 95 } 96 return httpResp, nil 97 } 98 99 // createOrUpdateCreateRequest creates the CreateOrUpdate request. 100 func (client *ExpressRouteCircuitsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, options *ExpressRouteCircuitsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { 101 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" 102 if resourceGroupName == "" { 103 return nil, errors.New("parameter resourceGroupName cannot be empty") 104 } 105 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 106 if circuitName == "" { 107 return nil, errors.New("parameter circuitName cannot be empty") 108 } 109 urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) 110 if client.subscriptionID == "" { 111 return nil, errors.New("parameter client.subscriptionID cannot be empty") 112 } 113 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 114 req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 115 if err != nil { 116 return nil, err 117 } 118 reqQP := req.Raw().URL.Query() 119 reqQP.Set("api-version", "2024-05-01") 120 req.Raw().URL.RawQuery = reqQP.Encode() 121 req.Raw().Header["Accept"] = []string{"application/json"} 122 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 123 return nil, err 124 } 125 return req, nil 126 } 127 128 // BeginDelete - Deletes the specified express route circuit. 129 // If the operation fails it returns an *azcore.ResponseError type. 130 // 131 // Generated from API version 2024-05-01 132 // - resourceGroupName - The name of the resource group. 133 // - circuitName - The name of the express route circuit. 134 // - options - ExpressRouteCircuitsClientBeginDeleteOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginDelete 135 // method. 136 func (client *ExpressRouteCircuitsClient) BeginDelete(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientBeginDeleteOptions) (*runtime.Poller[ExpressRouteCircuitsClientDeleteResponse], error) { 137 if options == nil || options.ResumeToken == "" { 138 resp, err := client.deleteOperation(ctx, resourceGroupName, circuitName, options) 139 if err != nil { 140 return nil, err 141 } 142 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitsClientDeleteResponse]{ 143 FinalStateVia: runtime.FinalStateViaLocation, 144 Tracer: client.internal.Tracer(), 145 }) 146 return poller, err 147 } else { 148 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExpressRouteCircuitsClientDeleteResponse]{ 149 Tracer: client.internal.Tracer(), 150 }) 151 } 152 } 153 154 // Delete - Deletes the specified express route circuit. 155 // If the operation fails it returns an *azcore.ResponseError type. 156 // 157 // Generated from API version 2024-05-01 158 func (client *ExpressRouteCircuitsClient) deleteOperation(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientBeginDeleteOptions) (*http.Response, error) { 159 var err error 160 const operationName = "ExpressRouteCircuitsClient.BeginDelete" 161 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 162 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 163 defer func() { endSpan(err) }() 164 req, err := client.deleteCreateRequest(ctx, resourceGroupName, circuitName, options) 165 if err != nil { 166 return nil, err 167 } 168 httpResp, err := client.internal.Pipeline().Do(req) 169 if err != nil { 170 return nil, err 171 } 172 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { 173 err = runtime.NewResponseError(httpResp) 174 return nil, err 175 } 176 return httpResp, nil 177 } 178 179 // deleteCreateRequest creates the Delete request. 180 func (client *ExpressRouteCircuitsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientBeginDeleteOptions) (*policy.Request, error) { 181 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" 182 if resourceGroupName == "" { 183 return nil, errors.New("parameter resourceGroupName cannot be empty") 184 } 185 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 186 if circuitName == "" { 187 return nil, errors.New("parameter circuitName cannot be empty") 188 } 189 urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) 190 if client.subscriptionID == "" { 191 return nil, errors.New("parameter client.subscriptionID cannot be empty") 192 } 193 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 194 req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 195 if err != nil { 196 return nil, err 197 } 198 reqQP := req.Raw().URL.Query() 199 reqQP.Set("api-version", "2024-05-01") 200 req.Raw().URL.RawQuery = reqQP.Encode() 201 req.Raw().Header["Accept"] = []string{"application/json"} 202 return req, nil 203 } 204 205 // Get - Gets information about the specified express route circuit. 206 // If the operation fails it returns an *azcore.ResponseError type. 207 // 208 // Generated from API version 2024-05-01 209 // - resourceGroupName - The name of the resource group. 210 // - circuitName - The name of express route circuit. 211 // - options - ExpressRouteCircuitsClientGetOptions contains the optional parameters for the ExpressRouteCircuitsClient.Get 212 // method. 213 func (client *ExpressRouteCircuitsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientGetOptions) (ExpressRouteCircuitsClientGetResponse, error) { 214 var err error 215 const operationName = "ExpressRouteCircuitsClient.Get" 216 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 217 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 218 defer func() { endSpan(err) }() 219 req, err := client.getCreateRequest(ctx, resourceGroupName, circuitName, options) 220 if err != nil { 221 return ExpressRouteCircuitsClientGetResponse{}, err 222 } 223 httpResp, err := client.internal.Pipeline().Do(req) 224 if err != nil { 225 return ExpressRouteCircuitsClientGetResponse{}, err 226 } 227 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 228 err = runtime.NewResponseError(httpResp) 229 return ExpressRouteCircuitsClientGetResponse{}, err 230 } 231 resp, err := client.getHandleResponse(httpResp) 232 return resp, err 233 } 234 235 // getCreateRequest creates the Get request. 236 func (client *ExpressRouteCircuitsClient) getCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientGetOptions) (*policy.Request, error) { 237 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" 238 if resourceGroupName == "" { 239 return nil, errors.New("parameter resourceGroupName cannot be empty") 240 } 241 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 242 if circuitName == "" { 243 return nil, errors.New("parameter circuitName cannot be empty") 244 } 245 urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) 246 if client.subscriptionID == "" { 247 return nil, errors.New("parameter client.subscriptionID cannot be empty") 248 } 249 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 250 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 251 if err != nil { 252 return nil, err 253 } 254 reqQP := req.Raw().URL.Query() 255 reqQP.Set("api-version", "2024-05-01") 256 req.Raw().URL.RawQuery = reqQP.Encode() 257 req.Raw().Header["Accept"] = []string{"application/json"} 258 return req, nil 259 } 260 261 // getHandleResponse handles the Get response. 262 func (client *ExpressRouteCircuitsClient) getHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientGetResponse, error) { 263 result := ExpressRouteCircuitsClientGetResponse{} 264 if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuit); err != nil { 265 return ExpressRouteCircuitsClientGetResponse{}, err 266 } 267 return result, nil 268 } 269 270 // GetPeeringStats - Gets all stats from an express route circuit in a resource group. 271 // If the operation fails it returns an *azcore.ResponseError type. 272 // 273 // Generated from API version 2024-05-01 274 // - resourceGroupName - The name of the resource group. 275 // - circuitName - The name of the express route circuit. 276 // - peeringName - The name of the peering. 277 // - options - ExpressRouteCircuitsClientGetPeeringStatsOptions contains the optional parameters for the ExpressRouteCircuitsClient.GetPeeringStats 278 // method. 279 func (client *ExpressRouteCircuitsClient) GetPeeringStats(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitsClientGetPeeringStatsOptions) (ExpressRouteCircuitsClientGetPeeringStatsResponse, error) { 280 var err error 281 const operationName = "ExpressRouteCircuitsClient.GetPeeringStats" 282 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 283 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 284 defer func() { endSpan(err) }() 285 req, err := client.getPeeringStatsCreateRequest(ctx, resourceGroupName, circuitName, peeringName, options) 286 if err != nil { 287 return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, err 288 } 289 httpResp, err := client.internal.Pipeline().Do(req) 290 if err != nil { 291 return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, err 292 } 293 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 294 err = runtime.NewResponseError(httpResp) 295 return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, err 296 } 297 resp, err := client.getPeeringStatsHandleResponse(httpResp) 298 return resp, err 299 } 300 301 // getPeeringStatsCreateRequest creates the GetPeeringStats request. 302 func (client *ExpressRouteCircuitsClient) getPeeringStatsCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, options *ExpressRouteCircuitsClientGetPeeringStatsOptions) (*policy.Request, error) { 303 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats" 304 if resourceGroupName == "" { 305 return nil, errors.New("parameter resourceGroupName cannot be empty") 306 } 307 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 308 if circuitName == "" { 309 return nil, errors.New("parameter circuitName cannot be empty") 310 } 311 urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) 312 if peeringName == "" { 313 return nil, errors.New("parameter peeringName cannot be empty") 314 } 315 urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) 316 if client.subscriptionID == "" { 317 return nil, errors.New("parameter client.subscriptionID cannot be empty") 318 } 319 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 320 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 321 if err != nil { 322 return nil, err 323 } 324 reqQP := req.Raw().URL.Query() 325 reqQP.Set("api-version", "2024-05-01") 326 req.Raw().URL.RawQuery = reqQP.Encode() 327 req.Raw().Header["Accept"] = []string{"application/json"} 328 return req, nil 329 } 330 331 // getPeeringStatsHandleResponse handles the GetPeeringStats response. 332 func (client *ExpressRouteCircuitsClient) getPeeringStatsHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientGetPeeringStatsResponse, error) { 333 result := ExpressRouteCircuitsClientGetPeeringStatsResponse{} 334 if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitStats); err != nil { 335 return ExpressRouteCircuitsClientGetPeeringStatsResponse{}, err 336 } 337 return result, nil 338 } 339 340 // GetStats - Gets all the stats from an express route circuit in a resource group. 341 // If the operation fails it returns an *azcore.ResponseError type. 342 // 343 // Generated from API version 2024-05-01 344 // - resourceGroupName - The name of the resource group. 345 // - circuitName - The name of the express route circuit. 346 // - options - ExpressRouteCircuitsClientGetStatsOptions contains the optional parameters for the ExpressRouteCircuitsClient.GetStats 347 // method. 348 func (client *ExpressRouteCircuitsClient) GetStats(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientGetStatsOptions) (ExpressRouteCircuitsClientGetStatsResponse, error) { 349 var err error 350 const operationName = "ExpressRouteCircuitsClient.GetStats" 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.getStatsCreateRequest(ctx, resourceGroupName, circuitName, options) 355 if err != nil { 356 return ExpressRouteCircuitsClientGetStatsResponse{}, err 357 } 358 httpResp, err := client.internal.Pipeline().Do(req) 359 if err != nil { 360 return ExpressRouteCircuitsClientGetStatsResponse{}, err 361 } 362 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 363 err = runtime.NewResponseError(httpResp) 364 return ExpressRouteCircuitsClientGetStatsResponse{}, err 365 } 366 resp, err := client.getStatsHandleResponse(httpResp) 367 return resp, err 368 } 369 370 // getStatsCreateRequest creates the GetStats request. 371 func (client *ExpressRouteCircuitsClient) getStatsCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, options *ExpressRouteCircuitsClientGetStatsOptions) (*policy.Request, error) { 372 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats" 373 if resourceGroupName == "" { 374 return nil, errors.New("parameter resourceGroupName cannot be empty") 375 } 376 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 377 if circuitName == "" { 378 return nil, errors.New("parameter circuitName cannot be empty") 379 } 380 urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) 381 if client.subscriptionID == "" { 382 return nil, errors.New("parameter client.subscriptionID cannot be empty") 383 } 384 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 385 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 386 if err != nil { 387 return nil, err 388 } 389 reqQP := req.Raw().URL.Query() 390 reqQP.Set("api-version", "2024-05-01") 391 req.Raw().URL.RawQuery = reqQP.Encode() 392 req.Raw().Header["Accept"] = []string{"application/json"} 393 return req, nil 394 } 395 396 // getStatsHandleResponse handles the GetStats response. 397 func (client *ExpressRouteCircuitsClient) getStatsHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientGetStatsResponse, error) { 398 result := ExpressRouteCircuitsClientGetStatsResponse{} 399 if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitStats); err != nil { 400 return ExpressRouteCircuitsClientGetStatsResponse{}, err 401 } 402 return result, nil 403 } 404 405 // NewListPager - Gets all the express route circuits in a resource group. 406 // 407 // Generated from API version 2024-05-01 408 // - resourceGroupName - The name of the resource group. 409 // - options - ExpressRouteCircuitsClientListOptions contains the optional parameters for the ExpressRouteCircuitsClient.NewListPager 410 // method. 411 func (client *ExpressRouteCircuitsClient) NewListPager(resourceGroupName string, options *ExpressRouteCircuitsClientListOptions) *runtime.Pager[ExpressRouteCircuitsClientListResponse] { 412 return runtime.NewPager(runtime.PagingHandler[ExpressRouteCircuitsClientListResponse]{ 413 More: func(page ExpressRouteCircuitsClientListResponse) bool { 414 return page.NextLink != nil && len(*page.NextLink) > 0 415 }, 416 Fetcher: func(ctx context.Context, page *ExpressRouteCircuitsClientListResponse) (ExpressRouteCircuitsClientListResponse, error) { 417 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExpressRouteCircuitsClient.NewListPager") 418 nextLink := "" 419 if page != nil { 420 nextLink = *page.NextLink 421 } 422 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 423 return client.listCreateRequest(ctx, resourceGroupName, options) 424 }, nil) 425 if err != nil { 426 return ExpressRouteCircuitsClientListResponse{}, err 427 } 428 return client.listHandleResponse(resp) 429 }, 430 Tracer: client.internal.Tracer(), 431 }) 432 } 433 434 // listCreateRequest creates the List request. 435 func (client *ExpressRouteCircuitsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ExpressRouteCircuitsClientListOptions) (*policy.Request, error) { 436 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits" 437 if resourceGroupName == "" { 438 return nil, errors.New("parameter resourceGroupName cannot be empty") 439 } 440 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 441 if client.subscriptionID == "" { 442 return nil, errors.New("parameter client.subscriptionID cannot be empty") 443 } 444 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 445 req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 446 if err != nil { 447 return nil, err 448 } 449 reqQP := req.Raw().URL.Query() 450 reqQP.Set("api-version", "2024-05-01") 451 req.Raw().URL.RawQuery = reqQP.Encode() 452 req.Raw().Header["Accept"] = []string{"application/json"} 453 return req, nil 454 } 455 456 // listHandleResponse handles the List response. 457 func (client *ExpressRouteCircuitsClient) listHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientListResponse, error) { 458 result := ExpressRouteCircuitsClientListResponse{} 459 if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitListResult); err != nil { 460 return ExpressRouteCircuitsClientListResponse{}, err 461 } 462 return result, nil 463 } 464 465 // NewListAllPager - Gets all the express route circuits in a subscription. 466 // 467 // Generated from API version 2024-05-01 468 // - options - ExpressRouteCircuitsClientListAllOptions contains the optional parameters for the ExpressRouteCircuitsClient.NewListAllPager 469 // method. 470 func (client *ExpressRouteCircuitsClient) NewListAllPager(options *ExpressRouteCircuitsClientListAllOptions) *runtime.Pager[ExpressRouteCircuitsClientListAllResponse] { 471 return runtime.NewPager(runtime.PagingHandler[ExpressRouteCircuitsClientListAllResponse]{ 472 More: func(page ExpressRouteCircuitsClientListAllResponse) bool { 473 return page.NextLink != nil && len(*page.NextLink) > 0 474 }, 475 Fetcher: func(ctx context.Context, page *ExpressRouteCircuitsClientListAllResponse) (ExpressRouteCircuitsClientListAllResponse, error) { 476 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExpressRouteCircuitsClient.NewListAllPager") 477 nextLink := "" 478 if page != nil { 479 nextLink = *page.NextLink 480 } 481 resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { 482 return client.listAllCreateRequest(ctx, options) 483 }, nil) 484 if err != nil { 485 return ExpressRouteCircuitsClientListAllResponse{}, err 486 } 487 return client.listAllHandleResponse(resp) 488 }, 489 Tracer: client.internal.Tracer(), 490 }) 491 } 492 493 // listAllCreateRequest creates the ListAll request. 494 func (client *ExpressRouteCircuitsClient) listAllCreateRequest(ctx context.Context, options *ExpressRouteCircuitsClientListAllOptions) (*policy.Request, error) { 495 urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits" 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 // listAllHandleResponse handles the ListAll response. 512 func (client *ExpressRouteCircuitsClient) listAllHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientListAllResponse, error) { 513 result := ExpressRouteCircuitsClientListAllResponse{} 514 if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitListResult); err != nil { 515 return ExpressRouteCircuitsClientListAllResponse{}, err 516 } 517 return result, nil 518 } 519 520 // BeginListArpTable - Gets the currently advertised ARP table associated with the express route circuit in a resource group. 521 // If the operation fails it returns an *azcore.ResponseError type. 522 // 523 // Generated from API version 2024-05-01 524 // - resourceGroupName - The name of the resource group. 525 // - circuitName - The name of the express route circuit. 526 // - peeringName - The name of the peering. 527 // - devicePath - The path of the device. 528 // - options - ExpressRouteCircuitsClientBeginListArpTableOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginListArpTable 529 // method. 530 func (client *ExpressRouteCircuitsClient) BeginListArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListArpTableOptions) (*runtime.Poller[ExpressRouteCircuitsClientListArpTableResponse], error) { 531 if options == nil || options.ResumeToken == "" { 532 resp, err := client.listArpTable(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) 533 if err != nil { 534 return nil, err 535 } 536 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitsClientListArpTableResponse]{ 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[ExpressRouteCircuitsClientListArpTableResponse]{ 543 Tracer: client.internal.Tracer(), 544 }) 545 } 546 } 547 548 // ListArpTable - Gets the currently advertised ARP table associated with the express route circuit in a resource group. 549 // If the operation fails it returns an *azcore.ResponseError type. 550 // 551 // Generated from API version 2024-05-01 552 func (client *ExpressRouteCircuitsClient) listArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListArpTableOptions) (*http.Response, error) { 553 var err error 554 const operationName = "ExpressRouteCircuitsClient.BeginListArpTable" 555 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 556 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 557 defer func() { endSpan(err) }() 558 req, err := client.listArpTableCreateRequest(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) 559 if err != nil { 560 return nil, err 561 } 562 httpResp, err := client.internal.Pipeline().Do(req) 563 if err != nil { 564 return nil, err 565 } 566 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 567 err = runtime.NewResponseError(httpResp) 568 return nil, err 569 } 570 return httpResp, nil 571 } 572 573 // listArpTableCreateRequest creates the ListArpTable request. 574 func (client *ExpressRouteCircuitsClient) listArpTableCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListArpTableOptions) (*policy.Request, error) { 575 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}" 576 if resourceGroupName == "" { 577 return nil, errors.New("parameter resourceGroupName cannot be empty") 578 } 579 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 580 if circuitName == "" { 581 return nil, errors.New("parameter circuitName cannot be empty") 582 } 583 urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) 584 if peeringName == "" { 585 return nil, errors.New("parameter peeringName cannot be empty") 586 } 587 urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) 588 if devicePath == "" { 589 return nil, errors.New("parameter devicePath cannot be empty") 590 } 591 urlPath = strings.ReplaceAll(urlPath, "{devicePath}", url.PathEscape(devicePath)) 592 if client.subscriptionID == "" { 593 return nil, errors.New("parameter client.subscriptionID cannot be empty") 594 } 595 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 596 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 597 if err != nil { 598 return nil, err 599 } 600 reqQP := req.Raw().URL.Query() 601 reqQP.Set("api-version", "2024-05-01") 602 req.Raw().URL.RawQuery = reqQP.Encode() 603 req.Raw().Header["Accept"] = []string{"application/json"} 604 return req, nil 605 } 606 607 // BeginListRoutesTable - Gets the currently advertised routes table associated with the express route circuit in a resource 608 // group. 609 // If the operation fails it returns an *azcore.ResponseError type. 610 // 611 // Generated from API version 2024-05-01 612 // - resourceGroupName - The name of the resource group. 613 // - circuitName - The name of the express route circuit. 614 // - peeringName - The name of the peering. 615 // - devicePath - The path of the device. 616 // - options - ExpressRouteCircuitsClientBeginListRoutesTableOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginListRoutesTable 617 // method. 618 func (client *ExpressRouteCircuitsClient) BeginListRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableOptions) (*runtime.Poller[ExpressRouteCircuitsClientListRoutesTableResponse], error) { 619 if options == nil || options.ResumeToken == "" { 620 resp, err := client.listRoutesTable(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) 621 if err != nil { 622 return nil, err 623 } 624 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitsClientListRoutesTableResponse]{ 625 FinalStateVia: runtime.FinalStateViaLocation, 626 Tracer: client.internal.Tracer(), 627 }) 628 return poller, err 629 } else { 630 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExpressRouteCircuitsClientListRoutesTableResponse]{ 631 Tracer: client.internal.Tracer(), 632 }) 633 } 634 } 635 636 // ListRoutesTable - Gets the currently advertised routes table associated with the express route circuit in a resource group. 637 // If the operation fails it returns an *azcore.ResponseError type. 638 // 639 // Generated from API version 2024-05-01 640 func (client *ExpressRouteCircuitsClient) listRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableOptions) (*http.Response, error) { 641 var err error 642 const operationName = "ExpressRouteCircuitsClient.BeginListRoutesTable" 643 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 644 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 645 defer func() { endSpan(err) }() 646 req, err := client.listRoutesTableCreateRequest(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) 647 if err != nil { 648 return nil, err 649 } 650 httpResp, err := client.internal.Pipeline().Do(req) 651 if err != nil { 652 return nil, err 653 } 654 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 655 err = runtime.NewResponseError(httpResp) 656 return nil, err 657 } 658 return httpResp, nil 659 } 660 661 // listRoutesTableCreateRequest creates the ListRoutesTable request. 662 func (client *ExpressRouteCircuitsClient) listRoutesTableCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableOptions) (*policy.Request, error) { 663 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}" 664 if resourceGroupName == "" { 665 return nil, errors.New("parameter resourceGroupName cannot be empty") 666 } 667 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 668 if circuitName == "" { 669 return nil, errors.New("parameter circuitName cannot be empty") 670 } 671 urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) 672 if peeringName == "" { 673 return nil, errors.New("parameter peeringName cannot be empty") 674 } 675 urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) 676 if devicePath == "" { 677 return nil, errors.New("parameter devicePath cannot be empty") 678 } 679 urlPath = strings.ReplaceAll(urlPath, "{devicePath}", url.PathEscape(devicePath)) 680 if client.subscriptionID == "" { 681 return nil, errors.New("parameter client.subscriptionID cannot be empty") 682 } 683 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 684 req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 685 if err != nil { 686 return nil, err 687 } 688 reqQP := req.Raw().URL.Query() 689 reqQP.Set("api-version", "2024-05-01") 690 req.Raw().URL.RawQuery = reqQP.Encode() 691 req.Raw().Header["Accept"] = []string{"application/json"} 692 return req, nil 693 } 694 695 // BeginListRoutesTableSummary - Gets the currently advertised routes table summary associated with the express route circuit 696 // in a resource group. 697 // If the operation fails it returns an *azcore.ResponseError type. 698 // 699 // Generated from API version 2024-05-01 700 // - resourceGroupName - The name of the resource group. 701 // - circuitName - The name of the express route circuit. 702 // - peeringName - The name of the peering. 703 // - devicePath - The path of the device. 704 // - options - ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions contains the optional parameters for the ExpressRouteCircuitsClient.BeginListRoutesTableSummary 705 // method. 706 func (client *ExpressRouteCircuitsClient) BeginListRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions) (*runtime.Poller[ExpressRouteCircuitsClientListRoutesTableSummaryResponse], error) { 707 if options == nil || options.ResumeToken == "" { 708 resp, err := client.listRoutesTableSummary(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) 709 if err != nil { 710 return nil, err 711 } 712 poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExpressRouteCircuitsClientListRoutesTableSummaryResponse]{ 713 FinalStateVia: runtime.FinalStateViaLocation, 714 Tracer: client.internal.Tracer(), 715 }) 716 return poller, err 717 } else { 718 return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExpressRouteCircuitsClientListRoutesTableSummaryResponse]{ 719 Tracer: client.internal.Tracer(), 720 }) 721 } 722 } 723 724 // ListRoutesTableSummary - Gets the currently advertised routes table summary associated with the express route circuit in 725 // a resource group. 726 // If the operation fails it returns an *azcore.ResponseError type. 727 // 728 // Generated from API version 2024-05-01 729 func (client *ExpressRouteCircuitsClient) listRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions) (*http.Response, error) { 730 var err error 731 const operationName = "ExpressRouteCircuitsClient.BeginListRoutesTableSummary" 732 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 733 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 734 defer func() { endSpan(err) }() 735 req, err := client.listRoutesTableSummaryCreateRequest(ctx, resourceGroupName, circuitName, peeringName, devicePath, options) 736 if err != nil { 737 return nil, err 738 } 739 httpResp, err := client.internal.Pipeline().Do(req) 740 if err != nil { 741 return nil, err 742 } 743 if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { 744 err = runtime.NewResponseError(httpResp) 745 return nil, err 746 } 747 return httpResp, nil 748 } 749 750 // listRoutesTableSummaryCreateRequest creates the ListRoutesTableSummary request. 751 func (client *ExpressRouteCircuitsClient) listRoutesTableSummaryCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string, options *ExpressRouteCircuitsClientBeginListRoutesTableSummaryOptions) (*policy.Request, error) { 752 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}" 753 if resourceGroupName == "" { 754 return nil, errors.New("parameter resourceGroupName cannot be empty") 755 } 756 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 757 if circuitName == "" { 758 return nil, errors.New("parameter circuitName cannot be empty") 759 } 760 urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) 761 if peeringName == "" { 762 return nil, errors.New("parameter peeringName cannot be empty") 763 } 764 urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) 765 if devicePath == "" { 766 return nil, errors.New("parameter devicePath cannot be empty") 767 } 768 urlPath = strings.ReplaceAll(urlPath, "{devicePath}", url.PathEscape(devicePath)) 769 if client.subscriptionID == "" { 770 return nil, errors.New("parameter client.subscriptionID cannot be empty") 771 } 772 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 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 reqQP.Set("api-version", "2024-05-01") 779 req.Raw().URL.RawQuery = reqQP.Encode() 780 req.Raw().Header["Accept"] = []string{"application/json"} 781 return req, nil 782 } 783 784 // UpdateTags - Updates an express route circuit tags. 785 // If the operation fails it returns an *azcore.ResponseError type. 786 // 787 // Generated from API version 2024-05-01 788 // - resourceGroupName - The name of the resource group. 789 // - circuitName - The name of the circuit. 790 // - parameters - Parameters supplied to update express route circuit tags. 791 // - options - ExpressRouteCircuitsClientUpdateTagsOptions contains the optional parameters for the ExpressRouteCircuitsClient.UpdateTags 792 // method. 793 func (client *ExpressRouteCircuitsClient) UpdateTags(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject, options *ExpressRouteCircuitsClientUpdateTagsOptions) (ExpressRouteCircuitsClientUpdateTagsResponse, error) { 794 var err error 795 const operationName = "ExpressRouteCircuitsClient.UpdateTags" 796 ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) 797 ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) 798 defer func() { endSpan(err) }() 799 req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, circuitName, parameters, options) 800 if err != nil { 801 return ExpressRouteCircuitsClientUpdateTagsResponse{}, err 802 } 803 httpResp, err := client.internal.Pipeline().Do(req) 804 if err != nil { 805 return ExpressRouteCircuitsClientUpdateTagsResponse{}, err 806 } 807 if !runtime.HasStatusCode(httpResp, http.StatusOK) { 808 err = runtime.NewResponseError(httpResp) 809 return ExpressRouteCircuitsClientUpdateTagsResponse{}, err 810 } 811 resp, err := client.updateTagsHandleResponse(httpResp) 812 return resp, err 813 } 814 815 // updateTagsCreateRequest creates the UpdateTags request. 816 func (client *ExpressRouteCircuitsClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject, options *ExpressRouteCircuitsClientUpdateTagsOptions) (*policy.Request, error) { 817 urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}" 818 if resourceGroupName == "" { 819 return nil, errors.New("parameter resourceGroupName cannot be empty") 820 } 821 urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) 822 if circuitName == "" { 823 return nil, errors.New("parameter circuitName cannot be empty") 824 } 825 urlPath = strings.ReplaceAll(urlPath, "{circuitName}", url.PathEscape(circuitName)) 826 if client.subscriptionID == "" { 827 return nil, errors.New("parameter client.subscriptionID cannot be empty") 828 } 829 urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) 830 req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) 831 if err != nil { 832 return nil, err 833 } 834 reqQP := req.Raw().URL.Query() 835 reqQP.Set("api-version", "2024-05-01") 836 req.Raw().URL.RawQuery = reqQP.Encode() 837 req.Raw().Header["Accept"] = []string{"application/json"} 838 if err := runtime.MarshalAsJSON(req, parameters); err != nil { 839 return nil, err 840 } 841 return req, nil 842 } 843 844 // updateTagsHandleResponse handles the UpdateTags response. 845 func (client *ExpressRouteCircuitsClient) updateTagsHandleResponse(resp *http.Response) (ExpressRouteCircuitsClientUpdateTagsResponse, error) { 846 result := ExpressRouteCircuitsClientUpdateTagsResponse{} 847 if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuit); err != nil { 848 return ExpressRouteCircuitsClientUpdateTagsResponse{}, err 849 } 850 return result, nil 851 }