1package network 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/to" 15 "github.com/Azure/go-autorest/tracing" 16 "net/http" 17) 18 19// The package's fully qualified name. 20const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/network/mgmt/2015-05-01-preview/network" 21 22// AddressSpace addressSpace contains an array of IP address ranges that can be used by subnets 23type AddressSpace struct { 24 // AddressPrefixes - Gets or sets List of address blocks reserved for this virtual network in CIDR notation 25 AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` 26} 27 28// ApplicationGateway applicationGateways resource 29type ApplicationGateway struct { 30 autorest.Response `json:"-"` 31 *ApplicationGatewayPropertiesFormat `json:"properties,omitempty"` 32 // Etag - Gets a unique read-only string that changes whenever the resource is updated 33 Etag *string `json:"etag,omitempty"` 34 // ID - READ-ONLY; Resource Id 35 ID *string `json:"id,omitempty"` 36 // Name - READ-ONLY; Resource name 37 Name *string `json:"name,omitempty"` 38 // Type - READ-ONLY; Resource type 39 Type *string `json:"type,omitempty"` 40 // Location - Resource location 41 Location *string `json:"location,omitempty"` 42 // Tags - Resource tags 43 Tags map[string]*string `json:"tags"` 44} 45 46// MarshalJSON is the custom marshaler for ApplicationGateway. 47func (ag ApplicationGateway) MarshalJSON() ([]byte, error) { 48 objectMap := make(map[string]interface{}) 49 if ag.ApplicationGatewayPropertiesFormat != nil { 50 objectMap["properties"] = ag.ApplicationGatewayPropertiesFormat 51 } 52 if ag.Etag != nil { 53 objectMap["etag"] = ag.Etag 54 } 55 if ag.Location != nil { 56 objectMap["location"] = ag.Location 57 } 58 if ag.Tags != nil { 59 objectMap["tags"] = ag.Tags 60 } 61 return json.Marshal(objectMap) 62} 63 64// UnmarshalJSON is the custom unmarshaler for ApplicationGateway struct. 65func (ag *ApplicationGateway) UnmarshalJSON(body []byte) error { 66 var m map[string]*json.RawMessage 67 err := json.Unmarshal(body, &m) 68 if err != nil { 69 return err 70 } 71 for k, v := range m { 72 switch k { 73 case "properties": 74 if v != nil { 75 var applicationGatewayPropertiesFormat ApplicationGatewayPropertiesFormat 76 err = json.Unmarshal(*v, &applicationGatewayPropertiesFormat) 77 if err != nil { 78 return err 79 } 80 ag.ApplicationGatewayPropertiesFormat = &applicationGatewayPropertiesFormat 81 } 82 case "etag": 83 if v != nil { 84 var etag string 85 err = json.Unmarshal(*v, &etag) 86 if err != nil { 87 return err 88 } 89 ag.Etag = &etag 90 } 91 case "id": 92 if v != nil { 93 var ID string 94 err = json.Unmarshal(*v, &ID) 95 if err != nil { 96 return err 97 } 98 ag.ID = &ID 99 } 100 case "name": 101 if v != nil { 102 var name string 103 err = json.Unmarshal(*v, &name) 104 if err != nil { 105 return err 106 } 107 ag.Name = &name 108 } 109 case "type": 110 if v != nil { 111 var typeVar string 112 err = json.Unmarshal(*v, &typeVar) 113 if err != nil { 114 return err 115 } 116 ag.Type = &typeVar 117 } 118 case "location": 119 if v != nil { 120 var location string 121 err = json.Unmarshal(*v, &location) 122 if err != nil { 123 return err 124 } 125 ag.Location = &location 126 } 127 case "tags": 128 if v != nil { 129 var tags map[string]*string 130 err = json.Unmarshal(*v, &tags) 131 if err != nil { 132 return err 133 } 134 ag.Tags = tags 135 } 136 } 137 } 138 139 return nil 140} 141 142// ApplicationGatewayBackendAddress backend Address of application gateway 143type ApplicationGatewayBackendAddress struct { 144 // Fqdn - Gets or sets the dns name 145 Fqdn *string `json:"fqdn,omitempty"` 146 // IPAddress - Gets or sets the ip address 147 IPAddress *string `json:"ipAddress,omitempty"` 148} 149 150// ApplicationGatewayBackendAddressPool backend Address Pool of application gateway 151type ApplicationGatewayBackendAddressPool struct { 152 *ApplicationGatewayBackendAddressPoolPropertiesFormat `json:"properties,omitempty"` 153 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 154 Name *string `json:"name,omitempty"` 155 // Etag - A unique read-only string that changes whenever the resource is updated 156 Etag *string `json:"etag,omitempty"` 157 // ID - Resource Id 158 ID *string `json:"id,omitempty"` 159} 160 161// MarshalJSON is the custom marshaler for ApplicationGatewayBackendAddressPool. 162func (agbap ApplicationGatewayBackendAddressPool) MarshalJSON() ([]byte, error) { 163 objectMap := make(map[string]interface{}) 164 if agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat != nil { 165 objectMap["properties"] = agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat 166 } 167 if agbap.Name != nil { 168 objectMap["name"] = agbap.Name 169 } 170 if agbap.Etag != nil { 171 objectMap["etag"] = agbap.Etag 172 } 173 if agbap.ID != nil { 174 objectMap["id"] = agbap.ID 175 } 176 return json.Marshal(objectMap) 177} 178 179// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendAddressPool struct. 180func (agbap *ApplicationGatewayBackendAddressPool) UnmarshalJSON(body []byte) error { 181 var m map[string]*json.RawMessage 182 err := json.Unmarshal(body, &m) 183 if err != nil { 184 return err 185 } 186 for k, v := range m { 187 switch k { 188 case "properties": 189 if v != nil { 190 var applicationGatewayBackendAddressPoolPropertiesFormat ApplicationGatewayBackendAddressPoolPropertiesFormat 191 err = json.Unmarshal(*v, &applicationGatewayBackendAddressPoolPropertiesFormat) 192 if err != nil { 193 return err 194 } 195 agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat = &applicationGatewayBackendAddressPoolPropertiesFormat 196 } 197 case "name": 198 if v != nil { 199 var name string 200 err = json.Unmarshal(*v, &name) 201 if err != nil { 202 return err 203 } 204 agbap.Name = &name 205 } 206 case "etag": 207 if v != nil { 208 var etag string 209 err = json.Unmarshal(*v, &etag) 210 if err != nil { 211 return err 212 } 213 agbap.Etag = &etag 214 } 215 case "id": 216 if v != nil { 217 var ID string 218 err = json.Unmarshal(*v, &ID) 219 if err != nil { 220 return err 221 } 222 agbap.ID = &ID 223 } 224 } 225 } 226 227 return nil 228} 229 230// ApplicationGatewayBackendAddressPoolPropertiesFormat properties of Backend Address Pool of application 231// gateway 232type ApplicationGatewayBackendAddressPoolPropertiesFormat struct { 233 // BackendIPConfigurations - Gets or sets backendIPConfiguration of application gateway 234 BackendIPConfigurations *[]SubResource `json:"backendIPConfigurations,omitempty"` 235 // BackendAddresses - Gets or sets the backend addresses 236 BackendAddresses *[]ApplicationGatewayBackendAddress `json:"backendAddresses,omitempty"` 237 // ProvisioningState - Gets or sets Provisioning state of the backend address pool resource Updating/Deleting/Failed 238 ProvisioningState *string `json:"provisioningState,omitempty"` 239} 240 241// ApplicationGatewayBackendHTTPSettings backend address pool settings of application gateway 242type ApplicationGatewayBackendHTTPSettings struct { 243 *ApplicationGatewayBackendHTTPSettingsPropertiesFormat `json:"properties,omitempty"` 244 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 245 Name *string `json:"name,omitempty"` 246 // Etag - A unique read-only string that changes whenever the resource is updated 247 Etag *string `json:"etag,omitempty"` 248 // ID - Resource Id 249 ID *string `json:"id,omitempty"` 250} 251 252// MarshalJSON is the custom marshaler for ApplicationGatewayBackendHTTPSettings. 253func (agbhs ApplicationGatewayBackendHTTPSettings) MarshalJSON() ([]byte, error) { 254 objectMap := make(map[string]interface{}) 255 if agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat != nil { 256 objectMap["properties"] = agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat 257 } 258 if agbhs.Name != nil { 259 objectMap["name"] = agbhs.Name 260 } 261 if agbhs.Etag != nil { 262 objectMap["etag"] = agbhs.Etag 263 } 264 if agbhs.ID != nil { 265 objectMap["id"] = agbhs.ID 266 } 267 return json.Marshal(objectMap) 268} 269 270// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendHTTPSettings struct. 271func (agbhs *ApplicationGatewayBackendHTTPSettings) UnmarshalJSON(body []byte) error { 272 var m map[string]*json.RawMessage 273 err := json.Unmarshal(body, &m) 274 if err != nil { 275 return err 276 } 277 for k, v := range m { 278 switch k { 279 case "properties": 280 if v != nil { 281 var applicationGatewayBackendHTTPSettingsPropertiesFormat ApplicationGatewayBackendHTTPSettingsPropertiesFormat 282 err = json.Unmarshal(*v, &applicationGatewayBackendHTTPSettingsPropertiesFormat) 283 if err != nil { 284 return err 285 } 286 agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat = &applicationGatewayBackendHTTPSettingsPropertiesFormat 287 } 288 case "name": 289 if v != nil { 290 var name string 291 err = json.Unmarshal(*v, &name) 292 if err != nil { 293 return err 294 } 295 agbhs.Name = &name 296 } 297 case "etag": 298 if v != nil { 299 var etag string 300 err = json.Unmarshal(*v, &etag) 301 if err != nil { 302 return err 303 } 304 agbhs.Etag = &etag 305 } 306 case "id": 307 if v != nil { 308 var ID string 309 err = json.Unmarshal(*v, &ID) 310 if err != nil { 311 return err 312 } 313 agbhs.ID = &ID 314 } 315 } 316 } 317 318 return nil 319} 320 321// ApplicationGatewayBackendHTTPSettingsPropertiesFormat properties of Backend address pool settings of 322// application gateway 323type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct { 324 // Port - Gets or sets the port 325 Port *int32 `json:"port,omitempty"` 326 // Protocol - Gets or sets the protocol. Possible values include: 'HTTP', 'HTTPS' 327 Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` 328 // CookieBasedAffinity - Gets or sets the cookie affinity. Possible values include: 'Enabled', 'Disabled' 329 CookieBasedAffinity ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"` 330 // ProvisioningState - Gets or sets Provisioning state of the backend http settings resource Updating/Deleting/Failed 331 ProvisioningState *string `json:"provisioningState,omitempty"` 332} 333 334// ApplicationGatewayFrontendIPConfiguration frontend IP configuration of application gateway 335type ApplicationGatewayFrontendIPConfiguration struct { 336 *ApplicationGatewayFrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` 337 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 338 Name *string `json:"name,omitempty"` 339 // Etag - A unique read-only string that changes whenever the resource is updated 340 Etag *string `json:"etag,omitempty"` 341 // ID - Resource Id 342 ID *string `json:"id,omitempty"` 343} 344 345// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendIPConfiguration. 346func (agfic ApplicationGatewayFrontendIPConfiguration) MarshalJSON() ([]byte, error) { 347 objectMap := make(map[string]interface{}) 348 if agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat != nil { 349 objectMap["properties"] = agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat 350 } 351 if agfic.Name != nil { 352 objectMap["name"] = agfic.Name 353 } 354 if agfic.Etag != nil { 355 objectMap["etag"] = agfic.Etag 356 } 357 if agfic.ID != nil { 358 objectMap["id"] = agfic.ID 359 } 360 return json.Marshal(objectMap) 361} 362 363// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFrontendIPConfiguration struct. 364func (agfic *ApplicationGatewayFrontendIPConfiguration) UnmarshalJSON(body []byte) error { 365 var m map[string]*json.RawMessage 366 err := json.Unmarshal(body, &m) 367 if err != nil { 368 return err 369 } 370 for k, v := range m { 371 switch k { 372 case "properties": 373 if v != nil { 374 var applicationGatewayFrontendIPConfigurationPropertiesFormat ApplicationGatewayFrontendIPConfigurationPropertiesFormat 375 err = json.Unmarshal(*v, &applicationGatewayFrontendIPConfigurationPropertiesFormat) 376 if err != nil { 377 return err 378 } 379 agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat = &applicationGatewayFrontendIPConfigurationPropertiesFormat 380 } 381 case "name": 382 if v != nil { 383 var name string 384 err = json.Unmarshal(*v, &name) 385 if err != nil { 386 return err 387 } 388 agfic.Name = &name 389 } 390 case "etag": 391 if v != nil { 392 var etag string 393 err = json.Unmarshal(*v, &etag) 394 if err != nil { 395 return err 396 } 397 agfic.Etag = &etag 398 } 399 case "id": 400 if v != nil { 401 var ID string 402 err = json.Unmarshal(*v, &ID) 403 if err != nil { 404 return err 405 } 406 agfic.ID = &ID 407 } 408 } 409 } 410 411 return nil 412} 413 414// ApplicationGatewayFrontendIPConfigurationPropertiesFormat properties of Frontend IP configuration of 415// application gateway 416type ApplicationGatewayFrontendIPConfigurationPropertiesFormat struct { 417 // PrivateIPAddress - Gets or sets the privateIPAddress of the Network Interface IP Configuration 418 PrivateIPAddress *string `json:"privateIPAddress,omitempty"` 419 // PrivateIPAllocationMethod - Gets or sets PrivateIP allocation method (Static/Dynamic). Possible values include: 'Static', 'Dynamic' 420 PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` 421 // Subnet - Gets or sets the reference of the subnet resource 422 Subnet *SubResource `json:"subnet,omitempty"` 423 // PublicIPAddress - Gets or sets the reference of the PublicIP resource 424 PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` 425 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 426 ProvisioningState *string `json:"provisioningState,omitempty"` 427} 428 429// ApplicationGatewayFrontendPort frontend Port of application gateway 430type ApplicationGatewayFrontendPort struct { 431 *ApplicationGatewayFrontendPortPropertiesFormat `json:"properties,omitempty"` 432 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 433 Name *string `json:"name,omitempty"` 434 // Etag - A unique read-only string that changes whenever the resource is updated 435 Etag *string `json:"etag,omitempty"` 436 // ID - Resource Id 437 ID *string `json:"id,omitempty"` 438} 439 440// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendPort. 441func (agfp ApplicationGatewayFrontendPort) MarshalJSON() ([]byte, error) { 442 objectMap := make(map[string]interface{}) 443 if agfp.ApplicationGatewayFrontendPortPropertiesFormat != nil { 444 objectMap["properties"] = agfp.ApplicationGatewayFrontendPortPropertiesFormat 445 } 446 if agfp.Name != nil { 447 objectMap["name"] = agfp.Name 448 } 449 if agfp.Etag != nil { 450 objectMap["etag"] = agfp.Etag 451 } 452 if agfp.ID != nil { 453 objectMap["id"] = agfp.ID 454 } 455 return json.Marshal(objectMap) 456} 457 458// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFrontendPort struct. 459func (agfp *ApplicationGatewayFrontendPort) UnmarshalJSON(body []byte) error { 460 var m map[string]*json.RawMessage 461 err := json.Unmarshal(body, &m) 462 if err != nil { 463 return err 464 } 465 for k, v := range m { 466 switch k { 467 case "properties": 468 if v != nil { 469 var applicationGatewayFrontendPortPropertiesFormat ApplicationGatewayFrontendPortPropertiesFormat 470 err = json.Unmarshal(*v, &applicationGatewayFrontendPortPropertiesFormat) 471 if err != nil { 472 return err 473 } 474 agfp.ApplicationGatewayFrontendPortPropertiesFormat = &applicationGatewayFrontendPortPropertiesFormat 475 } 476 case "name": 477 if v != nil { 478 var name string 479 err = json.Unmarshal(*v, &name) 480 if err != nil { 481 return err 482 } 483 agfp.Name = &name 484 } 485 case "etag": 486 if v != nil { 487 var etag string 488 err = json.Unmarshal(*v, &etag) 489 if err != nil { 490 return err 491 } 492 agfp.Etag = &etag 493 } 494 case "id": 495 if v != nil { 496 var ID string 497 err = json.Unmarshal(*v, &ID) 498 if err != nil { 499 return err 500 } 501 agfp.ID = &ID 502 } 503 } 504 } 505 506 return nil 507} 508 509// ApplicationGatewayFrontendPortPropertiesFormat properties of Frontend Port of application gateway 510type ApplicationGatewayFrontendPortPropertiesFormat struct { 511 // Port - Gets or sets the frontend port 512 Port *int32 `json:"port,omitempty"` 513 // ProvisioningState - Gets or sets Provisioning state of the frontend port resource Updating/Deleting/Failed 514 ProvisioningState *string `json:"provisioningState,omitempty"` 515} 516 517// ApplicationGatewayHTTPListener http listener of application gateway 518type ApplicationGatewayHTTPListener struct { 519 *ApplicationGatewayHTTPListenerPropertiesFormat `json:"properties,omitempty"` 520 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 521 Name *string `json:"name,omitempty"` 522 // Etag - A unique read-only string that changes whenever the resource is updated 523 Etag *string `json:"etag,omitempty"` 524 // ID - Resource Id 525 ID *string `json:"id,omitempty"` 526} 527 528// MarshalJSON is the custom marshaler for ApplicationGatewayHTTPListener. 529func (aghl ApplicationGatewayHTTPListener) MarshalJSON() ([]byte, error) { 530 objectMap := make(map[string]interface{}) 531 if aghl.ApplicationGatewayHTTPListenerPropertiesFormat != nil { 532 objectMap["properties"] = aghl.ApplicationGatewayHTTPListenerPropertiesFormat 533 } 534 if aghl.Name != nil { 535 objectMap["name"] = aghl.Name 536 } 537 if aghl.Etag != nil { 538 objectMap["etag"] = aghl.Etag 539 } 540 if aghl.ID != nil { 541 objectMap["id"] = aghl.ID 542 } 543 return json.Marshal(objectMap) 544} 545 546// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayHTTPListener struct. 547func (aghl *ApplicationGatewayHTTPListener) UnmarshalJSON(body []byte) error { 548 var m map[string]*json.RawMessage 549 err := json.Unmarshal(body, &m) 550 if err != nil { 551 return err 552 } 553 for k, v := range m { 554 switch k { 555 case "properties": 556 if v != nil { 557 var applicationGatewayHTTPListenerPropertiesFormat ApplicationGatewayHTTPListenerPropertiesFormat 558 err = json.Unmarshal(*v, &applicationGatewayHTTPListenerPropertiesFormat) 559 if err != nil { 560 return err 561 } 562 aghl.ApplicationGatewayHTTPListenerPropertiesFormat = &applicationGatewayHTTPListenerPropertiesFormat 563 } 564 case "name": 565 if v != nil { 566 var name string 567 err = json.Unmarshal(*v, &name) 568 if err != nil { 569 return err 570 } 571 aghl.Name = &name 572 } 573 case "etag": 574 if v != nil { 575 var etag string 576 err = json.Unmarshal(*v, &etag) 577 if err != nil { 578 return err 579 } 580 aghl.Etag = &etag 581 } 582 case "id": 583 if v != nil { 584 var ID string 585 err = json.Unmarshal(*v, &ID) 586 if err != nil { 587 return err 588 } 589 aghl.ID = &ID 590 } 591 } 592 } 593 594 return nil 595} 596 597// ApplicationGatewayHTTPListenerPropertiesFormat properties of Http listener of application gateway 598type ApplicationGatewayHTTPListenerPropertiesFormat struct { 599 // FrontendIPConfiguration - Gets or sets frontend IP configuration resource of application gateway 600 FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` 601 // FrontendPort - Gets or sets frontend port resource of application gateway 602 FrontendPort *SubResource `json:"frontendPort,omitempty"` 603 // Protocol - Gets or sets the protocol. Possible values include: 'HTTP', 'HTTPS' 604 Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` 605 // SslCertificate - Gets or sets ssl certificate resource of application gateway 606 SslCertificate *SubResource `json:"sslCertificate,omitempty"` 607 // ProvisioningState - Gets or sets Provisioning state of the http listener resource Updating/Deleting/Failed 608 ProvisioningState *string `json:"provisioningState,omitempty"` 609} 610 611// ApplicationGatewayIPConfiguration IP configuration of application gateway 612type ApplicationGatewayIPConfiguration struct { 613 *ApplicationGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` 614 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 615 Name *string `json:"name,omitempty"` 616 // Etag - A unique read-only string that changes whenever the resource is updated 617 Etag *string `json:"etag,omitempty"` 618 // ID - Resource Id 619 ID *string `json:"id,omitempty"` 620} 621 622// MarshalJSON is the custom marshaler for ApplicationGatewayIPConfiguration. 623func (agic ApplicationGatewayIPConfiguration) MarshalJSON() ([]byte, error) { 624 objectMap := make(map[string]interface{}) 625 if agic.ApplicationGatewayIPConfigurationPropertiesFormat != nil { 626 objectMap["properties"] = agic.ApplicationGatewayIPConfigurationPropertiesFormat 627 } 628 if agic.Name != nil { 629 objectMap["name"] = agic.Name 630 } 631 if agic.Etag != nil { 632 objectMap["etag"] = agic.Etag 633 } 634 if agic.ID != nil { 635 objectMap["id"] = agic.ID 636 } 637 return json.Marshal(objectMap) 638} 639 640// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayIPConfiguration struct. 641func (agic *ApplicationGatewayIPConfiguration) UnmarshalJSON(body []byte) error { 642 var m map[string]*json.RawMessage 643 err := json.Unmarshal(body, &m) 644 if err != nil { 645 return err 646 } 647 for k, v := range m { 648 switch k { 649 case "properties": 650 if v != nil { 651 var applicationGatewayIPConfigurationPropertiesFormat ApplicationGatewayIPConfigurationPropertiesFormat 652 err = json.Unmarshal(*v, &applicationGatewayIPConfigurationPropertiesFormat) 653 if err != nil { 654 return err 655 } 656 agic.ApplicationGatewayIPConfigurationPropertiesFormat = &applicationGatewayIPConfigurationPropertiesFormat 657 } 658 case "name": 659 if v != nil { 660 var name string 661 err = json.Unmarshal(*v, &name) 662 if err != nil { 663 return err 664 } 665 agic.Name = &name 666 } 667 case "etag": 668 if v != nil { 669 var etag string 670 err = json.Unmarshal(*v, &etag) 671 if err != nil { 672 return err 673 } 674 agic.Etag = &etag 675 } 676 case "id": 677 if v != nil { 678 var ID string 679 err = json.Unmarshal(*v, &ID) 680 if err != nil { 681 return err 682 } 683 agic.ID = &ID 684 } 685 } 686 } 687 688 return nil 689} 690 691// ApplicationGatewayIPConfigurationPropertiesFormat properties of IP configuration of application gateway 692type ApplicationGatewayIPConfigurationPropertiesFormat struct { 693 // Subnet - Gets or sets the reference of the subnet resource.A subnet from where application gateway gets its private address 694 Subnet *SubResource `json:"subnet,omitempty"` 695 // ProvisioningState - Gets or sets Provisioning state of the application gateway subnet resource Updating/Deleting/Failed 696 ProvisioningState *string `json:"provisioningState,omitempty"` 697} 698 699// ApplicationGatewayListResult response for ListLoadBalancers Api service call 700type ApplicationGatewayListResult struct { 701 autorest.Response `json:"-"` 702 // Value - Gets a list of ApplicationGateways in a resource group 703 Value *[]ApplicationGateway `json:"value,omitempty"` 704 // NextLink - Gets the URL to get the next set of results. 705 NextLink *string `json:"nextLink,omitempty"` 706} 707 708// ApplicationGatewayListResultIterator provides access to a complete listing of ApplicationGateway values. 709type ApplicationGatewayListResultIterator struct { 710 i int 711 page ApplicationGatewayListResultPage 712} 713 714// NextWithContext advances to the next value. If there was an error making 715// the request the iterator does not advance and the error is returned. 716func (iter *ApplicationGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { 717 if tracing.IsEnabled() { 718 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayListResultIterator.NextWithContext") 719 defer func() { 720 sc := -1 721 if iter.Response().Response.Response != nil { 722 sc = iter.Response().Response.Response.StatusCode 723 } 724 tracing.EndSpan(ctx, sc, err) 725 }() 726 } 727 iter.i++ 728 if iter.i < len(iter.page.Values()) { 729 return nil 730 } 731 err = iter.page.NextWithContext(ctx) 732 if err != nil { 733 iter.i-- 734 return err 735 } 736 iter.i = 0 737 return nil 738} 739 740// Next advances to the next value. If there was an error making 741// the request the iterator does not advance and the error is returned. 742// Deprecated: Use NextWithContext() instead. 743func (iter *ApplicationGatewayListResultIterator) Next() error { 744 return iter.NextWithContext(context.Background()) 745} 746 747// NotDone returns true if the enumeration should be started or is not yet complete. 748func (iter ApplicationGatewayListResultIterator) NotDone() bool { 749 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 750} 751 752// Response returns the raw server response from the last page request. 753func (iter ApplicationGatewayListResultIterator) Response() ApplicationGatewayListResult { 754 return iter.page.Response() 755} 756 757// Value returns the current value or a zero-initialized value if the 758// iterator has advanced beyond the end of the collection. 759func (iter ApplicationGatewayListResultIterator) Value() ApplicationGateway { 760 if !iter.page.NotDone() { 761 return ApplicationGateway{} 762 } 763 return iter.page.Values()[iter.i] 764} 765 766// Creates a new instance of the ApplicationGatewayListResultIterator type. 767func NewApplicationGatewayListResultIterator(page ApplicationGatewayListResultPage) ApplicationGatewayListResultIterator { 768 return ApplicationGatewayListResultIterator{page: page} 769} 770 771// IsEmpty returns true if the ListResult contains no values. 772func (aglr ApplicationGatewayListResult) IsEmpty() bool { 773 return aglr.Value == nil || len(*aglr.Value) == 0 774} 775 776// hasNextLink returns true if the NextLink is not empty. 777func (aglr ApplicationGatewayListResult) hasNextLink() bool { 778 return aglr.NextLink != nil && len(*aglr.NextLink) != 0 779} 780 781// applicationGatewayListResultPreparer prepares a request to retrieve the next set of results. 782// It returns nil if no more results exist. 783func (aglr ApplicationGatewayListResult) applicationGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { 784 if !aglr.hasNextLink() { 785 return nil, nil 786 } 787 return autorest.Prepare((&http.Request{}).WithContext(ctx), 788 autorest.AsJSON(), 789 autorest.AsGet(), 790 autorest.WithBaseURL(to.String(aglr.NextLink))) 791} 792 793// ApplicationGatewayListResultPage contains a page of ApplicationGateway values. 794type ApplicationGatewayListResultPage struct { 795 fn func(context.Context, ApplicationGatewayListResult) (ApplicationGatewayListResult, error) 796 aglr ApplicationGatewayListResult 797} 798 799// NextWithContext advances to the next page of values. If there was an error making 800// the request the page does not advance and the error is returned. 801func (page *ApplicationGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { 802 if tracing.IsEnabled() { 803 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayListResultPage.NextWithContext") 804 defer func() { 805 sc := -1 806 if page.Response().Response.Response != nil { 807 sc = page.Response().Response.Response.StatusCode 808 } 809 tracing.EndSpan(ctx, sc, err) 810 }() 811 } 812 for { 813 next, err := page.fn(ctx, page.aglr) 814 if err != nil { 815 return err 816 } 817 page.aglr = next 818 if !next.hasNextLink() || !next.IsEmpty() { 819 break 820 } 821 } 822 return nil 823} 824 825// Next advances to the next page of values. If there was an error making 826// the request the page does not advance and the error is returned. 827// Deprecated: Use NextWithContext() instead. 828func (page *ApplicationGatewayListResultPage) Next() error { 829 return page.NextWithContext(context.Background()) 830} 831 832// NotDone returns true if the page enumeration should be started or is not yet complete. 833func (page ApplicationGatewayListResultPage) NotDone() bool { 834 return !page.aglr.IsEmpty() 835} 836 837// Response returns the raw server response from the last page request. 838func (page ApplicationGatewayListResultPage) Response() ApplicationGatewayListResult { 839 return page.aglr 840} 841 842// Values returns the slice of values for the current page or nil if there are no values. 843func (page ApplicationGatewayListResultPage) Values() []ApplicationGateway { 844 if page.aglr.IsEmpty() { 845 return nil 846 } 847 return *page.aglr.Value 848} 849 850// Creates a new instance of the ApplicationGatewayListResultPage type. 851func NewApplicationGatewayListResultPage(cur ApplicationGatewayListResult, getNextPage func(context.Context, ApplicationGatewayListResult) (ApplicationGatewayListResult, error)) ApplicationGatewayListResultPage { 852 return ApplicationGatewayListResultPage{ 853 fn: getNextPage, 854 aglr: cur, 855 } 856} 857 858// ApplicationGatewayPropertiesFormat properties of Application Gateway 859type ApplicationGatewayPropertiesFormat struct { 860 // Sku - Gets or sets sku of application gateway resource 861 Sku *ApplicationGatewaySku `json:"sku,omitempty"` 862 // OperationalState - READ-ONLY; Gets operational state of application gateway resource. Possible values include: 'Stopped', 'Starting', 'Running', 'Stopping' 863 OperationalState ApplicationGatewayOperationalState `json:"operationalState,omitempty"` 864 // GatewayIPConfigurations - Gets or sets subnets of application gateway resource 865 GatewayIPConfigurations *[]ApplicationGatewayIPConfiguration `json:"gatewayIPConfigurations,omitempty"` 866 // SslCertificates - Gets or sets ssl certificates of application gateway resource 867 SslCertificates *[]ApplicationGatewaySslCertificate `json:"sslCertificates,omitempty"` 868 // FrontendIPConfigurations - Gets or sets frontend IP addresses of application gateway resource 869 FrontendIPConfigurations *[]ApplicationGatewayFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` 870 // FrontendPorts - Gets or sets frontend ports of application gateway resource 871 FrontendPorts *[]ApplicationGatewayFrontendPort `json:"frontendPorts,omitempty"` 872 // BackendAddressPools - Gets or sets backend address pool of application gateway resource 873 BackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"backendAddressPools,omitempty"` 874 // BackendHTTPSettingsCollection - Gets or sets backend http settings of application gateway resource 875 BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` 876 // HTTPListeners - Gets or sets HTTP listeners of application gateway resource 877 HTTPListeners *[]ApplicationGatewayHTTPListener `json:"httpListeners,omitempty"` 878 // RequestRoutingRules - Gets or sets request routing rules of application gateway resource 879 RequestRoutingRules *[]ApplicationGatewayRequestRoutingRule `json:"requestRoutingRules,omitempty"` 880 // ResourceGUID - Gets or sets resource guid property of the ApplicationGateway resource 881 ResourceGUID *string `json:"resourceGuid,omitempty"` 882 // ProvisioningState - Gets or sets Provisioning state of the ApplicationGateway resource Updating/Deleting/Failed 883 ProvisioningState *string `json:"provisioningState,omitempty"` 884} 885 886// MarshalJSON is the custom marshaler for ApplicationGatewayPropertiesFormat. 887func (agpf ApplicationGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { 888 objectMap := make(map[string]interface{}) 889 if agpf.Sku != nil { 890 objectMap["sku"] = agpf.Sku 891 } 892 if agpf.GatewayIPConfigurations != nil { 893 objectMap["gatewayIPConfigurations"] = agpf.GatewayIPConfigurations 894 } 895 if agpf.SslCertificates != nil { 896 objectMap["sslCertificates"] = agpf.SslCertificates 897 } 898 if agpf.FrontendIPConfigurations != nil { 899 objectMap["frontendIPConfigurations"] = agpf.FrontendIPConfigurations 900 } 901 if agpf.FrontendPorts != nil { 902 objectMap["frontendPorts"] = agpf.FrontendPorts 903 } 904 if agpf.BackendAddressPools != nil { 905 objectMap["backendAddressPools"] = agpf.BackendAddressPools 906 } 907 if agpf.BackendHTTPSettingsCollection != nil { 908 objectMap["backendHttpSettingsCollection"] = agpf.BackendHTTPSettingsCollection 909 } 910 if agpf.HTTPListeners != nil { 911 objectMap["httpListeners"] = agpf.HTTPListeners 912 } 913 if agpf.RequestRoutingRules != nil { 914 objectMap["requestRoutingRules"] = agpf.RequestRoutingRules 915 } 916 if agpf.ResourceGUID != nil { 917 objectMap["resourceGuid"] = agpf.ResourceGUID 918 } 919 if agpf.ProvisioningState != nil { 920 objectMap["provisioningState"] = agpf.ProvisioningState 921 } 922 return json.Marshal(objectMap) 923} 924 925// ApplicationGatewayRequestRoutingRule request routing rule of application gateway 926type ApplicationGatewayRequestRoutingRule struct { 927 *ApplicationGatewayRequestRoutingRulePropertiesFormat `json:"properties,omitempty"` 928 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 929 Name *string `json:"name,omitempty"` 930 // Etag - A unique read-only string that changes whenever the resource is updated 931 Etag *string `json:"etag,omitempty"` 932 // ID - Resource Id 933 ID *string `json:"id,omitempty"` 934} 935 936// MarshalJSON is the custom marshaler for ApplicationGatewayRequestRoutingRule. 937func (agrrr ApplicationGatewayRequestRoutingRule) MarshalJSON() ([]byte, error) { 938 objectMap := make(map[string]interface{}) 939 if agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat != nil { 940 objectMap["properties"] = agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat 941 } 942 if agrrr.Name != nil { 943 objectMap["name"] = agrrr.Name 944 } 945 if agrrr.Etag != nil { 946 objectMap["etag"] = agrrr.Etag 947 } 948 if agrrr.ID != nil { 949 objectMap["id"] = agrrr.ID 950 } 951 return json.Marshal(objectMap) 952} 953 954// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRequestRoutingRule struct. 955func (agrrr *ApplicationGatewayRequestRoutingRule) UnmarshalJSON(body []byte) error { 956 var m map[string]*json.RawMessage 957 err := json.Unmarshal(body, &m) 958 if err != nil { 959 return err 960 } 961 for k, v := range m { 962 switch k { 963 case "properties": 964 if v != nil { 965 var applicationGatewayRequestRoutingRulePropertiesFormat ApplicationGatewayRequestRoutingRulePropertiesFormat 966 err = json.Unmarshal(*v, &applicationGatewayRequestRoutingRulePropertiesFormat) 967 if err != nil { 968 return err 969 } 970 agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat = &applicationGatewayRequestRoutingRulePropertiesFormat 971 } 972 case "name": 973 if v != nil { 974 var name string 975 err = json.Unmarshal(*v, &name) 976 if err != nil { 977 return err 978 } 979 agrrr.Name = &name 980 } 981 case "etag": 982 if v != nil { 983 var etag string 984 err = json.Unmarshal(*v, &etag) 985 if err != nil { 986 return err 987 } 988 agrrr.Etag = &etag 989 } 990 case "id": 991 if v != nil { 992 var ID string 993 err = json.Unmarshal(*v, &ID) 994 if err != nil { 995 return err 996 } 997 agrrr.ID = &ID 998 } 999 } 1000 } 1001 1002 return nil 1003} 1004 1005// ApplicationGatewayRequestRoutingRulePropertiesFormat properties of Request routing rule of application 1006// gateway 1007type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { 1008 // RuleType - Gets or sets the rule type. Possible values include: 'Basic' 1009 RuleType ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` 1010 // BackendAddressPool - Gets or sets backend address pool resource of application gateway 1011 BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` 1012 // BackendHTTPSettings - Gets or sets frontend port resource of application gateway 1013 BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` 1014 // HTTPListener - Gets or sets http listener resource of application gateway 1015 HTTPListener *SubResource `json:"httpListener,omitempty"` 1016 // ProvisioningState - Gets or sets Provisioning state of the request routing rule resource Updating/Deleting/Failed 1017 ProvisioningState *string `json:"provisioningState,omitempty"` 1018} 1019 1020// ApplicationGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1021// long-running operation. 1022type ApplicationGatewaysCreateOrUpdateFuture struct { 1023 azure.FutureAPI 1024 // Result returns the result of the asynchronous operation. 1025 // If the operation has not completed it will return an error. 1026 Result func(ApplicationGatewaysClient) (ApplicationGateway, error) 1027} 1028 1029// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1030func (future *ApplicationGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1031 var azFuture azure.Future 1032 if err := json.Unmarshal(body, &azFuture); err != nil { 1033 return err 1034 } 1035 future.FutureAPI = &azFuture 1036 future.Result = future.result 1037 return nil 1038} 1039 1040// result is the default implementation for ApplicationGatewaysCreateOrUpdateFuture.Result. 1041func (future *ApplicationGatewaysCreateOrUpdateFuture) result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { 1042 var done bool 1043 done, err = future.DoneWithContext(context.Background(), client) 1044 if err != nil { 1045 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1046 return 1047 } 1048 if !done { 1049 ag.Response.Response = future.Response() 1050 err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysCreateOrUpdateFuture") 1051 return 1052 } 1053 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1054 if ag.Response.Response, err = future.GetResult(sender); err == nil && ag.Response.Response.StatusCode != http.StatusNoContent { 1055 ag, err = client.CreateOrUpdateResponder(ag.Response.Response) 1056 if err != nil { 1057 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", ag.Response.Response, "Failure responding to request") 1058 } 1059 } 1060 return 1061} 1062 1063// ApplicationGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a 1064// long-running operation. 1065type ApplicationGatewaysDeleteFuture struct { 1066 azure.FutureAPI 1067 // Result returns the result of the asynchronous operation. 1068 // If the operation has not completed it will return an error. 1069 Result func(ApplicationGatewaysClient) (autorest.Response, error) 1070} 1071 1072// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1073func (future *ApplicationGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { 1074 var azFuture azure.Future 1075 if err := json.Unmarshal(body, &azFuture); err != nil { 1076 return err 1077 } 1078 future.FutureAPI = &azFuture 1079 future.Result = future.result 1080 return nil 1081} 1082 1083// result is the default implementation for ApplicationGatewaysDeleteFuture.Result. 1084func (future *ApplicationGatewaysDeleteFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { 1085 var done bool 1086 done, err = future.DoneWithContext(context.Background(), client) 1087 if err != nil { 1088 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") 1089 return 1090 } 1091 if !done { 1092 ar.Response = future.Response() 1093 err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysDeleteFuture") 1094 return 1095 } 1096 ar.Response = future.Response() 1097 return 1098} 1099 1100// ApplicationGatewaySku SKU of application gateway 1101type ApplicationGatewaySku struct { 1102 // Name - Gets or sets name of application gateway SKU. Possible values include: 'StandardSmall', 'StandardMedium', 'StandardLarge' 1103 Name ApplicationGatewaySkuName `json:"name,omitempty"` 1104 // Tier - Gets or sets tier of application gateway. Possible values include: 'Standard' 1105 Tier ApplicationGatewayTier `json:"tier,omitempty"` 1106 // Capacity - Gets or sets capacity (instance count) of application gateway 1107 Capacity *int32 `json:"capacity,omitempty"` 1108} 1109 1110// ApplicationGatewaySslCertificate SSL certificates of application gateway 1111type ApplicationGatewaySslCertificate struct { 1112 *ApplicationGatewaySslCertificatePropertiesFormat `json:"properties,omitempty"` 1113 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 1114 Name *string `json:"name,omitempty"` 1115 // Etag - A unique read-only string that changes whenever the resource is updated 1116 Etag *string `json:"etag,omitempty"` 1117 // ID - Resource Id 1118 ID *string `json:"id,omitempty"` 1119} 1120 1121// MarshalJSON is the custom marshaler for ApplicationGatewaySslCertificate. 1122func (agsc ApplicationGatewaySslCertificate) MarshalJSON() ([]byte, error) { 1123 objectMap := make(map[string]interface{}) 1124 if agsc.ApplicationGatewaySslCertificatePropertiesFormat != nil { 1125 objectMap["properties"] = agsc.ApplicationGatewaySslCertificatePropertiesFormat 1126 } 1127 if agsc.Name != nil { 1128 objectMap["name"] = agsc.Name 1129 } 1130 if agsc.Etag != nil { 1131 objectMap["etag"] = agsc.Etag 1132 } 1133 if agsc.ID != nil { 1134 objectMap["id"] = agsc.ID 1135 } 1136 return json.Marshal(objectMap) 1137} 1138 1139// UnmarshalJSON is the custom unmarshaler for ApplicationGatewaySslCertificate struct. 1140func (agsc *ApplicationGatewaySslCertificate) UnmarshalJSON(body []byte) error { 1141 var m map[string]*json.RawMessage 1142 err := json.Unmarshal(body, &m) 1143 if err != nil { 1144 return err 1145 } 1146 for k, v := range m { 1147 switch k { 1148 case "properties": 1149 if v != nil { 1150 var applicationGatewaySslCertificatePropertiesFormat ApplicationGatewaySslCertificatePropertiesFormat 1151 err = json.Unmarshal(*v, &applicationGatewaySslCertificatePropertiesFormat) 1152 if err != nil { 1153 return err 1154 } 1155 agsc.ApplicationGatewaySslCertificatePropertiesFormat = &applicationGatewaySslCertificatePropertiesFormat 1156 } 1157 case "name": 1158 if v != nil { 1159 var name string 1160 err = json.Unmarshal(*v, &name) 1161 if err != nil { 1162 return err 1163 } 1164 agsc.Name = &name 1165 } 1166 case "etag": 1167 if v != nil { 1168 var etag string 1169 err = json.Unmarshal(*v, &etag) 1170 if err != nil { 1171 return err 1172 } 1173 agsc.Etag = &etag 1174 } 1175 case "id": 1176 if v != nil { 1177 var ID string 1178 err = json.Unmarshal(*v, &ID) 1179 if err != nil { 1180 return err 1181 } 1182 agsc.ID = &ID 1183 } 1184 } 1185 } 1186 1187 return nil 1188} 1189 1190// ApplicationGatewaySslCertificatePropertiesFormat properties of SSL certificates of application gateway 1191type ApplicationGatewaySslCertificatePropertiesFormat struct { 1192 // Data - Gets or sets the certificate data 1193 Data *string `json:"data,omitempty"` 1194 // Password - Gets or sets the certificate password 1195 Password *string `json:"password,omitempty"` 1196 // PublicCertData - Gets or sets the certificate public data 1197 PublicCertData *string `json:"publicCertData,omitempty"` 1198 // ProvisioningState - Gets or sets Provisioning state of the ssl certificate resource Updating/Deleting/Failed 1199 ProvisioningState *string `json:"provisioningState,omitempty"` 1200} 1201 1202// ApplicationGatewaysStartFuture an abstraction for monitoring and retrieving the results of a 1203// long-running operation. 1204type ApplicationGatewaysStartFuture struct { 1205 azure.FutureAPI 1206 // Result returns the result of the asynchronous operation. 1207 // If the operation has not completed it will return an error. 1208 Result func(ApplicationGatewaysClient) (autorest.Response, error) 1209} 1210 1211// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1212func (future *ApplicationGatewaysStartFuture) UnmarshalJSON(body []byte) error { 1213 var azFuture azure.Future 1214 if err := json.Unmarshal(body, &azFuture); err != nil { 1215 return err 1216 } 1217 future.FutureAPI = &azFuture 1218 future.Result = future.result 1219 return nil 1220} 1221 1222// result is the default implementation for ApplicationGatewaysStartFuture.Result. 1223func (future *ApplicationGatewaysStartFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { 1224 var done bool 1225 done, err = future.DoneWithContext(context.Background(), client) 1226 if err != nil { 1227 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStartFuture", "Result", future.Response(), "Polling failure") 1228 return 1229 } 1230 if !done { 1231 ar.Response = future.Response() 1232 err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStartFuture") 1233 return 1234 } 1235 ar.Response = future.Response() 1236 return 1237} 1238 1239// ApplicationGatewaysStopFuture an abstraction for monitoring and retrieving the results of a long-running 1240// operation. 1241type ApplicationGatewaysStopFuture struct { 1242 azure.FutureAPI 1243 // Result returns the result of the asynchronous operation. 1244 // If the operation has not completed it will return an error. 1245 Result func(ApplicationGatewaysClient) (autorest.Response, error) 1246} 1247 1248// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1249func (future *ApplicationGatewaysStopFuture) UnmarshalJSON(body []byte) error { 1250 var azFuture azure.Future 1251 if err := json.Unmarshal(body, &azFuture); err != nil { 1252 return err 1253 } 1254 future.FutureAPI = &azFuture 1255 future.Result = future.result 1256 return nil 1257} 1258 1259// result is the default implementation for ApplicationGatewaysStopFuture.Result. 1260func (future *ApplicationGatewaysStopFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { 1261 var done bool 1262 done, err = future.DoneWithContext(context.Background(), client) 1263 if err != nil { 1264 err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStopFuture", "Result", future.Response(), "Polling failure") 1265 return 1266 } 1267 if !done { 1268 ar.Response = future.Response() 1269 err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStopFuture") 1270 return 1271 } 1272 ar.Response = future.Response() 1273 return 1274} 1275 1276// AuthorizationListResult response for ListAuthorizations Api service callRetrieves all authorizations 1277// that belongs to an ExpressRouteCircuit 1278type AuthorizationListResult struct { 1279 autorest.Response `json:"-"` 1280 // Value - Gets the authorizations in an ExpressRoute Circuit 1281 Value *[]ExpressRouteCircuitAuthorization `json:"value,omitempty"` 1282 // NextLink - Gets the URL to get the next set of results. 1283 NextLink *string `json:"nextLink,omitempty"` 1284} 1285 1286// AuthorizationListResultIterator provides access to a complete listing of 1287// ExpressRouteCircuitAuthorization values. 1288type AuthorizationListResultIterator struct { 1289 i int 1290 page AuthorizationListResultPage 1291} 1292 1293// NextWithContext advances to the next value. If there was an error making 1294// the request the iterator does not advance and the error is returned. 1295func (iter *AuthorizationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1296 if tracing.IsEnabled() { 1297 ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationListResultIterator.NextWithContext") 1298 defer func() { 1299 sc := -1 1300 if iter.Response().Response.Response != nil { 1301 sc = iter.Response().Response.Response.StatusCode 1302 } 1303 tracing.EndSpan(ctx, sc, err) 1304 }() 1305 } 1306 iter.i++ 1307 if iter.i < len(iter.page.Values()) { 1308 return nil 1309 } 1310 err = iter.page.NextWithContext(ctx) 1311 if err != nil { 1312 iter.i-- 1313 return err 1314 } 1315 iter.i = 0 1316 return nil 1317} 1318 1319// Next advances to the next value. If there was an error making 1320// the request the iterator does not advance and the error is returned. 1321// Deprecated: Use NextWithContext() instead. 1322func (iter *AuthorizationListResultIterator) Next() error { 1323 return iter.NextWithContext(context.Background()) 1324} 1325 1326// NotDone returns true if the enumeration should be started or is not yet complete. 1327func (iter AuthorizationListResultIterator) NotDone() bool { 1328 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1329} 1330 1331// Response returns the raw server response from the last page request. 1332func (iter AuthorizationListResultIterator) Response() AuthorizationListResult { 1333 return iter.page.Response() 1334} 1335 1336// Value returns the current value or a zero-initialized value if the 1337// iterator has advanced beyond the end of the collection. 1338func (iter AuthorizationListResultIterator) Value() ExpressRouteCircuitAuthorization { 1339 if !iter.page.NotDone() { 1340 return ExpressRouteCircuitAuthorization{} 1341 } 1342 return iter.page.Values()[iter.i] 1343} 1344 1345// Creates a new instance of the AuthorizationListResultIterator type. 1346func NewAuthorizationListResultIterator(page AuthorizationListResultPage) AuthorizationListResultIterator { 1347 return AuthorizationListResultIterator{page: page} 1348} 1349 1350// IsEmpty returns true if the ListResult contains no values. 1351func (alr AuthorizationListResult) IsEmpty() bool { 1352 return alr.Value == nil || len(*alr.Value) == 0 1353} 1354 1355// hasNextLink returns true if the NextLink is not empty. 1356func (alr AuthorizationListResult) hasNextLink() bool { 1357 return alr.NextLink != nil && len(*alr.NextLink) != 0 1358} 1359 1360// authorizationListResultPreparer prepares a request to retrieve the next set of results. 1361// It returns nil if no more results exist. 1362func (alr AuthorizationListResult) authorizationListResultPreparer(ctx context.Context) (*http.Request, error) { 1363 if !alr.hasNextLink() { 1364 return nil, nil 1365 } 1366 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1367 autorest.AsJSON(), 1368 autorest.AsGet(), 1369 autorest.WithBaseURL(to.String(alr.NextLink))) 1370} 1371 1372// AuthorizationListResultPage contains a page of ExpressRouteCircuitAuthorization values. 1373type AuthorizationListResultPage struct { 1374 fn func(context.Context, AuthorizationListResult) (AuthorizationListResult, error) 1375 alr AuthorizationListResult 1376} 1377 1378// NextWithContext advances to the next page of values. If there was an error making 1379// the request the page does not advance and the error is returned. 1380func (page *AuthorizationListResultPage) NextWithContext(ctx context.Context) (err error) { 1381 if tracing.IsEnabled() { 1382 ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationListResultPage.NextWithContext") 1383 defer func() { 1384 sc := -1 1385 if page.Response().Response.Response != nil { 1386 sc = page.Response().Response.Response.StatusCode 1387 } 1388 tracing.EndSpan(ctx, sc, err) 1389 }() 1390 } 1391 for { 1392 next, err := page.fn(ctx, page.alr) 1393 if err != nil { 1394 return err 1395 } 1396 page.alr = next 1397 if !next.hasNextLink() || !next.IsEmpty() { 1398 break 1399 } 1400 } 1401 return nil 1402} 1403 1404// Next advances to the next page of values. If there was an error making 1405// the request the page does not advance and the error is returned. 1406// Deprecated: Use NextWithContext() instead. 1407func (page *AuthorizationListResultPage) Next() error { 1408 return page.NextWithContext(context.Background()) 1409} 1410 1411// NotDone returns true if the page enumeration should be started or is not yet complete. 1412func (page AuthorizationListResultPage) NotDone() bool { 1413 return !page.alr.IsEmpty() 1414} 1415 1416// Response returns the raw server response from the last page request. 1417func (page AuthorizationListResultPage) Response() AuthorizationListResult { 1418 return page.alr 1419} 1420 1421// Values returns the slice of values for the current page or nil if there are no values. 1422func (page AuthorizationListResultPage) Values() []ExpressRouteCircuitAuthorization { 1423 if page.alr.IsEmpty() { 1424 return nil 1425 } 1426 return *page.alr.Value 1427} 1428 1429// Creates a new instance of the AuthorizationListResultPage type. 1430func NewAuthorizationListResultPage(cur AuthorizationListResult, getNextPage func(context.Context, AuthorizationListResult) (AuthorizationListResult, error)) AuthorizationListResultPage { 1431 return AuthorizationListResultPage{ 1432 fn: getNextPage, 1433 alr: cur, 1434 } 1435} 1436 1437// AuthorizationPropertiesFormat ... 1438type AuthorizationPropertiesFormat struct { 1439 // AuthorizationKey - Gets or sets the authorization key 1440 AuthorizationKey *string `json:"authorizationKey,omitempty"` 1441 // AuthorizationUseStatus - Gets or sets AuthorizationUseStatus. Possible values include: 'Available', 'InUse' 1442 AuthorizationUseStatus AuthorizationUseStatus `json:"authorizationUseStatus,omitempty"` 1443 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 1444 ProvisioningState *string `json:"provisioningState,omitempty"` 1445} 1446 1447// AzureAsyncOperationResult the response body contains the status of the specified asynchronous operation, 1448// indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct 1449// from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous 1450// operation succeeded, the response body includes the HTTP status code for the successful request. If the 1451// asynchronous operation failed, the response body includes the HTTP status code for the failed request 1452// and error information regarding the failure. 1453type AzureAsyncOperationResult struct { 1454 // Status - Status of the AzureAsyncOperation. Possible values include: 'InProgress', 'Succeeded', 'Failed' 1455 Status OperationStatus `json:"status,omitempty"` 1456 Error *Error `json:"error,omitempty"` 1457} 1458 1459// BackendAddressPool pool of backend IP addresses 1460type BackendAddressPool struct { 1461 *BackendAddressPoolPropertiesFormat `json:"properties,omitempty"` 1462 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 1463 Name *string `json:"name,omitempty"` 1464 // Etag - A unique read-only string that changes whenever the resource is updated 1465 Etag *string `json:"etag,omitempty"` 1466 // ID - Resource Id 1467 ID *string `json:"id,omitempty"` 1468} 1469 1470// MarshalJSON is the custom marshaler for BackendAddressPool. 1471func (bap BackendAddressPool) MarshalJSON() ([]byte, error) { 1472 objectMap := make(map[string]interface{}) 1473 if bap.BackendAddressPoolPropertiesFormat != nil { 1474 objectMap["properties"] = bap.BackendAddressPoolPropertiesFormat 1475 } 1476 if bap.Name != nil { 1477 objectMap["name"] = bap.Name 1478 } 1479 if bap.Etag != nil { 1480 objectMap["etag"] = bap.Etag 1481 } 1482 if bap.ID != nil { 1483 objectMap["id"] = bap.ID 1484 } 1485 return json.Marshal(objectMap) 1486} 1487 1488// UnmarshalJSON is the custom unmarshaler for BackendAddressPool struct. 1489func (bap *BackendAddressPool) UnmarshalJSON(body []byte) error { 1490 var m map[string]*json.RawMessage 1491 err := json.Unmarshal(body, &m) 1492 if err != nil { 1493 return err 1494 } 1495 for k, v := range m { 1496 switch k { 1497 case "properties": 1498 if v != nil { 1499 var backendAddressPoolPropertiesFormat BackendAddressPoolPropertiesFormat 1500 err = json.Unmarshal(*v, &backendAddressPoolPropertiesFormat) 1501 if err != nil { 1502 return err 1503 } 1504 bap.BackendAddressPoolPropertiesFormat = &backendAddressPoolPropertiesFormat 1505 } 1506 case "name": 1507 if v != nil { 1508 var name string 1509 err = json.Unmarshal(*v, &name) 1510 if err != nil { 1511 return err 1512 } 1513 bap.Name = &name 1514 } 1515 case "etag": 1516 if v != nil { 1517 var etag string 1518 err = json.Unmarshal(*v, &etag) 1519 if err != nil { 1520 return err 1521 } 1522 bap.Etag = &etag 1523 } 1524 case "id": 1525 if v != nil { 1526 var ID string 1527 err = json.Unmarshal(*v, &ID) 1528 if err != nil { 1529 return err 1530 } 1531 bap.ID = &ID 1532 } 1533 } 1534 } 1535 1536 return nil 1537} 1538 1539// BackendAddressPoolPropertiesFormat properties of BackendAddressPool 1540type BackendAddressPoolPropertiesFormat struct { 1541 // BackendIPConfigurations - Gets collection of references to IPs defined in NICs 1542 BackendIPConfigurations *[]SubResource `json:"backendIPConfigurations,omitempty"` 1543 // LoadBalancingRules - Gets Load Balancing rules that use this Backend Address Pool 1544 LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` 1545 // OutboundNatRule - Gets outbound rules that use this Backend Address Pool 1546 OutboundNatRule *SubResource `json:"outboundNatRule,omitempty"` 1547 // ProvisioningState - Provisioning state of the PublicIP resource Updating/Deleting/Failed 1548 ProvisioningState *string `json:"provisioningState,omitempty"` 1549} 1550 1551// ConnectionResetSharedKey ... 1552type ConnectionResetSharedKey struct { 1553 autorest.Response `json:"-"` 1554 // KeyLength - The virtual network connection reset shared key length 1555 KeyLength *int64 `json:"keyLength,omitempty"` 1556} 1557 1558// ConnectionSharedKey response for GetConnectionSharedKey Api service call 1559type ConnectionSharedKey struct { 1560 autorest.Response `json:"-"` 1561 // Value - The virtual network connection shared key value 1562 Value *string `json:"value,omitempty"` 1563} 1564 1565// DhcpOptions dHCPOptions contains an array of DNS servers available to VMs deployed in the virtual 1566// networkStandard DHCP option for a subnet overrides VNET DHCP options. 1567type DhcpOptions struct { 1568 // DNSServers - Gets or sets list of DNS servers IP addresses 1569 DNSServers *[]string `json:"dnsServers,omitempty"` 1570} 1571 1572// DNSNameAvailabilityResult response for CheckDnsNameAvailability Api service call 1573type DNSNameAvailabilityResult struct { 1574 autorest.Response `json:"-"` 1575 // Available - Domain availability (True/False) 1576 Available *bool `json:"available,omitempty"` 1577} 1578 1579// Error ... 1580type Error struct { 1581 Code *string `json:"code,omitempty"` 1582 Message *string `json:"message,omitempty"` 1583 Target *string `json:"target,omitempty"` 1584 Details *[]ErrorDetails `json:"details,omitempty"` 1585 InnerError *string `json:"innerError,omitempty"` 1586} 1587 1588// ErrorDetails ... 1589type ErrorDetails struct { 1590 Code *string `json:"code,omitempty"` 1591 Target *string `json:"target,omitempty"` 1592 Message *string `json:"message,omitempty"` 1593} 1594 1595// ExpressRouteCircuit expressRouteCircuit resource 1596type ExpressRouteCircuit struct { 1597 autorest.Response `json:"-"` 1598 // Sku - Gets or sets sku 1599 Sku *ExpressRouteCircuitSku `json:"sku,omitempty"` 1600 *ExpressRouteCircuitPropertiesFormat `json:"properties,omitempty"` 1601 // Etag - Gets a unique read-only string that changes whenever the resource is updated 1602 Etag *string `json:"etag,omitempty"` 1603 // ID - READ-ONLY; Resource Id 1604 ID *string `json:"id,omitempty"` 1605 // Name - READ-ONLY; Resource name 1606 Name *string `json:"name,omitempty"` 1607 // Type - READ-ONLY; Resource type 1608 Type *string `json:"type,omitempty"` 1609 // Location - Resource location 1610 Location *string `json:"location,omitempty"` 1611 // Tags - Resource tags 1612 Tags map[string]*string `json:"tags"` 1613} 1614 1615// MarshalJSON is the custom marshaler for ExpressRouteCircuit. 1616func (erc ExpressRouteCircuit) MarshalJSON() ([]byte, error) { 1617 objectMap := make(map[string]interface{}) 1618 if erc.Sku != nil { 1619 objectMap["sku"] = erc.Sku 1620 } 1621 if erc.ExpressRouteCircuitPropertiesFormat != nil { 1622 objectMap["properties"] = erc.ExpressRouteCircuitPropertiesFormat 1623 } 1624 if erc.Etag != nil { 1625 objectMap["etag"] = erc.Etag 1626 } 1627 if erc.Location != nil { 1628 objectMap["location"] = erc.Location 1629 } 1630 if erc.Tags != nil { 1631 objectMap["tags"] = erc.Tags 1632 } 1633 return json.Marshal(objectMap) 1634} 1635 1636// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuit struct. 1637func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { 1638 var m map[string]*json.RawMessage 1639 err := json.Unmarshal(body, &m) 1640 if err != nil { 1641 return err 1642 } 1643 for k, v := range m { 1644 switch k { 1645 case "sku": 1646 if v != nil { 1647 var sku ExpressRouteCircuitSku 1648 err = json.Unmarshal(*v, &sku) 1649 if err != nil { 1650 return err 1651 } 1652 erc.Sku = &sku 1653 } 1654 case "properties": 1655 if v != nil { 1656 var expressRouteCircuitPropertiesFormat ExpressRouteCircuitPropertiesFormat 1657 err = json.Unmarshal(*v, &expressRouteCircuitPropertiesFormat) 1658 if err != nil { 1659 return err 1660 } 1661 erc.ExpressRouteCircuitPropertiesFormat = &expressRouteCircuitPropertiesFormat 1662 } 1663 case "etag": 1664 if v != nil { 1665 var etag string 1666 err = json.Unmarshal(*v, &etag) 1667 if err != nil { 1668 return err 1669 } 1670 erc.Etag = &etag 1671 } 1672 case "id": 1673 if v != nil { 1674 var ID string 1675 err = json.Unmarshal(*v, &ID) 1676 if err != nil { 1677 return err 1678 } 1679 erc.ID = &ID 1680 } 1681 case "name": 1682 if v != nil { 1683 var name string 1684 err = json.Unmarshal(*v, &name) 1685 if err != nil { 1686 return err 1687 } 1688 erc.Name = &name 1689 } 1690 case "type": 1691 if v != nil { 1692 var typeVar string 1693 err = json.Unmarshal(*v, &typeVar) 1694 if err != nil { 1695 return err 1696 } 1697 erc.Type = &typeVar 1698 } 1699 case "location": 1700 if v != nil { 1701 var location string 1702 err = json.Unmarshal(*v, &location) 1703 if err != nil { 1704 return err 1705 } 1706 erc.Location = &location 1707 } 1708 case "tags": 1709 if v != nil { 1710 var tags map[string]*string 1711 err = json.Unmarshal(*v, &tags) 1712 if err != nil { 1713 return err 1714 } 1715 erc.Tags = tags 1716 } 1717 } 1718 } 1719 1720 return nil 1721} 1722 1723// ExpressRouteCircuitArpTable the arp table associated with the ExpressRouteCircuit 1724type ExpressRouteCircuitArpTable struct { 1725 // IPAddress - Gets ipAddress. 1726 IPAddress *string `json:"ipAddress,omitempty"` 1727 // MacAddress - Gets macAddress. 1728 MacAddress *string `json:"macAddress,omitempty"` 1729} 1730 1731// ExpressRouteCircuitAuthorization authorization in a ExpressRouteCircuit resource 1732type ExpressRouteCircuitAuthorization struct { 1733 autorest.Response `json:"-"` 1734 *AuthorizationPropertiesFormat `json:"properties,omitempty"` 1735 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 1736 Name *string `json:"name,omitempty"` 1737 // Etag - A unique read-only string that changes whenever the resource is updated 1738 Etag *string `json:"etag,omitempty"` 1739 // ID - Resource Id 1740 ID *string `json:"id,omitempty"` 1741} 1742 1743// MarshalJSON is the custom marshaler for ExpressRouteCircuitAuthorization. 1744func (erca ExpressRouteCircuitAuthorization) MarshalJSON() ([]byte, error) { 1745 objectMap := make(map[string]interface{}) 1746 if erca.AuthorizationPropertiesFormat != nil { 1747 objectMap["properties"] = erca.AuthorizationPropertiesFormat 1748 } 1749 if erca.Name != nil { 1750 objectMap["name"] = erca.Name 1751 } 1752 if erca.Etag != nil { 1753 objectMap["etag"] = erca.Etag 1754 } 1755 if erca.ID != nil { 1756 objectMap["id"] = erca.ID 1757 } 1758 return json.Marshal(objectMap) 1759} 1760 1761// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitAuthorization struct. 1762func (erca *ExpressRouteCircuitAuthorization) UnmarshalJSON(body []byte) error { 1763 var m map[string]*json.RawMessage 1764 err := json.Unmarshal(body, &m) 1765 if err != nil { 1766 return err 1767 } 1768 for k, v := range m { 1769 switch k { 1770 case "properties": 1771 if v != nil { 1772 var authorizationPropertiesFormat AuthorizationPropertiesFormat 1773 err = json.Unmarshal(*v, &authorizationPropertiesFormat) 1774 if err != nil { 1775 return err 1776 } 1777 erca.AuthorizationPropertiesFormat = &authorizationPropertiesFormat 1778 } 1779 case "name": 1780 if v != nil { 1781 var name string 1782 err = json.Unmarshal(*v, &name) 1783 if err != nil { 1784 return err 1785 } 1786 erca.Name = &name 1787 } 1788 case "etag": 1789 if v != nil { 1790 var etag string 1791 err = json.Unmarshal(*v, &etag) 1792 if err != nil { 1793 return err 1794 } 1795 erca.Etag = &etag 1796 } 1797 case "id": 1798 if v != nil { 1799 var ID string 1800 err = json.Unmarshal(*v, &ID) 1801 if err != nil { 1802 return err 1803 } 1804 erca.ID = &ID 1805 } 1806 } 1807 } 1808 1809 return nil 1810} 1811 1812// ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the 1813// results of a long-running operation. 1814type ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture struct { 1815 azure.FutureAPI 1816 // Result returns the result of the asynchronous operation. 1817 // If the operation has not completed it will return an error. 1818 Result func(ExpressRouteCircuitAuthorizationsClient) (ExpressRouteCircuitAuthorization, error) 1819} 1820 1821// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1822func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1823 var azFuture azure.Future 1824 if err := json.Unmarshal(body, &azFuture); err != nil { 1825 return err 1826 } 1827 future.FutureAPI = &azFuture 1828 future.Result = future.result 1829 return nil 1830} 1831 1832// result is the default implementation for ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture.Result. 1833func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) result(client ExpressRouteCircuitAuthorizationsClient) (erca ExpressRouteCircuitAuthorization, err error) { 1834 var done bool 1835 done, err = future.DoneWithContext(context.Background(), client) 1836 if err != nil { 1837 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1838 return 1839 } 1840 if !done { 1841 erca.Response.Response = future.Response() 1842 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture") 1843 return 1844 } 1845 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1846 if erca.Response.Response, err = future.GetResult(sender); err == nil && erca.Response.Response.StatusCode != http.StatusNoContent { 1847 erca, err = client.CreateOrUpdateResponder(erca.Response.Response) 1848 if err != nil { 1849 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", erca.Response.Response, "Failure responding to request") 1850 } 1851 } 1852 return 1853} 1854 1855// ExpressRouteCircuitAuthorizationsDeleteFuture an abstraction for monitoring and retrieving the results 1856// of a long-running operation. 1857type ExpressRouteCircuitAuthorizationsDeleteFuture struct { 1858 azure.FutureAPI 1859 // Result returns the result of the asynchronous operation. 1860 // If the operation has not completed it will return an error. 1861 Result func(ExpressRouteCircuitAuthorizationsClient) (autorest.Response, error) 1862} 1863 1864// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1865func (future *ExpressRouteCircuitAuthorizationsDeleteFuture) UnmarshalJSON(body []byte) error { 1866 var azFuture azure.Future 1867 if err := json.Unmarshal(body, &azFuture); err != nil { 1868 return err 1869 } 1870 future.FutureAPI = &azFuture 1871 future.Result = future.result 1872 return nil 1873} 1874 1875// result is the default implementation for ExpressRouteCircuitAuthorizationsDeleteFuture.Result. 1876func (future *ExpressRouteCircuitAuthorizationsDeleteFuture) result(client ExpressRouteCircuitAuthorizationsClient) (ar autorest.Response, err error) { 1877 var done bool 1878 done, err = future.DoneWithContext(context.Background(), client) 1879 if err != nil { 1880 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", future.Response(), "Polling failure") 1881 return 1882 } 1883 if !done { 1884 ar.Response = future.Response() 1885 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsDeleteFuture") 1886 return 1887 } 1888 ar.Response = future.Response() 1889 return 1890} 1891 1892// ExpressRouteCircuitListResult response for ListExpressRouteCircuit Api service call 1893type ExpressRouteCircuitListResult struct { 1894 autorest.Response `json:"-"` 1895 // Value - Gets a list of ExpressRouteCircuits in a resource group 1896 Value *[]ExpressRouteCircuit `json:"value,omitempty"` 1897 // NextLink - Gets the URL to get the next set of results. 1898 NextLink *string `json:"nextLink,omitempty"` 1899} 1900 1901// ExpressRouteCircuitListResultIterator provides access to a complete listing of ExpressRouteCircuit 1902// values. 1903type ExpressRouteCircuitListResultIterator struct { 1904 i int 1905 page ExpressRouteCircuitListResultPage 1906} 1907 1908// NextWithContext advances to the next value. If there was an error making 1909// the request the iterator does not advance and the error is returned. 1910func (iter *ExpressRouteCircuitListResultIterator) NextWithContext(ctx context.Context) (err error) { 1911 if tracing.IsEnabled() { 1912 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitListResultIterator.NextWithContext") 1913 defer func() { 1914 sc := -1 1915 if iter.Response().Response.Response != nil { 1916 sc = iter.Response().Response.Response.StatusCode 1917 } 1918 tracing.EndSpan(ctx, sc, err) 1919 }() 1920 } 1921 iter.i++ 1922 if iter.i < len(iter.page.Values()) { 1923 return nil 1924 } 1925 err = iter.page.NextWithContext(ctx) 1926 if err != nil { 1927 iter.i-- 1928 return err 1929 } 1930 iter.i = 0 1931 return nil 1932} 1933 1934// Next advances to the next value. If there was an error making 1935// the request the iterator does not advance and the error is returned. 1936// Deprecated: Use NextWithContext() instead. 1937func (iter *ExpressRouteCircuitListResultIterator) Next() error { 1938 return iter.NextWithContext(context.Background()) 1939} 1940 1941// NotDone returns true if the enumeration should be started or is not yet complete. 1942func (iter ExpressRouteCircuitListResultIterator) NotDone() bool { 1943 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1944} 1945 1946// Response returns the raw server response from the last page request. 1947func (iter ExpressRouteCircuitListResultIterator) Response() ExpressRouteCircuitListResult { 1948 return iter.page.Response() 1949} 1950 1951// Value returns the current value or a zero-initialized value if the 1952// iterator has advanced beyond the end of the collection. 1953func (iter ExpressRouteCircuitListResultIterator) Value() ExpressRouteCircuit { 1954 if !iter.page.NotDone() { 1955 return ExpressRouteCircuit{} 1956 } 1957 return iter.page.Values()[iter.i] 1958} 1959 1960// Creates a new instance of the ExpressRouteCircuitListResultIterator type. 1961func NewExpressRouteCircuitListResultIterator(page ExpressRouteCircuitListResultPage) ExpressRouteCircuitListResultIterator { 1962 return ExpressRouteCircuitListResultIterator{page: page} 1963} 1964 1965// IsEmpty returns true if the ListResult contains no values. 1966func (erclr ExpressRouteCircuitListResult) IsEmpty() bool { 1967 return erclr.Value == nil || len(*erclr.Value) == 0 1968} 1969 1970// hasNextLink returns true if the NextLink is not empty. 1971func (erclr ExpressRouteCircuitListResult) hasNextLink() bool { 1972 return erclr.NextLink != nil && len(*erclr.NextLink) != 0 1973} 1974 1975// expressRouteCircuitListResultPreparer prepares a request to retrieve the next set of results. 1976// It returns nil if no more results exist. 1977func (erclr ExpressRouteCircuitListResult) expressRouteCircuitListResultPreparer(ctx context.Context) (*http.Request, error) { 1978 if !erclr.hasNextLink() { 1979 return nil, nil 1980 } 1981 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1982 autorest.AsJSON(), 1983 autorest.AsGet(), 1984 autorest.WithBaseURL(to.String(erclr.NextLink))) 1985} 1986 1987// ExpressRouteCircuitListResultPage contains a page of ExpressRouteCircuit values. 1988type ExpressRouteCircuitListResultPage struct { 1989 fn func(context.Context, ExpressRouteCircuitListResult) (ExpressRouteCircuitListResult, error) 1990 erclr ExpressRouteCircuitListResult 1991} 1992 1993// NextWithContext advances to the next page of values. If there was an error making 1994// the request the page does not advance and the error is returned. 1995func (page *ExpressRouteCircuitListResultPage) NextWithContext(ctx context.Context) (err error) { 1996 if tracing.IsEnabled() { 1997 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitListResultPage.NextWithContext") 1998 defer func() { 1999 sc := -1 2000 if page.Response().Response.Response != nil { 2001 sc = page.Response().Response.Response.StatusCode 2002 } 2003 tracing.EndSpan(ctx, sc, err) 2004 }() 2005 } 2006 for { 2007 next, err := page.fn(ctx, page.erclr) 2008 if err != nil { 2009 return err 2010 } 2011 page.erclr = next 2012 if !next.hasNextLink() || !next.IsEmpty() { 2013 break 2014 } 2015 } 2016 return nil 2017} 2018 2019// Next advances to the next page of values. If there was an error making 2020// the request the page does not advance and the error is returned. 2021// Deprecated: Use NextWithContext() instead. 2022func (page *ExpressRouteCircuitListResultPage) Next() error { 2023 return page.NextWithContext(context.Background()) 2024} 2025 2026// NotDone returns true if the page enumeration should be started or is not yet complete. 2027func (page ExpressRouteCircuitListResultPage) NotDone() bool { 2028 return !page.erclr.IsEmpty() 2029} 2030 2031// Response returns the raw server response from the last page request. 2032func (page ExpressRouteCircuitListResultPage) Response() ExpressRouteCircuitListResult { 2033 return page.erclr 2034} 2035 2036// Values returns the slice of values for the current page or nil if there are no values. 2037func (page ExpressRouteCircuitListResultPage) Values() []ExpressRouteCircuit { 2038 if page.erclr.IsEmpty() { 2039 return nil 2040 } 2041 return *page.erclr.Value 2042} 2043 2044// Creates a new instance of the ExpressRouteCircuitListResultPage type. 2045func NewExpressRouteCircuitListResultPage(cur ExpressRouteCircuitListResult, getNextPage func(context.Context, ExpressRouteCircuitListResult) (ExpressRouteCircuitListResult, error)) ExpressRouteCircuitListResultPage { 2046 return ExpressRouteCircuitListResultPage{ 2047 fn: getNextPage, 2048 erclr: cur, 2049 } 2050} 2051 2052// ExpressRouteCircuitPeering peering in a ExpressRouteCircuit resource 2053type ExpressRouteCircuitPeering struct { 2054 autorest.Response `json:"-"` 2055 *ExpressRouteCircuitPeeringPropertiesFormat `json:"properties,omitempty"` 2056 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 2057 Name *string `json:"name,omitempty"` 2058 // Etag - A unique read-only string that changes whenever the resource is updated 2059 Etag *string `json:"etag,omitempty"` 2060 // ID - Resource Id 2061 ID *string `json:"id,omitempty"` 2062} 2063 2064// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeering. 2065func (ercp ExpressRouteCircuitPeering) MarshalJSON() ([]byte, error) { 2066 objectMap := make(map[string]interface{}) 2067 if ercp.ExpressRouteCircuitPeeringPropertiesFormat != nil { 2068 objectMap["properties"] = ercp.ExpressRouteCircuitPeeringPropertiesFormat 2069 } 2070 if ercp.Name != nil { 2071 objectMap["name"] = ercp.Name 2072 } 2073 if ercp.Etag != nil { 2074 objectMap["etag"] = ercp.Etag 2075 } 2076 if ercp.ID != nil { 2077 objectMap["id"] = ercp.ID 2078 } 2079 return json.Marshal(objectMap) 2080} 2081 2082// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitPeering struct. 2083func (ercp *ExpressRouteCircuitPeering) UnmarshalJSON(body []byte) error { 2084 var m map[string]*json.RawMessage 2085 err := json.Unmarshal(body, &m) 2086 if err != nil { 2087 return err 2088 } 2089 for k, v := range m { 2090 switch k { 2091 case "properties": 2092 if v != nil { 2093 var expressRouteCircuitPeeringPropertiesFormat ExpressRouteCircuitPeeringPropertiesFormat 2094 err = json.Unmarshal(*v, &expressRouteCircuitPeeringPropertiesFormat) 2095 if err != nil { 2096 return err 2097 } 2098 ercp.ExpressRouteCircuitPeeringPropertiesFormat = &expressRouteCircuitPeeringPropertiesFormat 2099 } 2100 case "name": 2101 if v != nil { 2102 var name string 2103 err = json.Unmarshal(*v, &name) 2104 if err != nil { 2105 return err 2106 } 2107 ercp.Name = &name 2108 } 2109 case "etag": 2110 if v != nil { 2111 var etag string 2112 err = json.Unmarshal(*v, &etag) 2113 if err != nil { 2114 return err 2115 } 2116 ercp.Etag = &etag 2117 } 2118 case "id": 2119 if v != nil { 2120 var ID string 2121 err = json.Unmarshal(*v, &ID) 2122 if err != nil { 2123 return err 2124 } 2125 ercp.ID = &ID 2126 } 2127 } 2128 } 2129 2130 return nil 2131} 2132 2133// ExpressRouteCircuitPeeringConfig specifies the peering config 2134type ExpressRouteCircuitPeeringConfig struct { 2135 // AdvertisedPublicPrefixes - Gets or sets the reference of AdvertisedPublicPrefixes 2136 AdvertisedPublicPrefixes *[]string `json:"advertisedPublicPrefixes,omitempty"` 2137 // AdvertisedPublicPrefixesState - Gets or sets AdvertisedPublicPrefixState of the Peering resource. Possible values include: 'NotConfigured', 'Configuring', 'Configured', 'ValidationNeeded' 2138 AdvertisedPublicPrefixesState ExpressRouteCircuitPeeringAdvertisedPublicPrefixState `json:"advertisedPublicPrefixesState,omitempty"` 2139 // CustomerASN - Gets or Sets CustomerAsn of the peering. 2140 CustomerASN *int32 `json:"customerASN,omitempty"` 2141 // RoutingRegistryName - Gets or Sets RoutingRegistryName of the config. 2142 RoutingRegistryName *string `json:"routingRegistryName,omitempty"` 2143} 2144 2145// ExpressRouteCircuitPeeringListResult response for ListPeering Api service callRetrieves all Peerings 2146// that belongs to an ExpressRouteCircuit 2147type ExpressRouteCircuitPeeringListResult struct { 2148 autorest.Response `json:"-"` 2149 // Value - Gets the peerings in an express route circuit 2150 Value *[]ExpressRouteCircuitPeering `json:"value,omitempty"` 2151 // NextLink - Gets the URL to get the next set of results. 2152 NextLink *string `json:"nextLink,omitempty"` 2153} 2154 2155// ExpressRouteCircuitPeeringListResultIterator provides access to a complete listing of 2156// ExpressRouteCircuitPeering values. 2157type ExpressRouteCircuitPeeringListResultIterator struct { 2158 i int 2159 page ExpressRouteCircuitPeeringListResultPage 2160} 2161 2162// NextWithContext advances to the next value. If there was an error making 2163// the request the iterator does not advance and the error is returned. 2164func (iter *ExpressRouteCircuitPeeringListResultIterator) NextWithContext(ctx context.Context) (err error) { 2165 if tracing.IsEnabled() { 2166 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringListResultIterator.NextWithContext") 2167 defer func() { 2168 sc := -1 2169 if iter.Response().Response.Response != nil { 2170 sc = iter.Response().Response.Response.StatusCode 2171 } 2172 tracing.EndSpan(ctx, sc, err) 2173 }() 2174 } 2175 iter.i++ 2176 if iter.i < len(iter.page.Values()) { 2177 return nil 2178 } 2179 err = iter.page.NextWithContext(ctx) 2180 if err != nil { 2181 iter.i-- 2182 return err 2183 } 2184 iter.i = 0 2185 return nil 2186} 2187 2188// Next advances to the next value. If there was an error making 2189// the request the iterator does not advance and the error is returned. 2190// Deprecated: Use NextWithContext() instead. 2191func (iter *ExpressRouteCircuitPeeringListResultIterator) Next() error { 2192 return iter.NextWithContext(context.Background()) 2193} 2194 2195// NotDone returns true if the enumeration should be started or is not yet complete. 2196func (iter ExpressRouteCircuitPeeringListResultIterator) NotDone() bool { 2197 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2198} 2199 2200// Response returns the raw server response from the last page request. 2201func (iter ExpressRouteCircuitPeeringListResultIterator) Response() ExpressRouteCircuitPeeringListResult { 2202 return iter.page.Response() 2203} 2204 2205// Value returns the current value or a zero-initialized value if the 2206// iterator has advanced beyond the end of the collection. 2207func (iter ExpressRouteCircuitPeeringListResultIterator) Value() ExpressRouteCircuitPeering { 2208 if !iter.page.NotDone() { 2209 return ExpressRouteCircuitPeering{} 2210 } 2211 return iter.page.Values()[iter.i] 2212} 2213 2214// Creates a new instance of the ExpressRouteCircuitPeeringListResultIterator type. 2215func NewExpressRouteCircuitPeeringListResultIterator(page ExpressRouteCircuitPeeringListResultPage) ExpressRouteCircuitPeeringListResultIterator { 2216 return ExpressRouteCircuitPeeringListResultIterator{page: page} 2217} 2218 2219// IsEmpty returns true if the ListResult contains no values. 2220func (ercplr ExpressRouteCircuitPeeringListResult) IsEmpty() bool { 2221 return ercplr.Value == nil || len(*ercplr.Value) == 0 2222} 2223 2224// hasNextLink returns true if the NextLink is not empty. 2225func (ercplr ExpressRouteCircuitPeeringListResult) hasNextLink() bool { 2226 return ercplr.NextLink != nil && len(*ercplr.NextLink) != 0 2227} 2228 2229// expressRouteCircuitPeeringListResultPreparer prepares a request to retrieve the next set of results. 2230// It returns nil if no more results exist. 2231func (ercplr ExpressRouteCircuitPeeringListResult) expressRouteCircuitPeeringListResultPreparer(ctx context.Context) (*http.Request, error) { 2232 if !ercplr.hasNextLink() { 2233 return nil, nil 2234 } 2235 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2236 autorest.AsJSON(), 2237 autorest.AsGet(), 2238 autorest.WithBaseURL(to.String(ercplr.NextLink))) 2239} 2240 2241// ExpressRouteCircuitPeeringListResultPage contains a page of ExpressRouteCircuitPeering values. 2242type ExpressRouteCircuitPeeringListResultPage struct { 2243 fn func(context.Context, ExpressRouteCircuitPeeringListResult) (ExpressRouteCircuitPeeringListResult, error) 2244 ercplr ExpressRouteCircuitPeeringListResult 2245} 2246 2247// NextWithContext advances to the next page of values. If there was an error making 2248// the request the page does not advance and the error is returned. 2249func (page *ExpressRouteCircuitPeeringListResultPage) NextWithContext(ctx context.Context) (err error) { 2250 if tracing.IsEnabled() { 2251 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringListResultPage.NextWithContext") 2252 defer func() { 2253 sc := -1 2254 if page.Response().Response.Response != nil { 2255 sc = page.Response().Response.Response.StatusCode 2256 } 2257 tracing.EndSpan(ctx, sc, err) 2258 }() 2259 } 2260 for { 2261 next, err := page.fn(ctx, page.ercplr) 2262 if err != nil { 2263 return err 2264 } 2265 page.ercplr = next 2266 if !next.hasNextLink() || !next.IsEmpty() { 2267 break 2268 } 2269 } 2270 return nil 2271} 2272 2273// Next advances to the next page of values. If there was an error making 2274// the request the page does not advance and the error is returned. 2275// Deprecated: Use NextWithContext() instead. 2276func (page *ExpressRouteCircuitPeeringListResultPage) Next() error { 2277 return page.NextWithContext(context.Background()) 2278} 2279 2280// NotDone returns true if the page enumeration should be started or is not yet complete. 2281func (page ExpressRouteCircuitPeeringListResultPage) NotDone() bool { 2282 return !page.ercplr.IsEmpty() 2283} 2284 2285// Response returns the raw server response from the last page request. 2286func (page ExpressRouteCircuitPeeringListResultPage) Response() ExpressRouteCircuitPeeringListResult { 2287 return page.ercplr 2288} 2289 2290// Values returns the slice of values for the current page or nil if there are no values. 2291func (page ExpressRouteCircuitPeeringListResultPage) Values() []ExpressRouteCircuitPeering { 2292 if page.ercplr.IsEmpty() { 2293 return nil 2294 } 2295 return *page.ercplr.Value 2296} 2297 2298// Creates a new instance of the ExpressRouteCircuitPeeringListResultPage type. 2299func NewExpressRouteCircuitPeeringListResultPage(cur ExpressRouteCircuitPeeringListResult, getNextPage func(context.Context, ExpressRouteCircuitPeeringListResult) (ExpressRouteCircuitPeeringListResult, error)) ExpressRouteCircuitPeeringListResultPage { 2300 return ExpressRouteCircuitPeeringListResultPage{ 2301 fn: getNextPage, 2302 ercplr: cur, 2303 } 2304} 2305 2306// ExpressRouteCircuitPeeringPropertiesFormat ... 2307type ExpressRouteCircuitPeeringPropertiesFormat struct { 2308 // PeeringType - Gets or sets PeeringType. Possible values include: 'AzurePublicPeering', 'AzurePrivatePeering', 'MicrosoftPeering' 2309 PeeringType ExpressRouteCircuitPeeringType `json:"peeringType,omitempty"` 2310 // State - Gets or sets state of Peering. Possible values include: 'ExpressRouteCircuitPeeringStateDisabled', 'ExpressRouteCircuitPeeringStateEnabled' 2311 State ExpressRouteCircuitPeeringState `json:"state,omitempty"` 2312 // AzureASN - Gets or sets the azure ASN 2313 AzureASN *int32 `json:"azureASN,omitempty"` 2314 // PeerASN - Gets or sets the peer ASN 2315 PeerASN *int32 `json:"peerASN,omitempty"` 2316 // PrimaryPeerAddressPrefix - Gets or sets the primary address prefix 2317 PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` 2318 // SecondaryPeerAddressPrefix - Gets or sets the secondary address prefix 2319 SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` 2320 // PrimaryAzurePort - Gets or sets the primary port 2321 PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` 2322 // SecondaryAzurePort - Gets or sets the secondary port 2323 SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` 2324 // SharedKey - Gets or sets the shared key 2325 SharedKey *string `json:"sharedKey,omitempty"` 2326 // VlanID - Gets or sets the vlan id 2327 VlanID *int32 `json:"vlanId,omitempty"` 2328 // MicrosoftPeeringConfig - Gets or sets the Microsoft peering config 2329 MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` 2330 // Stats - Gets or peering stats 2331 Stats *ExpressRouteCircuitStats `json:"stats,omitempty"` 2332 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 2333 ProvisioningState *string `json:"provisioningState,omitempty"` 2334} 2335 2336// ExpressRouteCircuitPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 2337// of a long-running operation. 2338type ExpressRouteCircuitPeeringsCreateOrUpdateFuture struct { 2339 azure.FutureAPI 2340 // Result returns the result of the asynchronous operation. 2341 // If the operation has not completed it will return an error. 2342 Result func(ExpressRouteCircuitPeeringsClient) (ExpressRouteCircuitPeering, error) 2343} 2344 2345// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2346func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 2347 var azFuture azure.Future 2348 if err := json.Unmarshal(body, &azFuture); err != nil { 2349 return err 2350 } 2351 future.FutureAPI = &azFuture 2352 future.Result = future.result 2353 return nil 2354} 2355 2356// result is the default implementation for ExpressRouteCircuitPeeringsCreateOrUpdateFuture.Result. 2357func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) result(client ExpressRouteCircuitPeeringsClient) (ercp ExpressRouteCircuitPeering, err error) { 2358 var done bool 2359 done, err = future.DoneWithContext(context.Background(), client) 2360 if err != nil { 2361 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 2362 return 2363 } 2364 if !done { 2365 ercp.Response.Response = future.Response() 2366 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture") 2367 return 2368 } 2369 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2370 if ercp.Response.Response, err = future.GetResult(sender); err == nil && ercp.Response.Response.StatusCode != http.StatusNoContent { 2371 ercp, err = client.CreateOrUpdateResponder(ercp.Response.Response) 2372 if err != nil { 2373 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", ercp.Response.Response, "Failure responding to request") 2374 } 2375 } 2376 return 2377} 2378 2379// ExpressRouteCircuitPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a 2380// long-running operation. 2381type ExpressRouteCircuitPeeringsDeleteFuture struct { 2382 azure.FutureAPI 2383 // Result returns the result of the asynchronous operation. 2384 // If the operation has not completed it will return an error. 2385 Result func(ExpressRouteCircuitPeeringsClient) (autorest.Response, error) 2386} 2387 2388// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2389func (future *ExpressRouteCircuitPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { 2390 var azFuture azure.Future 2391 if err := json.Unmarshal(body, &azFuture); err != nil { 2392 return err 2393 } 2394 future.FutureAPI = &azFuture 2395 future.Result = future.result 2396 return nil 2397} 2398 2399// result is the default implementation for ExpressRouteCircuitPeeringsDeleteFuture.Result. 2400func (future *ExpressRouteCircuitPeeringsDeleteFuture) result(client ExpressRouteCircuitPeeringsClient) (ar autorest.Response, err error) { 2401 var done bool 2402 done, err = future.DoneWithContext(context.Background(), client) 2403 if err != nil { 2404 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") 2405 return 2406 } 2407 if !done { 2408 ar.Response = future.Response() 2409 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsDeleteFuture") 2410 return 2411 } 2412 ar.Response = future.Response() 2413 return 2414} 2415 2416// ExpressRouteCircuitPropertiesFormat properties of ExpressRouteCircuit 2417type ExpressRouteCircuitPropertiesFormat struct { 2418 // CircuitProvisioningState - Gets or sets CircuitProvisioningState state of the resource 2419 CircuitProvisioningState *string `json:"circuitProvisioningState,omitempty"` 2420 // ServiceProviderProvisioningState - Gets or sets ServiceProviderProvisioningState state of the resource. Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', 'Deprovisioning' 2421 ServiceProviderProvisioningState ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` 2422 // Authorizations - Gets or sets list of authorizations 2423 Authorizations *[]ExpressRouteCircuitAuthorization `json:"authorizations,omitempty"` 2424 // Peerings - Gets or sets list of peerings 2425 Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` 2426 // ServiceKey - Gets or sets ServiceKey 2427 ServiceKey *string `json:"serviceKey,omitempty"` 2428 // ServiceProviderNotes - Gets or sets ServiceProviderNotes 2429 ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` 2430 // ServiceProviderProperties - Gets or sets ServiceProviderProperties 2431 ServiceProviderProperties *ExpressRouteCircuitServiceProviderProperties `json:"serviceProviderProperties,omitempty"` 2432 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 2433 ProvisioningState *string `json:"provisioningState,omitempty"` 2434} 2435 2436// ExpressRouteCircuitRoutesTable the routes table associated with the ExpressRouteCircuit 2437type ExpressRouteCircuitRoutesTable struct { 2438 // AddressPrefix - Gets AddressPrefix. 2439 AddressPrefix *string `json:"addressPrefix,omitempty"` 2440 // NextHopType - Gets NextHopType. Possible values include: 'RouteNextHopTypeVirtualNetworkGateway', 'RouteNextHopTypeVnetLocal', 'RouteNextHopTypeInternet', 'RouteNextHopTypeVirtualAppliance', 'RouteNextHopTypeNone' 2441 NextHopType RouteNextHopType `json:"nextHopType,omitempty"` 2442 // NextHopIP - Gets NextHopIP. 2443 NextHopIP *string `json:"nextHopIP,omitempty"` 2444 // AsPath - Gets AsPath. 2445 AsPath *string `json:"asPath,omitempty"` 2446} 2447 2448// ExpressRouteCircuitsArpTableListResult response for ListArpTable associated with the Express Route 2449// Circuits Api 2450type ExpressRouteCircuitsArpTableListResult struct { 2451 autorest.Response `json:"-"` 2452 // Value - Gets List of ArpTable 2453 Value *[]ExpressRouteCircuitArpTable `json:"value,omitempty"` 2454 // NextLink - Gets the URL to get the next set of results. 2455 NextLink *string `json:"nextLink,omitempty"` 2456} 2457 2458// ExpressRouteCircuitsArpTableListResultIterator provides access to a complete listing of 2459// ExpressRouteCircuitArpTable values. 2460type ExpressRouteCircuitsArpTableListResultIterator struct { 2461 i int 2462 page ExpressRouteCircuitsArpTableListResultPage 2463} 2464 2465// NextWithContext advances to the next value. If there was an error making 2466// the request the iterator does not advance and the error is returned. 2467func (iter *ExpressRouteCircuitsArpTableListResultIterator) NextWithContext(ctx context.Context) (err error) { 2468 if tracing.IsEnabled() { 2469 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsArpTableListResultIterator.NextWithContext") 2470 defer func() { 2471 sc := -1 2472 if iter.Response().Response.Response != nil { 2473 sc = iter.Response().Response.Response.StatusCode 2474 } 2475 tracing.EndSpan(ctx, sc, err) 2476 }() 2477 } 2478 iter.i++ 2479 if iter.i < len(iter.page.Values()) { 2480 return nil 2481 } 2482 err = iter.page.NextWithContext(ctx) 2483 if err != nil { 2484 iter.i-- 2485 return err 2486 } 2487 iter.i = 0 2488 return nil 2489} 2490 2491// Next advances to the next value. If there was an error making 2492// the request the iterator does not advance and the error is returned. 2493// Deprecated: Use NextWithContext() instead. 2494func (iter *ExpressRouteCircuitsArpTableListResultIterator) Next() error { 2495 return iter.NextWithContext(context.Background()) 2496} 2497 2498// NotDone returns true if the enumeration should be started or is not yet complete. 2499func (iter ExpressRouteCircuitsArpTableListResultIterator) NotDone() bool { 2500 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2501} 2502 2503// Response returns the raw server response from the last page request. 2504func (iter ExpressRouteCircuitsArpTableListResultIterator) Response() ExpressRouteCircuitsArpTableListResult { 2505 return iter.page.Response() 2506} 2507 2508// Value returns the current value or a zero-initialized value if the 2509// iterator has advanced beyond the end of the collection. 2510func (iter ExpressRouteCircuitsArpTableListResultIterator) Value() ExpressRouteCircuitArpTable { 2511 if !iter.page.NotDone() { 2512 return ExpressRouteCircuitArpTable{} 2513 } 2514 return iter.page.Values()[iter.i] 2515} 2516 2517// Creates a new instance of the ExpressRouteCircuitsArpTableListResultIterator type. 2518func NewExpressRouteCircuitsArpTableListResultIterator(page ExpressRouteCircuitsArpTableListResultPage) ExpressRouteCircuitsArpTableListResultIterator { 2519 return ExpressRouteCircuitsArpTableListResultIterator{page: page} 2520} 2521 2522// IsEmpty returns true if the ListResult contains no values. 2523func (ercatlr ExpressRouteCircuitsArpTableListResult) IsEmpty() bool { 2524 return ercatlr.Value == nil || len(*ercatlr.Value) == 0 2525} 2526 2527// hasNextLink returns true if the NextLink is not empty. 2528func (ercatlr ExpressRouteCircuitsArpTableListResult) hasNextLink() bool { 2529 return ercatlr.NextLink != nil && len(*ercatlr.NextLink) != 0 2530} 2531 2532// expressRouteCircuitsArpTableListResultPreparer prepares a request to retrieve the next set of results. 2533// It returns nil if no more results exist. 2534func (ercatlr ExpressRouteCircuitsArpTableListResult) expressRouteCircuitsArpTableListResultPreparer(ctx context.Context) (*http.Request, error) { 2535 if !ercatlr.hasNextLink() { 2536 return nil, nil 2537 } 2538 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2539 autorest.AsJSON(), 2540 autorest.AsGet(), 2541 autorest.WithBaseURL(to.String(ercatlr.NextLink))) 2542} 2543 2544// ExpressRouteCircuitsArpTableListResultPage contains a page of ExpressRouteCircuitArpTable values. 2545type ExpressRouteCircuitsArpTableListResultPage struct { 2546 fn func(context.Context, ExpressRouteCircuitsArpTableListResult) (ExpressRouteCircuitsArpTableListResult, error) 2547 ercatlr ExpressRouteCircuitsArpTableListResult 2548} 2549 2550// NextWithContext advances to the next page of values. If there was an error making 2551// the request the page does not advance and the error is returned. 2552func (page *ExpressRouteCircuitsArpTableListResultPage) NextWithContext(ctx context.Context) (err error) { 2553 if tracing.IsEnabled() { 2554 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsArpTableListResultPage.NextWithContext") 2555 defer func() { 2556 sc := -1 2557 if page.Response().Response.Response != nil { 2558 sc = page.Response().Response.Response.StatusCode 2559 } 2560 tracing.EndSpan(ctx, sc, err) 2561 }() 2562 } 2563 for { 2564 next, err := page.fn(ctx, page.ercatlr) 2565 if err != nil { 2566 return err 2567 } 2568 page.ercatlr = next 2569 if !next.hasNextLink() || !next.IsEmpty() { 2570 break 2571 } 2572 } 2573 return nil 2574} 2575 2576// Next advances to the next page of values. If there was an error making 2577// the request the page does not advance and the error is returned. 2578// Deprecated: Use NextWithContext() instead. 2579func (page *ExpressRouteCircuitsArpTableListResultPage) Next() error { 2580 return page.NextWithContext(context.Background()) 2581} 2582 2583// NotDone returns true if the page enumeration should be started or is not yet complete. 2584func (page ExpressRouteCircuitsArpTableListResultPage) NotDone() bool { 2585 return !page.ercatlr.IsEmpty() 2586} 2587 2588// Response returns the raw server response from the last page request. 2589func (page ExpressRouteCircuitsArpTableListResultPage) Response() ExpressRouteCircuitsArpTableListResult { 2590 return page.ercatlr 2591} 2592 2593// Values returns the slice of values for the current page or nil if there are no values. 2594func (page ExpressRouteCircuitsArpTableListResultPage) Values() []ExpressRouteCircuitArpTable { 2595 if page.ercatlr.IsEmpty() { 2596 return nil 2597 } 2598 return *page.ercatlr.Value 2599} 2600 2601// Creates a new instance of the ExpressRouteCircuitsArpTableListResultPage type. 2602func NewExpressRouteCircuitsArpTableListResultPage(cur ExpressRouteCircuitsArpTableListResult, getNextPage func(context.Context, ExpressRouteCircuitsArpTableListResult) (ExpressRouteCircuitsArpTableListResult, error)) ExpressRouteCircuitsArpTableListResultPage { 2603 return ExpressRouteCircuitsArpTableListResultPage{ 2604 fn: getNextPage, 2605 ercatlr: cur, 2606 } 2607} 2608 2609// ExpressRouteCircuitsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 2610// long-running operation. 2611type ExpressRouteCircuitsCreateOrUpdateFuture struct { 2612 azure.FutureAPI 2613 // Result returns the result of the asynchronous operation. 2614 // If the operation has not completed it will return an error. 2615 Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuit, error) 2616} 2617 2618// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2619func (future *ExpressRouteCircuitsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 2620 var azFuture azure.Future 2621 if err := json.Unmarshal(body, &azFuture); err != nil { 2622 return err 2623 } 2624 future.FutureAPI = &azFuture 2625 future.Result = future.result 2626 return nil 2627} 2628 2629// result is the default implementation for ExpressRouteCircuitsCreateOrUpdateFuture.Result. 2630func (future *ExpressRouteCircuitsCreateOrUpdateFuture) result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { 2631 var done bool 2632 done, err = future.DoneWithContext(context.Background(), client) 2633 if err != nil { 2634 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 2635 return 2636 } 2637 if !done { 2638 erc.Response.Response = future.Response() 2639 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsCreateOrUpdateFuture") 2640 return 2641 } 2642 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2643 if erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { 2644 erc, err = client.CreateOrUpdateResponder(erc.Response.Response) 2645 if err != nil { 2646 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", erc.Response.Response, "Failure responding to request") 2647 } 2648 } 2649 return 2650} 2651 2652// ExpressRouteCircuitsDeleteFuture an abstraction for monitoring and retrieving the results of a 2653// long-running operation. 2654type ExpressRouteCircuitsDeleteFuture struct { 2655 azure.FutureAPI 2656 // Result returns the result of the asynchronous operation. 2657 // If the operation has not completed it will return an error. 2658 Result func(ExpressRouteCircuitsClient) (autorest.Response, error) 2659} 2660 2661// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2662func (future *ExpressRouteCircuitsDeleteFuture) UnmarshalJSON(body []byte) error { 2663 var azFuture azure.Future 2664 if err := json.Unmarshal(body, &azFuture); err != nil { 2665 return err 2666 } 2667 future.FutureAPI = &azFuture 2668 future.Result = future.result 2669 return nil 2670} 2671 2672// result is the default implementation for ExpressRouteCircuitsDeleteFuture.Result. 2673func (future *ExpressRouteCircuitsDeleteFuture) result(client ExpressRouteCircuitsClient) (ar autorest.Response, err error) { 2674 var done bool 2675 done, err = future.DoneWithContext(context.Background(), client) 2676 if err != nil { 2677 err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", future.Response(), "Polling failure") 2678 return 2679 } 2680 if !done { 2681 ar.Response = future.Response() 2682 err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsDeleteFuture") 2683 return 2684 } 2685 ar.Response = future.Response() 2686 return 2687} 2688 2689// ExpressRouteCircuitServiceProviderProperties contains ServiceProviderProperties in an 2690// ExpressRouteCircuit 2691type ExpressRouteCircuitServiceProviderProperties struct { 2692 // ServiceProviderName - Gets or sets serviceProviderName. 2693 ServiceProviderName *string `json:"serviceProviderName,omitempty"` 2694 // PeeringLocation - Gets or sets peering location. 2695 PeeringLocation *string `json:"peeringLocation,omitempty"` 2696 // BandwidthInMbps - Gets or sets BandwidthInMbps. 2697 BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` 2698} 2699 2700// ExpressRouteCircuitSku contains sku in an ExpressRouteCircuit 2701type ExpressRouteCircuitSku struct { 2702 // Name - Gets or sets name of the sku. 2703 Name *string `json:"name,omitempty"` 2704 // Tier - Gets or sets tier of the sku. Possible values include: 'ExpressRouteCircuitSkuTierStandard', 'ExpressRouteCircuitSkuTierPremium' 2705 Tier ExpressRouteCircuitSkuTier `json:"tier,omitempty"` 2706 // Family - Gets or sets family of the sku. Possible values include: 'UnlimitedData', 'MeteredData' 2707 Family ExpressRouteCircuitSkuFamily `json:"family,omitempty"` 2708} 2709 2710// ExpressRouteCircuitsRoutesTableListResult response for ListRoutesTable associated with the Express Route 2711// Circuits Api 2712type ExpressRouteCircuitsRoutesTableListResult struct { 2713 autorest.Response `json:"-"` 2714 // Value - Gets List of RoutesTable 2715 Value *[]ExpressRouteCircuitRoutesTable `json:"value,omitempty"` 2716 // NextLink - Gets the URL to get the next set of results. 2717 NextLink *string `json:"nextLink,omitempty"` 2718} 2719 2720// ExpressRouteCircuitsRoutesTableListResultIterator provides access to a complete listing of 2721// ExpressRouteCircuitRoutesTable values. 2722type ExpressRouteCircuitsRoutesTableListResultIterator struct { 2723 i int 2724 page ExpressRouteCircuitsRoutesTableListResultPage 2725} 2726 2727// NextWithContext advances to the next value. If there was an error making 2728// the request the iterator does not advance and the error is returned. 2729func (iter *ExpressRouteCircuitsRoutesTableListResultIterator) NextWithContext(ctx context.Context) (err error) { 2730 if tracing.IsEnabled() { 2731 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsRoutesTableListResultIterator.NextWithContext") 2732 defer func() { 2733 sc := -1 2734 if iter.Response().Response.Response != nil { 2735 sc = iter.Response().Response.Response.StatusCode 2736 } 2737 tracing.EndSpan(ctx, sc, err) 2738 }() 2739 } 2740 iter.i++ 2741 if iter.i < len(iter.page.Values()) { 2742 return nil 2743 } 2744 err = iter.page.NextWithContext(ctx) 2745 if err != nil { 2746 iter.i-- 2747 return err 2748 } 2749 iter.i = 0 2750 return nil 2751} 2752 2753// Next advances to the next value. If there was an error making 2754// the request the iterator does not advance and the error is returned. 2755// Deprecated: Use NextWithContext() instead. 2756func (iter *ExpressRouteCircuitsRoutesTableListResultIterator) Next() error { 2757 return iter.NextWithContext(context.Background()) 2758} 2759 2760// NotDone returns true if the enumeration should be started or is not yet complete. 2761func (iter ExpressRouteCircuitsRoutesTableListResultIterator) NotDone() bool { 2762 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2763} 2764 2765// Response returns the raw server response from the last page request. 2766func (iter ExpressRouteCircuitsRoutesTableListResultIterator) Response() ExpressRouteCircuitsRoutesTableListResult { 2767 return iter.page.Response() 2768} 2769 2770// Value returns the current value or a zero-initialized value if the 2771// iterator has advanced beyond the end of the collection. 2772func (iter ExpressRouteCircuitsRoutesTableListResultIterator) Value() ExpressRouteCircuitRoutesTable { 2773 if !iter.page.NotDone() { 2774 return ExpressRouteCircuitRoutesTable{} 2775 } 2776 return iter.page.Values()[iter.i] 2777} 2778 2779// Creates a new instance of the ExpressRouteCircuitsRoutesTableListResultIterator type. 2780func NewExpressRouteCircuitsRoutesTableListResultIterator(page ExpressRouteCircuitsRoutesTableListResultPage) ExpressRouteCircuitsRoutesTableListResultIterator { 2781 return ExpressRouteCircuitsRoutesTableListResultIterator{page: page} 2782} 2783 2784// IsEmpty returns true if the ListResult contains no values. 2785func (ercrtlr ExpressRouteCircuitsRoutesTableListResult) IsEmpty() bool { 2786 return ercrtlr.Value == nil || len(*ercrtlr.Value) == 0 2787} 2788 2789// hasNextLink returns true if the NextLink is not empty. 2790func (ercrtlr ExpressRouteCircuitsRoutesTableListResult) hasNextLink() bool { 2791 return ercrtlr.NextLink != nil && len(*ercrtlr.NextLink) != 0 2792} 2793 2794// expressRouteCircuitsRoutesTableListResultPreparer prepares a request to retrieve the next set of results. 2795// It returns nil if no more results exist. 2796func (ercrtlr ExpressRouteCircuitsRoutesTableListResult) expressRouteCircuitsRoutesTableListResultPreparer(ctx context.Context) (*http.Request, error) { 2797 if !ercrtlr.hasNextLink() { 2798 return nil, nil 2799 } 2800 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2801 autorest.AsJSON(), 2802 autorest.AsGet(), 2803 autorest.WithBaseURL(to.String(ercrtlr.NextLink))) 2804} 2805 2806// ExpressRouteCircuitsRoutesTableListResultPage contains a page of ExpressRouteCircuitRoutesTable values. 2807type ExpressRouteCircuitsRoutesTableListResultPage struct { 2808 fn func(context.Context, ExpressRouteCircuitsRoutesTableListResult) (ExpressRouteCircuitsRoutesTableListResult, error) 2809 ercrtlr ExpressRouteCircuitsRoutesTableListResult 2810} 2811 2812// NextWithContext advances to the next page of values. If there was an error making 2813// the request the page does not advance and the error is returned. 2814func (page *ExpressRouteCircuitsRoutesTableListResultPage) NextWithContext(ctx context.Context) (err error) { 2815 if tracing.IsEnabled() { 2816 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsRoutesTableListResultPage.NextWithContext") 2817 defer func() { 2818 sc := -1 2819 if page.Response().Response.Response != nil { 2820 sc = page.Response().Response.Response.StatusCode 2821 } 2822 tracing.EndSpan(ctx, sc, err) 2823 }() 2824 } 2825 for { 2826 next, err := page.fn(ctx, page.ercrtlr) 2827 if err != nil { 2828 return err 2829 } 2830 page.ercrtlr = next 2831 if !next.hasNextLink() || !next.IsEmpty() { 2832 break 2833 } 2834 } 2835 return nil 2836} 2837 2838// Next advances to the next page of values. If there was an error making 2839// the request the page does not advance and the error is returned. 2840// Deprecated: Use NextWithContext() instead. 2841func (page *ExpressRouteCircuitsRoutesTableListResultPage) Next() error { 2842 return page.NextWithContext(context.Background()) 2843} 2844 2845// NotDone returns true if the page enumeration should be started or is not yet complete. 2846func (page ExpressRouteCircuitsRoutesTableListResultPage) NotDone() bool { 2847 return !page.ercrtlr.IsEmpty() 2848} 2849 2850// Response returns the raw server response from the last page request. 2851func (page ExpressRouteCircuitsRoutesTableListResultPage) Response() ExpressRouteCircuitsRoutesTableListResult { 2852 return page.ercrtlr 2853} 2854 2855// Values returns the slice of values for the current page or nil if there are no values. 2856func (page ExpressRouteCircuitsRoutesTableListResultPage) Values() []ExpressRouteCircuitRoutesTable { 2857 if page.ercrtlr.IsEmpty() { 2858 return nil 2859 } 2860 return *page.ercrtlr.Value 2861} 2862 2863// Creates a new instance of the ExpressRouteCircuitsRoutesTableListResultPage type. 2864func NewExpressRouteCircuitsRoutesTableListResultPage(cur ExpressRouteCircuitsRoutesTableListResult, getNextPage func(context.Context, ExpressRouteCircuitsRoutesTableListResult) (ExpressRouteCircuitsRoutesTableListResult, error)) ExpressRouteCircuitsRoutesTableListResultPage { 2865 return ExpressRouteCircuitsRoutesTableListResultPage{ 2866 fn: getNextPage, 2867 ercrtlr: cur, 2868 } 2869} 2870 2871// ExpressRouteCircuitsStatsListResult response for ListStats from Express Route Circuits Api service call 2872type ExpressRouteCircuitsStatsListResult struct { 2873 autorest.Response `json:"-"` 2874 // Value - Gets List of Stats 2875 Value *[]ExpressRouteCircuitStats `json:"value,omitempty"` 2876 // NextLink - Gets the URL to get the next set of results. 2877 NextLink *string `json:"nextLink,omitempty"` 2878} 2879 2880// ExpressRouteCircuitsStatsListResultIterator provides access to a complete listing of 2881// ExpressRouteCircuitStats values. 2882type ExpressRouteCircuitsStatsListResultIterator struct { 2883 i int 2884 page ExpressRouteCircuitsStatsListResultPage 2885} 2886 2887// NextWithContext advances to the next value. If there was an error making 2888// the request the iterator does not advance and the error is returned. 2889func (iter *ExpressRouteCircuitsStatsListResultIterator) NextWithContext(ctx context.Context) (err error) { 2890 if tracing.IsEnabled() { 2891 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsStatsListResultIterator.NextWithContext") 2892 defer func() { 2893 sc := -1 2894 if iter.Response().Response.Response != nil { 2895 sc = iter.Response().Response.Response.StatusCode 2896 } 2897 tracing.EndSpan(ctx, sc, err) 2898 }() 2899 } 2900 iter.i++ 2901 if iter.i < len(iter.page.Values()) { 2902 return nil 2903 } 2904 err = iter.page.NextWithContext(ctx) 2905 if err != nil { 2906 iter.i-- 2907 return err 2908 } 2909 iter.i = 0 2910 return nil 2911} 2912 2913// Next advances to the next value. If there was an error making 2914// the request the iterator does not advance and the error is returned. 2915// Deprecated: Use NextWithContext() instead. 2916func (iter *ExpressRouteCircuitsStatsListResultIterator) Next() error { 2917 return iter.NextWithContext(context.Background()) 2918} 2919 2920// NotDone returns true if the enumeration should be started or is not yet complete. 2921func (iter ExpressRouteCircuitsStatsListResultIterator) NotDone() bool { 2922 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2923} 2924 2925// Response returns the raw server response from the last page request. 2926func (iter ExpressRouteCircuitsStatsListResultIterator) Response() ExpressRouteCircuitsStatsListResult { 2927 return iter.page.Response() 2928} 2929 2930// Value returns the current value or a zero-initialized value if the 2931// iterator has advanced beyond the end of the collection. 2932func (iter ExpressRouteCircuitsStatsListResultIterator) Value() ExpressRouteCircuitStats { 2933 if !iter.page.NotDone() { 2934 return ExpressRouteCircuitStats{} 2935 } 2936 return iter.page.Values()[iter.i] 2937} 2938 2939// Creates a new instance of the ExpressRouteCircuitsStatsListResultIterator type. 2940func NewExpressRouteCircuitsStatsListResultIterator(page ExpressRouteCircuitsStatsListResultPage) ExpressRouteCircuitsStatsListResultIterator { 2941 return ExpressRouteCircuitsStatsListResultIterator{page: page} 2942} 2943 2944// IsEmpty returns true if the ListResult contains no values. 2945func (ercslr ExpressRouteCircuitsStatsListResult) IsEmpty() bool { 2946 return ercslr.Value == nil || len(*ercslr.Value) == 0 2947} 2948 2949// hasNextLink returns true if the NextLink is not empty. 2950func (ercslr ExpressRouteCircuitsStatsListResult) hasNextLink() bool { 2951 return ercslr.NextLink != nil && len(*ercslr.NextLink) != 0 2952} 2953 2954// expressRouteCircuitsStatsListResultPreparer prepares a request to retrieve the next set of results. 2955// It returns nil if no more results exist. 2956func (ercslr ExpressRouteCircuitsStatsListResult) expressRouteCircuitsStatsListResultPreparer(ctx context.Context) (*http.Request, error) { 2957 if !ercslr.hasNextLink() { 2958 return nil, nil 2959 } 2960 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2961 autorest.AsJSON(), 2962 autorest.AsGet(), 2963 autorest.WithBaseURL(to.String(ercslr.NextLink))) 2964} 2965 2966// ExpressRouteCircuitsStatsListResultPage contains a page of ExpressRouteCircuitStats values. 2967type ExpressRouteCircuitsStatsListResultPage struct { 2968 fn func(context.Context, ExpressRouteCircuitsStatsListResult) (ExpressRouteCircuitsStatsListResult, error) 2969 ercslr ExpressRouteCircuitsStatsListResult 2970} 2971 2972// NextWithContext advances to the next page of values. If there was an error making 2973// the request the page does not advance and the error is returned. 2974func (page *ExpressRouteCircuitsStatsListResultPage) NextWithContext(ctx context.Context) (err error) { 2975 if tracing.IsEnabled() { 2976 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsStatsListResultPage.NextWithContext") 2977 defer func() { 2978 sc := -1 2979 if page.Response().Response.Response != nil { 2980 sc = page.Response().Response.Response.StatusCode 2981 } 2982 tracing.EndSpan(ctx, sc, err) 2983 }() 2984 } 2985 for { 2986 next, err := page.fn(ctx, page.ercslr) 2987 if err != nil { 2988 return err 2989 } 2990 page.ercslr = next 2991 if !next.hasNextLink() || !next.IsEmpty() { 2992 break 2993 } 2994 } 2995 return nil 2996} 2997 2998// Next advances to the next page of values. If there was an error making 2999// the request the page does not advance and the error is returned. 3000// Deprecated: Use NextWithContext() instead. 3001func (page *ExpressRouteCircuitsStatsListResultPage) Next() error { 3002 return page.NextWithContext(context.Background()) 3003} 3004 3005// NotDone returns true if the page enumeration should be started or is not yet complete. 3006func (page ExpressRouteCircuitsStatsListResultPage) NotDone() bool { 3007 return !page.ercslr.IsEmpty() 3008} 3009 3010// Response returns the raw server response from the last page request. 3011func (page ExpressRouteCircuitsStatsListResultPage) Response() ExpressRouteCircuitsStatsListResult { 3012 return page.ercslr 3013} 3014 3015// Values returns the slice of values for the current page or nil if there are no values. 3016func (page ExpressRouteCircuitsStatsListResultPage) Values() []ExpressRouteCircuitStats { 3017 if page.ercslr.IsEmpty() { 3018 return nil 3019 } 3020 return *page.ercslr.Value 3021} 3022 3023// Creates a new instance of the ExpressRouteCircuitsStatsListResultPage type. 3024func NewExpressRouteCircuitsStatsListResultPage(cur ExpressRouteCircuitsStatsListResult, getNextPage func(context.Context, ExpressRouteCircuitsStatsListResult) (ExpressRouteCircuitsStatsListResult, error)) ExpressRouteCircuitsStatsListResultPage { 3025 return ExpressRouteCircuitsStatsListResultPage{ 3026 fn: getNextPage, 3027 ercslr: cur, 3028 } 3029} 3030 3031// ExpressRouteCircuitStats contains Stats associated with the peering 3032type ExpressRouteCircuitStats struct { 3033 // BytesIn - Gets BytesIn of the peering. 3034 BytesIn *int32 `json:"bytesIn,omitempty"` 3035 // BytesOut - Gets BytesOut of the peering. 3036 BytesOut *int32 `json:"bytesOut,omitempty"` 3037} 3038 3039// ExpressRouteServiceProvider expressRouteResourceProvider object 3040type ExpressRouteServiceProvider struct { 3041 // ID - Gets or sets the ID of the resource. 3042 ID *string `json:"id,omitempty"` 3043 // Name - Gets or sets the name of the resource. 3044 Name *string `json:"name,omitempty"` 3045 // Type - Gets or sets the type of the resource. 3046 Type *string `json:"type,omitempty"` 3047 Properties *ExpressRouteServiceProviderPropertiesFormat `json:"properties,omitempty"` 3048} 3049 3050// ExpressRouteServiceProviderBandwidthsOffered contains Bandwidths offered in ExpressRouteServiceProviders 3051type ExpressRouteServiceProviderBandwidthsOffered struct { 3052 // OfferName - Gets the OfferName 3053 OfferName *string `json:"offerName,omitempty"` 3054 // ValueInMbps - Gets the ValueInMbps. 3055 ValueInMbps *int32 `json:"valueInMbps,omitempty"` 3056} 3057 3058// ExpressRouteServiceProviderListResult response for ListExpressRouteServiceProvider Api service call 3059type ExpressRouteServiceProviderListResult struct { 3060 autorest.Response `json:"-"` 3061 // Value - Gets List of ExpressRouteResourceProvider 3062 Value *[]ExpressRouteServiceProvider `json:"value,omitempty"` 3063 // NextLink - Gets the URL to get the next set of results. 3064 NextLink *string `json:"nextLink,omitempty"` 3065} 3066 3067// ExpressRouteServiceProviderListResultIterator provides access to a complete listing of 3068// ExpressRouteServiceProvider values. 3069type ExpressRouteServiceProviderListResultIterator struct { 3070 i int 3071 page ExpressRouteServiceProviderListResultPage 3072} 3073 3074// NextWithContext advances to the next value. If there was an error making 3075// the request the iterator does not advance and the error is returned. 3076func (iter *ExpressRouteServiceProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { 3077 if tracing.IsEnabled() { 3078 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteServiceProviderListResultIterator.NextWithContext") 3079 defer func() { 3080 sc := -1 3081 if iter.Response().Response.Response != nil { 3082 sc = iter.Response().Response.Response.StatusCode 3083 } 3084 tracing.EndSpan(ctx, sc, err) 3085 }() 3086 } 3087 iter.i++ 3088 if iter.i < len(iter.page.Values()) { 3089 return nil 3090 } 3091 err = iter.page.NextWithContext(ctx) 3092 if err != nil { 3093 iter.i-- 3094 return err 3095 } 3096 iter.i = 0 3097 return nil 3098} 3099 3100// Next advances to the next value. If there was an error making 3101// the request the iterator does not advance and the error is returned. 3102// Deprecated: Use NextWithContext() instead. 3103func (iter *ExpressRouteServiceProviderListResultIterator) Next() error { 3104 return iter.NextWithContext(context.Background()) 3105} 3106 3107// NotDone returns true if the enumeration should be started or is not yet complete. 3108func (iter ExpressRouteServiceProviderListResultIterator) NotDone() bool { 3109 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3110} 3111 3112// Response returns the raw server response from the last page request. 3113func (iter ExpressRouteServiceProviderListResultIterator) Response() ExpressRouteServiceProviderListResult { 3114 return iter.page.Response() 3115} 3116 3117// Value returns the current value or a zero-initialized value if the 3118// iterator has advanced beyond the end of the collection. 3119func (iter ExpressRouteServiceProviderListResultIterator) Value() ExpressRouteServiceProvider { 3120 if !iter.page.NotDone() { 3121 return ExpressRouteServiceProvider{} 3122 } 3123 return iter.page.Values()[iter.i] 3124} 3125 3126// Creates a new instance of the ExpressRouteServiceProviderListResultIterator type. 3127func NewExpressRouteServiceProviderListResultIterator(page ExpressRouteServiceProviderListResultPage) ExpressRouteServiceProviderListResultIterator { 3128 return ExpressRouteServiceProviderListResultIterator{page: page} 3129} 3130 3131// IsEmpty returns true if the ListResult contains no values. 3132func (ersplr ExpressRouteServiceProviderListResult) IsEmpty() bool { 3133 return ersplr.Value == nil || len(*ersplr.Value) == 0 3134} 3135 3136// hasNextLink returns true if the NextLink is not empty. 3137func (ersplr ExpressRouteServiceProviderListResult) hasNextLink() bool { 3138 return ersplr.NextLink != nil && len(*ersplr.NextLink) != 0 3139} 3140 3141// expressRouteServiceProviderListResultPreparer prepares a request to retrieve the next set of results. 3142// It returns nil if no more results exist. 3143func (ersplr ExpressRouteServiceProviderListResult) expressRouteServiceProviderListResultPreparer(ctx context.Context) (*http.Request, error) { 3144 if !ersplr.hasNextLink() { 3145 return nil, nil 3146 } 3147 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3148 autorest.AsJSON(), 3149 autorest.AsGet(), 3150 autorest.WithBaseURL(to.String(ersplr.NextLink))) 3151} 3152 3153// ExpressRouteServiceProviderListResultPage contains a page of ExpressRouteServiceProvider values. 3154type ExpressRouteServiceProviderListResultPage struct { 3155 fn func(context.Context, ExpressRouteServiceProviderListResult) (ExpressRouteServiceProviderListResult, error) 3156 ersplr ExpressRouteServiceProviderListResult 3157} 3158 3159// NextWithContext advances to the next page of values. If there was an error making 3160// the request the page does not advance and the error is returned. 3161func (page *ExpressRouteServiceProviderListResultPage) NextWithContext(ctx context.Context) (err error) { 3162 if tracing.IsEnabled() { 3163 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteServiceProviderListResultPage.NextWithContext") 3164 defer func() { 3165 sc := -1 3166 if page.Response().Response.Response != nil { 3167 sc = page.Response().Response.Response.StatusCode 3168 } 3169 tracing.EndSpan(ctx, sc, err) 3170 }() 3171 } 3172 for { 3173 next, err := page.fn(ctx, page.ersplr) 3174 if err != nil { 3175 return err 3176 } 3177 page.ersplr = next 3178 if !next.hasNextLink() || !next.IsEmpty() { 3179 break 3180 } 3181 } 3182 return nil 3183} 3184 3185// Next advances to the next page of values. If there was an error making 3186// the request the page does not advance and the error is returned. 3187// Deprecated: Use NextWithContext() instead. 3188func (page *ExpressRouteServiceProviderListResultPage) Next() error { 3189 return page.NextWithContext(context.Background()) 3190} 3191 3192// NotDone returns true if the page enumeration should be started or is not yet complete. 3193func (page ExpressRouteServiceProviderListResultPage) NotDone() bool { 3194 return !page.ersplr.IsEmpty() 3195} 3196 3197// Response returns the raw server response from the last page request. 3198func (page ExpressRouteServiceProviderListResultPage) Response() ExpressRouteServiceProviderListResult { 3199 return page.ersplr 3200} 3201 3202// Values returns the slice of values for the current page or nil if there are no values. 3203func (page ExpressRouteServiceProviderListResultPage) Values() []ExpressRouteServiceProvider { 3204 if page.ersplr.IsEmpty() { 3205 return nil 3206 } 3207 return *page.ersplr.Value 3208} 3209 3210// Creates a new instance of the ExpressRouteServiceProviderListResultPage type. 3211func NewExpressRouteServiceProviderListResultPage(cur ExpressRouteServiceProviderListResult, getNextPage func(context.Context, ExpressRouteServiceProviderListResult) (ExpressRouteServiceProviderListResult, error)) ExpressRouteServiceProviderListResultPage { 3212 return ExpressRouteServiceProviderListResultPage{ 3213 fn: getNextPage, 3214 ersplr: cur, 3215 } 3216} 3217 3218// ExpressRouteServiceProviderPropertiesFormat properties of ExpressRouteServiceProvider 3219type ExpressRouteServiceProviderPropertiesFormat struct { 3220 // PeeringLocations - Gets or list of peering locations 3221 PeeringLocations *[]string `json:"peeringLocations,omitempty"` 3222 // BandwidthsOffered - Gets or bandwidths offered 3223 BandwidthsOffered *[]ExpressRouteServiceProviderBandwidthsOffered `json:"bandwidthsOffered,omitempty"` 3224 // ProvisioningState - Gets or sets Provisioning state of the resource 3225 ProvisioningState *string `json:"provisioningState,omitempty"` 3226} 3227 3228// FrontendIPConfiguration frontend IP address of the load balancer 3229type FrontendIPConfiguration struct { 3230 *FrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` 3231 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 3232 Name *string `json:"name,omitempty"` 3233 // Etag - A unique read-only string that changes whenever the resource is updated 3234 Etag *string `json:"etag,omitempty"` 3235 // ID - Resource Id 3236 ID *string `json:"id,omitempty"` 3237} 3238 3239// MarshalJSON is the custom marshaler for FrontendIPConfiguration. 3240func (fic FrontendIPConfiguration) MarshalJSON() ([]byte, error) { 3241 objectMap := make(map[string]interface{}) 3242 if fic.FrontendIPConfigurationPropertiesFormat != nil { 3243 objectMap["properties"] = fic.FrontendIPConfigurationPropertiesFormat 3244 } 3245 if fic.Name != nil { 3246 objectMap["name"] = fic.Name 3247 } 3248 if fic.Etag != nil { 3249 objectMap["etag"] = fic.Etag 3250 } 3251 if fic.ID != nil { 3252 objectMap["id"] = fic.ID 3253 } 3254 return json.Marshal(objectMap) 3255} 3256 3257// UnmarshalJSON is the custom unmarshaler for FrontendIPConfiguration struct. 3258func (fic *FrontendIPConfiguration) UnmarshalJSON(body []byte) error { 3259 var m map[string]*json.RawMessage 3260 err := json.Unmarshal(body, &m) 3261 if err != nil { 3262 return err 3263 } 3264 for k, v := range m { 3265 switch k { 3266 case "properties": 3267 if v != nil { 3268 var frontendIPConfigurationPropertiesFormat FrontendIPConfigurationPropertiesFormat 3269 err = json.Unmarshal(*v, &frontendIPConfigurationPropertiesFormat) 3270 if err != nil { 3271 return err 3272 } 3273 fic.FrontendIPConfigurationPropertiesFormat = &frontendIPConfigurationPropertiesFormat 3274 } 3275 case "name": 3276 if v != nil { 3277 var name string 3278 err = json.Unmarshal(*v, &name) 3279 if err != nil { 3280 return err 3281 } 3282 fic.Name = &name 3283 } 3284 case "etag": 3285 if v != nil { 3286 var etag string 3287 err = json.Unmarshal(*v, &etag) 3288 if err != nil { 3289 return err 3290 } 3291 fic.Etag = &etag 3292 } 3293 case "id": 3294 if v != nil { 3295 var ID string 3296 err = json.Unmarshal(*v, &ID) 3297 if err != nil { 3298 return err 3299 } 3300 fic.ID = &ID 3301 } 3302 } 3303 } 3304 3305 return nil 3306} 3307 3308// FrontendIPConfigurationPropertiesFormat properties of Frontend IP Configuration of the load balancer 3309type FrontendIPConfigurationPropertiesFormat struct { 3310 // PrivateIPAddress - Gets or sets the IP address of the Load Balancer.This is only specified if a specific private IP address shall be allocated from the subnet specified in subnetRef 3311 PrivateIPAddress *string `json:"privateIPAddress,omitempty"` 3312 // PrivateIPAllocationMethod - Gets or sets PrivateIP allocation method (Static/Dynamic). Possible values include: 'Static', 'Dynamic' 3313 PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` 3314 // Subnet - Gets or sets the reference of the subnet resource.A subnet from where the load balancer gets its private frontend address 3315 Subnet *SubResource `json:"subnet,omitempty"` 3316 // PublicIPAddress - Gets or sets the reference of the PublicIP resource 3317 PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` 3318 // InboundNatRules - Read only.Inbound rules URIs that use this frontend IP 3319 InboundNatRules *[]SubResource `json:"inboundNatRules,omitempty"` 3320 // InboundNatPools - Read only.Inbound pools URIs that use this frontend IP 3321 InboundNatPools *[]SubResource `json:"inboundNatPools,omitempty"` 3322 // OutboundNatRules - Read only.Outbound rules URIs that use this frontend IP 3323 OutboundNatRules *[]SubResource `json:"outboundNatRules,omitempty"` 3324 // LoadBalancingRules - Gets Load Balancing rules URIs that use this frontend IP 3325 LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` 3326 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 3327 ProvisioningState *string `json:"provisioningState,omitempty"` 3328} 3329 3330// InboundNatPool inbound NAT pool of the loadbalancer 3331type InboundNatPool struct { 3332 *InboundNatPoolPropertiesFormat `json:"properties,omitempty"` 3333 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 3334 Name *string `json:"name,omitempty"` 3335 // Etag - A unique read-only string that changes whenever the resource is updated 3336 Etag *string `json:"etag,omitempty"` 3337 // ID - Resource Id 3338 ID *string `json:"id,omitempty"` 3339} 3340 3341// MarshalJSON is the custom marshaler for InboundNatPool. 3342func (inp InboundNatPool) MarshalJSON() ([]byte, error) { 3343 objectMap := make(map[string]interface{}) 3344 if inp.InboundNatPoolPropertiesFormat != nil { 3345 objectMap["properties"] = inp.InboundNatPoolPropertiesFormat 3346 } 3347 if inp.Name != nil { 3348 objectMap["name"] = inp.Name 3349 } 3350 if inp.Etag != nil { 3351 objectMap["etag"] = inp.Etag 3352 } 3353 if inp.ID != nil { 3354 objectMap["id"] = inp.ID 3355 } 3356 return json.Marshal(objectMap) 3357} 3358 3359// UnmarshalJSON is the custom unmarshaler for InboundNatPool struct. 3360func (inp *InboundNatPool) UnmarshalJSON(body []byte) error { 3361 var m map[string]*json.RawMessage 3362 err := json.Unmarshal(body, &m) 3363 if err != nil { 3364 return err 3365 } 3366 for k, v := range m { 3367 switch k { 3368 case "properties": 3369 if v != nil { 3370 var inboundNatPoolPropertiesFormat InboundNatPoolPropertiesFormat 3371 err = json.Unmarshal(*v, &inboundNatPoolPropertiesFormat) 3372 if err != nil { 3373 return err 3374 } 3375 inp.InboundNatPoolPropertiesFormat = &inboundNatPoolPropertiesFormat 3376 } 3377 case "name": 3378 if v != nil { 3379 var name string 3380 err = json.Unmarshal(*v, &name) 3381 if err != nil { 3382 return err 3383 } 3384 inp.Name = &name 3385 } 3386 case "etag": 3387 if v != nil { 3388 var etag string 3389 err = json.Unmarshal(*v, &etag) 3390 if err != nil { 3391 return err 3392 } 3393 inp.Etag = &etag 3394 } 3395 case "id": 3396 if v != nil { 3397 var ID string 3398 err = json.Unmarshal(*v, &ID) 3399 if err != nil { 3400 return err 3401 } 3402 inp.ID = &ID 3403 } 3404 } 3405 } 3406 3407 return nil 3408} 3409 3410// InboundNatPoolPropertiesFormat properties of Inbound NAT pool 3411type InboundNatPoolPropertiesFormat struct { 3412 // FrontendIPConfiguration - Gets or sets a reference to frontend IP Addresses 3413 FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` 3414 // Protocol - Gets or sets the transport protocol for the external endpoint. Possible values are Udp or Tcp. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP' 3415 Protocol TransportProtocol `json:"protocol,omitempty"` 3416 // FrontendPortRangeStart - Gets or sets the starting port range for the NAT pool. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive 3417 FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` 3418 // FrontendPortRangeEnd - Gets or sets the ending port range for the NAT pool. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive 3419 FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` 3420 // BackendPort - Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal component on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API 3421 BackendPort *int32 `json:"backendPort,omitempty"` 3422 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 3423 ProvisioningState *string `json:"provisioningState,omitempty"` 3424} 3425 3426// InboundNatRule inbound NAT rule of the loadbalancer 3427type InboundNatRule struct { 3428 *InboundNatRulePropertiesFormat `json:"properties,omitempty"` 3429 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 3430 Name *string `json:"name,omitempty"` 3431 // Etag - A unique read-only string that changes whenever the resource is updated 3432 Etag *string `json:"etag,omitempty"` 3433 // ID - Resource Id 3434 ID *string `json:"id,omitempty"` 3435} 3436 3437// MarshalJSON is the custom marshaler for InboundNatRule. 3438func (inr InboundNatRule) MarshalJSON() ([]byte, error) { 3439 objectMap := make(map[string]interface{}) 3440 if inr.InboundNatRulePropertiesFormat != nil { 3441 objectMap["properties"] = inr.InboundNatRulePropertiesFormat 3442 } 3443 if inr.Name != nil { 3444 objectMap["name"] = inr.Name 3445 } 3446 if inr.Etag != nil { 3447 objectMap["etag"] = inr.Etag 3448 } 3449 if inr.ID != nil { 3450 objectMap["id"] = inr.ID 3451 } 3452 return json.Marshal(objectMap) 3453} 3454 3455// UnmarshalJSON is the custom unmarshaler for InboundNatRule struct. 3456func (inr *InboundNatRule) UnmarshalJSON(body []byte) error { 3457 var m map[string]*json.RawMessage 3458 err := json.Unmarshal(body, &m) 3459 if err != nil { 3460 return err 3461 } 3462 for k, v := range m { 3463 switch k { 3464 case "properties": 3465 if v != nil { 3466 var inboundNatRulePropertiesFormat InboundNatRulePropertiesFormat 3467 err = json.Unmarshal(*v, &inboundNatRulePropertiesFormat) 3468 if err != nil { 3469 return err 3470 } 3471 inr.InboundNatRulePropertiesFormat = &inboundNatRulePropertiesFormat 3472 } 3473 case "name": 3474 if v != nil { 3475 var name string 3476 err = json.Unmarshal(*v, &name) 3477 if err != nil { 3478 return err 3479 } 3480 inr.Name = &name 3481 } 3482 case "etag": 3483 if v != nil { 3484 var etag string 3485 err = json.Unmarshal(*v, &etag) 3486 if err != nil { 3487 return err 3488 } 3489 inr.Etag = &etag 3490 } 3491 case "id": 3492 if v != nil { 3493 var ID string 3494 err = json.Unmarshal(*v, &ID) 3495 if err != nil { 3496 return err 3497 } 3498 inr.ID = &ID 3499 } 3500 } 3501 } 3502 3503 return nil 3504} 3505 3506// InboundNatRulePropertiesFormat properties of Inbound NAT rule 3507type InboundNatRulePropertiesFormat struct { 3508 // FrontendIPConfiguration - Gets or sets a reference to frontend IP Addresses 3509 FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` 3510 // BackendIPConfiguration - Gets or sets a reference to a private ip address defined on a NetworkInterface of a VM. Traffic sent to frontendPort of each of the frontendIPConfigurations is forwarded to the backed IP 3511 BackendIPConfiguration *SubResource `json:"backendIPConfiguration,omitempty"` 3512 // Protocol - Gets or sets the transport protocol for the external endpoint. Possible values are Udp or Tcp. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP' 3513 Protocol TransportProtocol `json:"protocol,omitempty"` 3514 // FrontendPort - Gets or sets the port for the external endpoint. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive 3515 FrontendPort *int32 `json:"frontendPort,omitempty"` 3516 // BackendPort - Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal component on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API 3517 BackendPort *int32 `json:"backendPort,omitempty"` 3518 // IdleTimeoutInMinutes - Gets or sets the timeout for the Tcp idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to Tcp 3519 IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` 3520 // EnableFloatingIP - Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn availability Group. This setting is required when using the SQL Always ON availability Groups in SQL server. This setting can't be changed after you create the endpoint 3521 EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` 3522 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 3523 ProvisioningState *string `json:"provisioningState,omitempty"` 3524} 3525 3526// Interface a NetworkInterface in a resource group 3527type Interface struct { 3528 autorest.Response `json:"-"` 3529 *InterfacePropertiesFormat `json:"properties,omitempty"` 3530 // Etag - Gets a unique read-only string that changes whenever the resource is updated 3531 Etag *string `json:"etag,omitempty"` 3532 // ID - READ-ONLY; Resource Id 3533 ID *string `json:"id,omitempty"` 3534 // Name - READ-ONLY; Resource name 3535 Name *string `json:"name,omitempty"` 3536 // Type - READ-ONLY; Resource type 3537 Type *string `json:"type,omitempty"` 3538 // Location - Resource location 3539 Location *string `json:"location,omitempty"` 3540 // Tags - Resource tags 3541 Tags map[string]*string `json:"tags"` 3542} 3543 3544// MarshalJSON is the custom marshaler for Interface. 3545func (i Interface) MarshalJSON() ([]byte, error) { 3546 objectMap := make(map[string]interface{}) 3547 if i.InterfacePropertiesFormat != nil { 3548 objectMap["properties"] = i.InterfacePropertiesFormat 3549 } 3550 if i.Etag != nil { 3551 objectMap["etag"] = i.Etag 3552 } 3553 if i.Location != nil { 3554 objectMap["location"] = i.Location 3555 } 3556 if i.Tags != nil { 3557 objectMap["tags"] = i.Tags 3558 } 3559 return json.Marshal(objectMap) 3560} 3561 3562// UnmarshalJSON is the custom unmarshaler for Interface struct. 3563func (i *Interface) UnmarshalJSON(body []byte) error { 3564 var m map[string]*json.RawMessage 3565 err := json.Unmarshal(body, &m) 3566 if err != nil { 3567 return err 3568 } 3569 for k, v := range m { 3570 switch k { 3571 case "properties": 3572 if v != nil { 3573 var interfacePropertiesFormat InterfacePropertiesFormat 3574 err = json.Unmarshal(*v, &interfacePropertiesFormat) 3575 if err != nil { 3576 return err 3577 } 3578 i.InterfacePropertiesFormat = &interfacePropertiesFormat 3579 } 3580 case "etag": 3581 if v != nil { 3582 var etag string 3583 err = json.Unmarshal(*v, &etag) 3584 if err != nil { 3585 return err 3586 } 3587 i.Etag = &etag 3588 } 3589 case "id": 3590 if v != nil { 3591 var ID string 3592 err = json.Unmarshal(*v, &ID) 3593 if err != nil { 3594 return err 3595 } 3596 i.ID = &ID 3597 } 3598 case "name": 3599 if v != nil { 3600 var name string 3601 err = json.Unmarshal(*v, &name) 3602 if err != nil { 3603 return err 3604 } 3605 i.Name = &name 3606 } 3607 case "type": 3608 if v != nil { 3609 var typeVar string 3610 err = json.Unmarshal(*v, &typeVar) 3611 if err != nil { 3612 return err 3613 } 3614 i.Type = &typeVar 3615 } 3616 case "location": 3617 if v != nil { 3618 var location string 3619 err = json.Unmarshal(*v, &location) 3620 if err != nil { 3621 return err 3622 } 3623 i.Location = &location 3624 } 3625 case "tags": 3626 if v != nil { 3627 var tags map[string]*string 3628 err = json.Unmarshal(*v, &tags) 3629 if err != nil { 3630 return err 3631 } 3632 i.Tags = tags 3633 } 3634 } 3635 } 3636 3637 return nil 3638} 3639 3640// InterfaceDNSSettings dns Settings of a network interface 3641type InterfaceDNSSettings struct { 3642 // DNSServers - Gets or sets list of DNS servers IP addresses 3643 DNSServers *[]string `json:"dnsServers,omitempty"` 3644 // AppliedDNSServers - Gets or sets list of Applied DNS servers IP addresses 3645 AppliedDNSServers *[]string `json:"appliedDnsServers,omitempty"` 3646 // InternalDNSNameLabel - Gets or sets the Internal DNS name 3647 InternalDNSNameLabel *string `json:"internalDnsNameLabel,omitempty"` 3648 // InternalFqdn - Gets or sets full IDNS name in the form, DnsName.VnetId.ZoneId.TopLevelSuffix. This is set when the NIC is associated to a VM 3649 InternalFqdn *string `json:"internalFqdn,omitempty"` 3650} 3651 3652// InterfaceIPConfiguration iPConfiguration in a NetworkInterface 3653type InterfaceIPConfiguration struct { 3654 *InterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` 3655 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 3656 Name *string `json:"name,omitempty"` 3657 // Etag - A unique read-only string that changes whenever the resource is updated 3658 Etag *string `json:"etag,omitempty"` 3659 // ID - Resource Id 3660 ID *string `json:"id,omitempty"` 3661} 3662 3663// MarshalJSON is the custom marshaler for InterfaceIPConfiguration. 3664func (iic InterfaceIPConfiguration) MarshalJSON() ([]byte, error) { 3665 objectMap := make(map[string]interface{}) 3666 if iic.InterfaceIPConfigurationPropertiesFormat != nil { 3667 objectMap["properties"] = iic.InterfaceIPConfigurationPropertiesFormat 3668 } 3669 if iic.Name != nil { 3670 objectMap["name"] = iic.Name 3671 } 3672 if iic.Etag != nil { 3673 objectMap["etag"] = iic.Etag 3674 } 3675 if iic.ID != nil { 3676 objectMap["id"] = iic.ID 3677 } 3678 return json.Marshal(objectMap) 3679} 3680 3681// UnmarshalJSON is the custom unmarshaler for InterfaceIPConfiguration struct. 3682func (iic *InterfaceIPConfiguration) UnmarshalJSON(body []byte) error { 3683 var m map[string]*json.RawMessage 3684 err := json.Unmarshal(body, &m) 3685 if err != nil { 3686 return err 3687 } 3688 for k, v := range m { 3689 switch k { 3690 case "properties": 3691 if v != nil { 3692 var interfaceIPConfigurationPropertiesFormat InterfaceIPConfigurationPropertiesFormat 3693 err = json.Unmarshal(*v, &interfaceIPConfigurationPropertiesFormat) 3694 if err != nil { 3695 return err 3696 } 3697 iic.InterfaceIPConfigurationPropertiesFormat = &interfaceIPConfigurationPropertiesFormat 3698 } 3699 case "name": 3700 if v != nil { 3701 var name string 3702 err = json.Unmarshal(*v, &name) 3703 if err != nil { 3704 return err 3705 } 3706 iic.Name = &name 3707 } 3708 case "etag": 3709 if v != nil { 3710 var etag string 3711 err = json.Unmarshal(*v, &etag) 3712 if err != nil { 3713 return err 3714 } 3715 iic.Etag = &etag 3716 } 3717 case "id": 3718 if v != nil { 3719 var ID string 3720 err = json.Unmarshal(*v, &ID) 3721 if err != nil { 3722 return err 3723 } 3724 iic.ID = &ID 3725 } 3726 } 3727 } 3728 3729 return nil 3730} 3731 3732// InterfaceIPConfigurationPropertiesFormat properties of IPConfiguration 3733type InterfaceIPConfigurationPropertiesFormat struct { 3734 // PrivateIPAddress - Gets or sets the privateIPAddress of the Network Interface IP Configuration 3735 PrivateIPAddress *string `json:"privateIPAddress,omitempty"` 3736 // PrivateIPAllocationMethod - Gets or sets PrivateIP allocation method (Static/Dynamic). Possible values include: 'Static', 'Dynamic' 3737 PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` 3738 // Subnet - Gets or sets the reference of the subnet resource 3739 Subnet *SubResource `json:"subnet,omitempty"` 3740 // PublicIPAddress - Gets or sets the reference of the PublicIP resource 3741 PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` 3742 // LoadBalancerBackendAddressPools - Gets or sets the reference of LoadBalancerBackendAddressPool resource 3743 LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` 3744 // LoadBalancerInboundNatRules - Gets or sets list of references of LoadBalancerInboundNatRules 3745 LoadBalancerInboundNatRules *[]SubResource `json:"loadBalancerInboundNatRules,omitempty"` 3746 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 3747 ProvisioningState *string `json:"provisioningState,omitempty"` 3748} 3749 3750// InterfaceListResult response for ListNetworkInterface Api service call 3751type InterfaceListResult struct { 3752 autorest.Response `json:"-"` 3753 // Value - Gets or sets list of NetworkInterfaces in a resource group 3754 Value *[]Interface `json:"value,omitempty"` 3755 // NextLink - Gets the URL to get the next set of results. 3756 NextLink *string `json:"nextLink,omitempty"` 3757} 3758 3759// InterfaceListResultIterator provides access to a complete listing of Interface values. 3760type InterfaceListResultIterator struct { 3761 i int 3762 page InterfaceListResultPage 3763} 3764 3765// NextWithContext advances to the next value. If there was an error making 3766// the request the iterator does not advance and the error is returned. 3767func (iter *InterfaceListResultIterator) NextWithContext(ctx context.Context) (err error) { 3768 if tracing.IsEnabled() { 3769 ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceListResultIterator.NextWithContext") 3770 defer func() { 3771 sc := -1 3772 if iter.Response().Response.Response != nil { 3773 sc = iter.Response().Response.Response.StatusCode 3774 } 3775 tracing.EndSpan(ctx, sc, err) 3776 }() 3777 } 3778 iter.i++ 3779 if iter.i < len(iter.page.Values()) { 3780 return nil 3781 } 3782 err = iter.page.NextWithContext(ctx) 3783 if err != nil { 3784 iter.i-- 3785 return err 3786 } 3787 iter.i = 0 3788 return nil 3789} 3790 3791// Next advances to the next value. If there was an error making 3792// the request the iterator does not advance and the error is returned. 3793// Deprecated: Use NextWithContext() instead. 3794func (iter *InterfaceListResultIterator) Next() error { 3795 return iter.NextWithContext(context.Background()) 3796} 3797 3798// NotDone returns true if the enumeration should be started or is not yet complete. 3799func (iter InterfaceListResultIterator) NotDone() bool { 3800 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3801} 3802 3803// Response returns the raw server response from the last page request. 3804func (iter InterfaceListResultIterator) Response() InterfaceListResult { 3805 return iter.page.Response() 3806} 3807 3808// Value returns the current value or a zero-initialized value if the 3809// iterator has advanced beyond the end of the collection. 3810func (iter InterfaceListResultIterator) Value() Interface { 3811 if !iter.page.NotDone() { 3812 return Interface{} 3813 } 3814 return iter.page.Values()[iter.i] 3815} 3816 3817// Creates a new instance of the InterfaceListResultIterator type. 3818func NewInterfaceListResultIterator(page InterfaceListResultPage) InterfaceListResultIterator { 3819 return InterfaceListResultIterator{page: page} 3820} 3821 3822// IsEmpty returns true if the ListResult contains no values. 3823func (ilr InterfaceListResult) IsEmpty() bool { 3824 return ilr.Value == nil || len(*ilr.Value) == 0 3825} 3826 3827// hasNextLink returns true if the NextLink is not empty. 3828func (ilr InterfaceListResult) hasNextLink() bool { 3829 return ilr.NextLink != nil && len(*ilr.NextLink) != 0 3830} 3831 3832// interfaceListResultPreparer prepares a request to retrieve the next set of results. 3833// It returns nil if no more results exist. 3834func (ilr InterfaceListResult) interfaceListResultPreparer(ctx context.Context) (*http.Request, error) { 3835 if !ilr.hasNextLink() { 3836 return nil, nil 3837 } 3838 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3839 autorest.AsJSON(), 3840 autorest.AsGet(), 3841 autorest.WithBaseURL(to.String(ilr.NextLink))) 3842} 3843 3844// InterfaceListResultPage contains a page of Interface values. 3845type InterfaceListResultPage struct { 3846 fn func(context.Context, InterfaceListResult) (InterfaceListResult, error) 3847 ilr InterfaceListResult 3848} 3849 3850// NextWithContext advances to the next page of values. If there was an error making 3851// the request the page does not advance and the error is returned. 3852func (page *InterfaceListResultPage) NextWithContext(ctx context.Context) (err error) { 3853 if tracing.IsEnabled() { 3854 ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceListResultPage.NextWithContext") 3855 defer func() { 3856 sc := -1 3857 if page.Response().Response.Response != nil { 3858 sc = page.Response().Response.Response.StatusCode 3859 } 3860 tracing.EndSpan(ctx, sc, err) 3861 }() 3862 } 3863 for { 3864 next, err := page.fn(ctx, page.ilr) 3865 if err != nil { 3866 return err 3867 } 3868 page.ilr = next 3869 if !next.hasNextLink() || !next.IsEmpty() { 3870 break 3871 } 3872 } 3873 return nil 3874} 3875 3876// Next advances to the next page of values. If there was an error making 3877// the request the page does not advance and the error is returned. 3878// Deprecated: Use NextWithContext() instead. 3879func (page *InterfaceListResultPage) Next() error { 3880 return page.NextWithContext(context.Background()) 3881} 3882 3883// NotDone returns true if the page enumeration should be started or is not yet complete. 3884func (page InterfaceListResultPage) NotDone() bool { 3885 return !page.ilr.IsEmpty() 3886} 3887 3888// Response returns the raw server response from the last page request. 3889func (page InterfaceListResultPage) Response() InterfaceListResult { 3890 return page.ilr 3891} 3892 3893// Values returns the slice of values for the current page or nil if there are no values. 3894func (page InterfaceListResultPage) Values() []Interface { 3895 if page.ilr.IsEmpty() { 3896 return nil 3897 } 3898 return *page.ilr.Value 3899} 3900 3901// Creates a new instance of the InterfaceListResultPage type. 3902func NewInterfaceListResultPage(cur InterfaceListResult, getNextPage func(context.Context, InterfaceListResult) (InterfaceListResult, error)) InterfaceListResultPage { 3903 return InterfaceListResultPage{ 3904 fn: getNextPage, 3905 ilr: cur, 3906 } 3907} 3908 3909// InterfacePropertiesFormat networkInterface properties. 3910type InterfacePropertiesFormat struct { 3911 // VirtualMachine - Gets or sets the reference of a VirtualMachine 3912 VirtualMachine *SubResource `json:"virtualMachine,omitempty"` 3913 // NetworkSecurityGroup - Gets or sets the reference of the NetworkSecurityGroup resource 3914 NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` 3915 // IPConfigurations - Gets or sets list of IPConfigurations of the NetworkInterface 3916 IPConfigurations *[]InterfaceIPConfiguration `json:"ipConfigurations,omitempty"` 3917 // DNSSettings - Gets or sets DNS Settings in NetworkInterface 3918 DNSSettings *InterfaceDNSSettings `json:"dnsSettings,omitempty"` 3919 // MacAddress - Gets the MAC Address of the network interface 3920 MacAddress *string `json:"macAddress,omitempty"` 3921 // Primary - Gets whether this is a primary NIC on a virtual machine 3922 Primary *bool `json:"primary,omitempty"` 3923 // EnableIPForwarding - Gets or sets whether IPForwarding is enabled on the NIC 3924 EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` 3925 // ResourceGUID - Gets or sets resource guid property of the network interface resource 3926 ResourceGUID *string `json:"resourceGuid,omitempty"` 3927 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 3928 ProvisioningState *string `json:"provisioningState,omitempty"` 3929} 3930 3931// InterfacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 3932// long-running operation. 3933type InterfacesCreateOrUpdateFuture struct { 3934 azure.FutureAPI 3935 // Result returns the result of the asynchronous operation. 3936 // If the operation has not completed it will return an error. 3937 Result func(InterfacesClient) (Interface, error) 3938} 3939 3940// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3941func (future *InterfacesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 3942 var azFuture azure.Future 3943 if err := json.Unmarshal(body, &azFuture); err != nil { 3944 return err 3945 } 3946 future.FutureAPI = &azFuture 3947 future.Result = future.result 3948 return nil 3949} 3950 3951// result is the default implementation for InterfacesCreateOrUpdateFuture.Result. 3952func (future *InterfacesCreateOrUpdateFuture) result(client InterfacesClient) (i Interface, err error) { 3953 var done bool 3954 done, err = future.DoneWithContext(context.Background(), client) 3955 if err != nil { 3956 err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 3957 return 3958 } 3959 if !done { 3960 i.Response.Response = future.Response() 3961 err = azure.NewAsyncOpIncompleteError("network.InterfacesCreateOrUpdateFuture") 3962 return 3963 } 3964 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3965 if i.Response.Response, err = future.GetResult(sender); err == nil && i.Response.Response.StatusCode != http.StatusNoContent { 3966 i, err = client.CreateOrUpdateResponder(i.Response.Response) 3967 if err != nil { 3968 err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", i.Response.Response, "Failure responding to request") 3969 } 3970 } 3971 return 3972} 3973 3974// InterfacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 3975// operation. 3976type InterfacesDeleteFuture struct { 3977 azure.FutureAPI 3978 // Result returns the result of the asynchronous operation. 3979 // If the operation has not completed it will return an error. 3980 Result func(InterfacesClient) (autorest.Response, error) 3981} 3982 3983// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3984func (future *InterfacesDeleteFuture) UnmarshalJSON(body []byte) error { 3985 var azFuture azure.Future 3986 if err := json.Unmarshal(body, &azFuture); err != nil { 3987 return err 3988 } 3989 future.FutureAPI = &azFuture 3990 future.Result = future.result 3991 return nil 3992} 3993 3994// result is the default implementation for InterfacesDeleteFuture.Result. 3995func (future *InterfacesDeleteFuture) result(client InterfacesClient) (ar autorest.Response, err error) { 3996 var done bool 3997 done, err = future.DoneWithContext(context.Background(), client) 3998 if err != nil { 3999 err = autorest.NewErrorWithError(err, "network.InterfacesDeleteFuture", "Result", future.Response(), "Polling failure") 4000 return 4001 } 4002 if !done { 4003 ar.Response = future.Response() 4004 err = azure.NewAsyncOpIncompleteError("network.InterfacesDeleteFuture") 4005 return 4006 } 4007 ar.Response = future.Response() 4008 return 4009} 4010 4011// LoadBalancer loadBalancer resource 4012type LoadBalancer struct { 4013 autorest.Response `json:"-"` 4014 *LoadBalancerPropertiesFormat `json:"properties,omitempty"` 4015 // Etag - Gets a unique read-only string that changes whenever the resource is updated 4016 Etag *string `json:"etag,omitempty"` 4017 // ID - READ-ONLY; Resource Id 4018 ID *string `json:"id,omitempty"` 4019 // Name - READ-ONLY; Resource name 4020 Name *string `json:"name,omitempty"` 4021 // Type - READ-ONLY; Resource type 4022 Type *string `json:"type,omitempty"` 4023 // Location - Resource location 4024 Location *string `json:"location,omitempty"` 4025 // Tags - Resource tags 4026 Tags map[string]*string `json:"tags"` 4027} 4028 4029// MarshalJSON is the custom marshaler for LoadBalancer. 4030func (lb LoadBalancer) MarshalJSON() ([]byte, error) { 4031 objectMap := make(map[string]interface{}) 4032 if lb.LoadBalancerPropertiesFormat != nil { 4033 objectMap["properties"] = lb.LoadBalancerPropertiesFormat 4034 } 4035 if lb.Etag != nil { 4036 objectMap["etag"] = lb.Etag 4037 } 4038 if lb.Location != nil { 4039 objectMap["location"] = lb.Location 4040 } 4041 if lb.Tags != nil { 4042 objectMap["tags"] = lb.Tags 4043 } 4044 return json.Marshal(objectMap) 4045} 4046 4047// UnmarshalJSON is the custom unmarshaler for LoadBalancer struct. 4048func (lb *LoadBalancer) UnmarshalJSON(body []byte) error { 4049 var m map[string]*json.RawMessage 4050 err := json.Unmarshal(body, &m) 4051 if err != nil { 4052 return err 4053 } 4054 for k, v := range m { 4055 switch k { 4056 case "properties": 4057 if v != nil { 4058 var loadBalancerPropertiesFormat LoadBalancerPropertiesFormat 4059 err = json.Unmarshal(*v, &loadBalancerPropertiesFormat) 4060 if err != nil { 4061 return err 4062 } 4063 lb.LoadBalancerPropertiesFormat = &loadBalancerPropertiesFormat 4064 } 4065 case "etag": 4066 if v != nil { 4067 var etag string 4068 err = json.Unmarshal(*v, &etag) 4069 if err != nil { 4070 return err 4071 } 4072 lb.Etag = &etag 4073 } 4074 case "id": 4075 if v != nil { 4076 var ID string 4077 err = json.Unmarshal(*v, &ID) 4078 if err != nil { 4079 return err 4080 } 4081 lb.ID = &ID 4082 } 4083 case "name": 4084 if v != nil { 4085 var name string 4086 err = json.Unmarshal(*v, &name) 4087 if err != nil { 4088 return err 4089 } 4090 lb.Name = &name 4091 } 4092 case "type": 4093 if v != nil { 4094 var typeVar string 4095 err = json.Unmarshal(*v, &typeVar) 4096 if err != nil { 4097 return err 4098 } 4099 lb.Type = &typeVar 4100 } 4101 case "location": 4102 if v != nil { 4103 var location string 4104 err = json.Unmarshal(*v, &location) 4105 if err != nil { 4106 return err 4107 } 4108 lb.Location = &location 4109 } 4110 case "tags": 4111 if v != nil { 4112 var tags map[string]*string 4113 err = json.Unmarshal(*v, &tags) 4114 if err != nil { 4115 return err 4116 } 4117 lb.Tags = tags 4118 } 4119 } 4120 } 4121 4122 return nil 4123} 4124 4125// LoadBalancerListResult response for ListLoadBalancers Api service call 4126type LoadBalancerListResult struct { 4127 autorest.Response `json:"-"` 4128 // Value - Gets a list of LoadBalancers in a resource group 4129 Value *[]LoadBalancer `json:"value,omitempty"` 4130 // NextLink - Gets the URL to get the next set of results. 4131 NextLink *string `json:"nextLink,omitempty"` 4132} 4133 4134// LoadBalancerListResultIterator provides access to a complete listing of LoadBalancer values. 4135type LoadBalancerListResultIterator struct { 4136 i int 4137 page LoadBalancerListResultPage 4138} 4139 4140// NextWithContext advances to the next value. If there was an error making 4141// the request the iterator does not advance and the error is returned. 4142func (iter *LoadBalancerListResultIterator) NextWithContext(ctx context.Context) (err error) { 4143 if tracing.IsEnabled() { 4144 ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerListResultIterator.NextWithContext") 4145 defer func() { 4146 sc := -1 4147 if iter.Response().Response.Response != nil { 4148 sc = iter.Response().Response.Response.StatusCode 4149 } 4150 tracing.EndSpan(ctx, sc, err) 4151 }() 4152 } 4153 iter.i++ 4154 if iter.i < len(iter.page.Values()) { 4155 return nil 4156 } 4157 err = iter.page.NextWithContext(ctx) 4158 if err != nil { 4159 iter.i-- 4160 return err 4161 } 4162 iter.i = 0 4163 return nil 4164} 4165 4166// Next advances to the next value. If there was an error making 4167// the request the iterator does not advance and the error is returned. 4168// Deprecated: Use NextWithContext() instead. 4169func (iter *LoadBalancerListResultIterator) Next() error { 4170 return iter.NextWithContext(context.Background()) 4171} 4172 4173// NotDone returns true if the enumeration should be started or is not yet complete. 4174func (iter LoadBalancerListResultIterator) NotDone() bool { 4175 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4176} 4177 4178// Response returns the raw server response from the last page request. 4179func (iter LoadBalancerListResultIterator) Response() LoadBalancerListResult { 4180 return iter.page.Response() 4181} 4182 4183// Value returns the current value or a zero-initialized value if the 4184// iterator has advanced beyond the end of the collection. 4185func (iter LoadBalancerListResultIterator) Value() LoadBalancer { 4186 if !iter.page.NotDone() { 4187 return LoadBalancer{} 4188 } 4189 return iter.page.Values()[iter.i] 4190} 4191 4192// Creates a new instance of the LoadBalancerListResultIterator type. 4193func NewLoadBalancerListResultIterator(page LoadBalancerListResultPage) LoadBalancerListResultIterator { 4194 return LoadBalancerListResultIterator{page: page} 4195} 4196 4197// IsEmpty returns true if the ListResult contains no values. 4198func (lblr LoadBalancerListResult) IsEmpty() bool { 4199 return lblr.Value == nil || len(*lblr.Value) == 0 4200} 4201 4202// hasNextLink returns true if the NextLink is not empty. 4203func (lblr LoadBalancerListResult) hasNextLink() bool { 4204 return lblr.NextLink != nil && len(*lblr.NextLink) != 0 4205} 4206 4207// loadBalancerListResultPreparer prepares a request to retrieve the next set of results. 4208// It returns nil if no more results exist. 4209func (lblr LoadBalancerListResult) loadBalancerListResultPreparer(ctx context.Context) (*http.Request, error) { 4210 if !lblr.hasNextLink() { 4211 return nil, nil 4212 } 4213 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4214 autorest.AsJSON(), 4215 autorest.AsGet(), 4216 autorest.WithBaseURL(to.String(lblr.NextLink))) 4217} 4218 4219// LoadBalancerListResultPage contains a page of LoadBalancer values. 4220type LoadBalancerListResultPage struct { 4221 fn func(context.Context, LoadBalancerListResult) (LoadBalancerListResult, error) 4222 lblr LoadBalancerListResult 4223} 4224 4225// NextWithContext advances to the next page of values. If there was an error making 4226// the request the page does not advance and the error is returned. 4227func (page *LoadBalancerListResultPage) NextWithContext(ctx context.Context) (err error) { 4228 if tracing.IsEnabled() { 4229 ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerListResultPage.NextWithContext") 4230 defer func() { 4231 sc := -1 4232 if page.Response().Response.Response != nil { 4233 sc = page.Response().Response.Response.StatusCode 4234 } 4235 tracing.EndSpan(ctx, sc, err) 4236 }() 4237 } 4238 for { 4239 next, err := page.fn(ctx, page.lblr) 4240 if err != nil { 4241 return err 4242 } 4243 page.lblr = next 4244 if !next.hasNextLink() || !next.IsEmpty() { 4245 break 4246 } 4247 } 4248 return nil 4249} 4250 4251// Next advances to the next page of values. If there was an error making 4252// the request the page does not advance and the error is returned. 4253// Deprecated: Use NextWithContext() instead. 4254func (page *LoadBalancerListResultPage) Next() error { 4255 return page.NextWithContext(context.Background()) 4256} 4257 4258// NotDone returns true if the page enumeration should be started or is not yet complete. 4259func (page LoadBalancerListResultPage) NotDone() bool { 4260 return !page.lblr.IsEmpty() 4261} 4262 4263// Response returns the raw server response from the last page request. 4264func (page LoadBalancerListResultPage) Response() LoadBalancerListResult { 4265 return page.lblr 4266} 4267 4268// Values returns the slice of values for the current page or nil if there are no values. 4269func (page LoadBalancerListResultPage) Values() []LoadBalancer { 4270 if page.lblr.IsEmpty() { 4271 return nil 4272 } 4273 return *page.lblr.Value 4274} 4275 4276// Creates a new instance of the LoadBalancerListResultPage type. 4277func NewLoadBalancerListResultPage(cur LoadBalancerListResult, getNextPage func(context.Context, LoadBalancerListResult) (LoadBalancerListResult, error)) LoadBalancerListResultPage { 4278 return LoadBalancerListResultPage{ 4279 fn: getNextPage, 4280 lblr: cur, 4281 } 4282} 4283 4284// LoadBalancerPropertiesFormat properties of Load Balancer 4285type LoadBalancerPropertiesFormat struct { 4286 // FrontendIPConfigurations - Gets or sets frontend IP addresses of the load balancer 4287 FrontendIPConfigurations *[]FrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` 4288 // BackendAddressPools - Gets or sets Pools of backend IP addresses 4289 BackendAddressPools *[]BackendAddressPool `json:"backendAddressPools,omitempty"` 4290 // LoadBalancingRules - Gets or sets load balancing rules 4291 LoadBalancingRules *[]LoadBalancingRule `json:"loadBalancingRules,omitempty"` 4292 // Probes - Gets or sets list of Load balancer probes 4293 Probes *[]Probe `json:"probes,omitempty"` 4294 // InboundNatRules - Gets or sets list of inbound rules 4295 InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` 4296 // InboundNatPools - Gets or sets inbound NAT pools 4297 InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` 4298 // OutboundNatRules - Gets or sets outbound NAT rules 4299 OutboundNatRules *[]OutboundNatRule `json:"outboundNatRules,omitempty"` 4300 // ResourceGUID - Gets or sets resource guid property of the Load balancer resource 4301 ResourceGUID *string `json:"resourceGuid,omitempty"` 4302 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 4303 ProvisioningState *string `json:"provisioningState,omitempty"` 4304} 4305 4306// LoadBalancersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 4307// long-running operation. 4308type LoadBalancersCreateOrUpdateFuture struct { 4309 azure.FutureAPI 4310 // Result returns the result of the asynchronous operation. 4311 // If the operation has not completed it will return an error. 4312 Result func(LoadBalancersClient) (LoadBalancer, error) 4313} 4314 4315// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4316func (future *LoadBalancersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 4317 var azFuture azure.Future 4318 if err := json.Unmarshal(body, &azFuture); err != nil { 4319 return err 4320 } 4321 future.FutureAPI = &azFuture 4322 future.Result = future.result 4323 return nil 4324} 4325 4326// result is the default implementation for LoadBalancersCreateOrUpdateFuture.Result. 4327func (future *LoadBalancersCreateOrUpdateFuture) result(client LoadBalancersClient) (lb LoadBalancer, err error) { 4328 var done bool 4329 done, err = future.DoneWithContext(context.Background(), client) 4330 if err != nil { 4331 err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 4332 return 4333 } 4334 if !done { 4335 lb.Response.Response = future.Response() 4336 err = azure.NewAsyncOpIncompleteError("network.LoadBalancersCreateOrUpdateFuture") 4337 return 4338 } 4339 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4340 if lb.Response.Response, err = future.GetResult(sender); err == nil && lb.Response.Response.StatusCode != http.StatusNoContent { 4341 lb, err = client.CreateOrUpdateResponder(lb.Response.Response) 4342 if err != nil { 4343 err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", lb.Response.Response, "Failure responding to request") 4344 } 4345 } 4346 return 4347} 4348 4349// LoadBalancersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 4350// operation. 4351type LoadBalancersDeleteFuture struct { 4352 azure.FutureAPI 4353 // Result returns the result of the asynchronous operation. 4354 // If the operation has not completed it will return an error. 4355 Result func(LoadBalancersClient) (autorest.Response, error) 4356} 4357 4358// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4359func (future *LoadBalancersDeleteFuture) UnmarshalJSON(body []byte) error { 4360 var azFuture azure.Future 4361 if err := json.Unmarshal(body, &azFuture); err != nil { 4362 return err 4363 } 4364 future.FutureAPI = &azFuture 4365 future.Result = future.result 4366 return nil 4367} 4368 4369// result is the default implementation for LoadBalancersDeleteFuture.Result. 4370func (future *LoadBalancersDeleteFuture) result(client LoadBalancersClient) (ar autorest.Response, err error) { 4371 var done bool 4372 done, err = future.DoneWithContext(context.Background(), client) 4373 if err != nil { 4374 err = autorest.NewErrorWithError(err, "network.LoadBalancersDeleteFuture", "Result", future.Response(), "Polling failure") 4375 return 4376 } 4377 if !done { 4378 ar.Response = future.Response() 4379 err = azure.NewAsyncOpIncompleteError("network.LoadBalancersDeleteFuture") 4380 return 4381 } 4382 ar.Response = future.Response() 4383 return 4384} 4385 4386// LoadBalancingRule rules of the load balancer 4387type LoadBalancingRule struct { 4388 *LoadBalancingRulePropertiesFormat `json:"properties,omitempty"` 4389 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 4390 Name *string `json:"name,omitempty"` 4391 // Etag - A unique read-only string that changes whenever the resource is updated 4392 Etag *string `json:"etag,omitempty"` 4393 // ID - Resource Id 4394 ID *string `json:"id,omitempty"` 4395} 4396 4397// MarshalJSON is the custom marshaler for LoadBalancingRule. 4398func (lbr LoadBalancingRule) MarshalJSON() ([]byte, error) { 4399 objectMap := make(map[string]interface{}) 4400 if lbr.LoadBalancingRulePropertiesFormat != nil { 4401 objectMap["properties"] = lbr.LoadBalancingRulePropertiesFormat 4402 } 4403 if lbr.Name != nil { 4404 objectMap["name"] = lbr.Name 4405 } 4406 if lbr.Etag != nil { 4407 objectMap["etag"] = lbr.Etag 4408 } 4409 if lbr.ID != nil { 4410 objectMap["id"] = lbr.ID 4411 } 4412 return json.Marshal(objectMap) 4413} 4414 4415// UnmarshalJSON is the custom unmarshaler for LoadBalancingRule struct. 4416func (lbr *LoadBalancingRule) UnmarshalJSON(body []byte) error { 4417 var m map[string]*json.RawMessage 4418 err := json.Unmarshal(body, &m) 4419 if err != nil { 4420 return err 4421 } 4422 for k, v := range m { 4423 switch k { 4424 case "properties": 4425 if v != nil { 4426 var loadBalancingRulePropertiesFormat LoadBalancingRulePropertiesFormat 4427 err = json.Unmarshal(*v, &loadBalancingRulePropertiesFormat) 4428 if err != nil { 4429 return err 4430 } 4431 lbr.LoadBalancingRulePropertiesFormat = &loadBalancingRulePropertiesFormat 4432 } 4433 case "name": 4434 if v != nil { 4435 var name string 4436 err = json.Unmarshal(*v, &name) 4437 if err != nil { 4438 return err 4439 } 4440 lbr.Name = &name 4441 } 4442 case "etag": 4443 if v != nil { 4444 var etag string 4445 err = json.Unmarshal(*v, &etag) 4446 if err != nil { 4447 return err 4448 } 4449 lbr.Etag = &etag 4450 } 4451 case "id": 4452 if v != nil { 4453 var ID string 4454 err = json.Unmarshal(*v, &ID) 4455 if err != nil { 4456 return err 4457 } 4458 lbr.ID = &ID 4459 } 4460 } 4461 } 4462 4463 return nil 4464} 4465 4466// LoadBalancingRulePropertiesFormat properties of the load balancer 4467type LoadBalancingRulePropertiesFormat struct { 4468 // FrontendIPConfiguration - Gets or sets a reference to frontend IP Addresses 4469 FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` 4470 // BackendAddressPool - Gets or sets a reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs 4471 BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` 4472 // Probe - Gets or sets the reference of the load balancer probe used by the Load Balancing rule. 4473 Probe *SubResource `json:"probe,omitempty"` 4474 // Protocol - Gets or sets the transport protocol for the external endpoint. Possible values are Udp or Tcp. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP' 4475 Protocol TransportProtocol `json:"protocol,omitempty"` 4476 // LoadDistribution - Gets or sets the load distribution policy for this rule. Possible values include: 'Default', 'SourceIP', 'SourceIPProtocol' 4477 LoadDistribution LoadDistribution `json:"loadDistribution,omitempty"` 4478 // FrontendPort - Gets or sets the port for the external endpoint. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive 4479 FrontendPort *int32 `json:"frontendPort,omitempty"` 4480 // BackendPort - Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal component on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API 4481 BackendPort *int32 `json:"backendPort,omitempty"` 4482 // IdleTimeoutInMinutes - Gets or sets the timeout for the Tcp idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to Tcp 4483 IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` 4484 // EnableFloatingIP - Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn availability Group. This setting is required when using the SQL Always ON availability Groups in SQL server. This setting can't be changed after you create the endpoint 4485 EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` 4486 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 4487 ProvisioningState *string `json:"provisioningState,omitempty"` 4488} 4489 4490// LocalNetworkGateway a common class for general resource information 4491type LocalNetworkGateway struct { 4492 autorest.Response `json:"-"` 4493 *LocalNetworkGatewayPropertiesFormat `json:"properties,omitempty"` 4494 // Etag - Gets a unique read-only string that changes whenever the resource is updated 4495 Etag *string `json:"etag,omitempty"` 4496 // ID - READ-ONLY; Resource Id 4497 ID *string `json:"id,omitempty"` 4498 // Name - READ-ONLY; Resource name 4499 Name *string `json:"name,omitempty"` 4500 // Type - READ-ONLY; Resource type 4501 Type *string `json:"type,omitempty"` 4502 // Location - Resource location 4503 Location *string `json:"location,omitempty"` 4504 // Tags - Resource tags 4505 Tags map[string]*string `json:"tags"` 4506} 4507 4508// MarshalJSON is the custom marshaler for LocalNetworkGateway. 4509func (lng LocalNetworkGateway) MarshalJSON() ([]byte, error) { 4510 objectMap := make(map[string]interface{}) 4511 if lng.LocalNetworkGatewayPropertiesFormat != nil { 4512 objectMap["properties"] = lng.LocalNetworkGatewayPropertiesFormat 4513 } 4514 if lng.Etag != nil { 4515 objectMap["etag"] = lng.Etag 4516 } 4517 if lng.Location != nil { 4518 objectMap["location"] = lng.Location 4519 } 4520 if lng.Tags != nil { 4521 objectMap["tags"] = lng.Tags 4522 } 4523 return json.Marshal(objectMap) 4524} 4525 4526// UnmarshalJSON is the custom unmarshaler for LocalNetworkGateway struct. 4527func (lng *LocalNetworkGateway) UnmarshalJSON(body []byte) error { 4528 var m map[string]*json.RawMessage 4529 err := json.Unmarshal(body, &m) 4530 if err != nil { 4531 return err 4532 } 4533 for k, v := range m { 4534 switch k { 4535 case "properties": 4536 if v != nil { 4537 var localNetworkGatewayPropertiesFormat LocalNetworkGatewayPropertiesFormat 4538 err = json.Unmarshal(*v, &localNetworkGatewayPropertiesFormat) 4539 if err != nil { 4540 return err 4541 } 4542 lng.LocalNetworkGatewayPropertiesFormat = &localNetworkGatewayPropertiesFormat 4543 } 4544 case "etag": 4545 if v != nil { 4546 var etag string 4547 err = json.Unmarshal(*v, &etag) 4548 if err != nil { 4549 return err 4550 } 4551 lng.Etag = &etag 4552 } 4553 case "id": 4554 if v != nil { 4555 var ID string 4556 err = json.Unmarshal(*v, &ID) 4557 if err != nil { 4558 return err 4559 } 4560 lng.ID = &ID 4561 } 4562 case "name": 4563 if v != nil { 4564 var name string 4565 err = json.Unmarshal(*v, &name) 4566 if err != nil { 4567 return err 4568 } 4569 lng.Name = &name 4570 } 4571 case "type": 4572 if v != nil { 4573 var typeVar string 4574 err = json.Unmarshal(*v, &typeVar) 4575 if err != nil { 4576 return err 4577 } 4578 lng.Type = &typeVar 4579 } 4580 case "location": 4581 if v != nil { 4582 var location string 4583 err = json.Unmarshal(*v, &location) 4584 if err != nil { 4585 return err 4586 } 4587 lng.Location = &location 4588 } 4589 case "tags": 4590 if v != nil { 4591 var tags map[string]*string 4592 err = json.Unmarshal(*v, &tags) 4593 if err != nil { 4594 return err 4595 } 4596 lng.Tags = tags 4597 } 4598 } 4599 } 4600 4601 return nil 4602} 4603 4604// LocalNetworkGatewayListResult response for ListLocalNetworkGateways Api service call 4605type LocalNetworkGatewayListResult struct { 4606 autorest.Response `json:"-"` 4607 // Value - Gets List of LocalNetworkGateways that exists in a resource group 4608 Value *[]LocalNetworkGateway `json:"value,omitempty"` 4609 // NextLink - Gets the URL to get the next set of results. 4610 NextLink *string `json:"nextLink,omitempty"` 4611} 4612 4613// LocalNetworkGatewayListResultIterator provides access to a complete listing of LocalNetworkGateway 4614// values. 4615type LocalNetworkGatewayListResultIterator struct { 4616 i int 4617 page LocalNetworkGatewayListResultPage 4618} 4619 4620// NextWithContext advances to the next value. If there was an error making 4621// the request the iterator does not advance and the error is returned. 4622func (iter *LocalNetworkGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { 4623 if tracing.IsEnabled() { 4624 ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewayListResultIterator.NextWithContext") 4625 defer func() { 4626 sc := -1 4627 if iter.Response().Response.Response != nil { 4628 sc = iter.Response().Response.Response.StatusCode 4629 } 4630 tracing.EndSpan(ctx, sc, err) 4631 }() 4632 } 4633 iter.i++ 4634 if iter.i < len(iter.page.Values()) { 4635 return nil 4636 } 4637 err = iter.page.NextWithContext(ctx) 4638 if err != nil { 4639 iter.i-- 4640 return err 4641 } 4642 iter.i = 0 4643 return nil 4644} 4645 4646// Next advances to the next value. If there was an error making 4647// the request the iterator does not advance and the error is returned. 4648// Deprecated: Use NextWithContext() instead. 4649func (iter *LocalNetworkGatewayListResultIterator) Next() error { 4650 return iter.NextWithContext(context.Background()) 4651} 4652 4653// NotDone returns true if the enumeration should be started or is not yet complete. 4654func (iter LocalNetworkGatewayListResultIterator) NotDone() bool { 4655 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4656} 4657 4658// Response returns the raw server response from the last page request. 4659func (iter LocalNetworkGatewayListResultIterator) Response() LocalNetworkGatewayListResult { 4660 return iter.page.Response() 4661} 4662 4663// Value returns the current value or a zero-initialized value if the 4664// iterator has advanced beyond the end of the collection. 4665func (iter LocalNetworkGatewayListResultIterator) Value() LocalNetworkGateway { 4666 if !iter.page.NotDone() { 4667 return LocalNetworkGateway{} 4668 } 4669 return iter.page.Values()[iter.i] 4670} 4671 4672// Creates a new instance of the LocalNetworkGatewayListResultIterator type. 4673func NewLocalNetworkGatewayListResultIterator(page LocalNetworkGatewayListResultPage) LocalNetworkGatewayListResultIterator { 4674 return LocalNetworkGatewayListResultIterator{page: page} 4675} 4676 4677// IsEmpty returns true if the ListResult contains no values. 4678func (lnglr LocalNetworkGatewayListResult) IsEmpty() bool { 4679 return lnglr.Value == nil || len(*lnglr.Value) == 0 4680} 4681 4682// hasNextLink returns true if the NextLink is not empty. 4683func (lnglr LocalNetworkGatewayListResult) hasNextLink() bool { 4684 return lnglr.NextLink != nil && len(*lnglr.NextLink) != 0 4685} 4686 4687// localNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. 4688// It returns nil if no more results exist. 4689func (lnglr LocalNetworkGatewayListResult) localNetworkGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { 4690 if !lnglr.hasNextLink() { 4691 return nil, nil 4692 } 4693 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4694 autorest.AsJSON(), 4695 autorest.AsGet(), 4696 autorest.WithBaseURL(to.String(lnglr.NextLink))) 4697} 4698 4699// LocalNetworkGatewayListResultPage contains a page of LocalNetworkGateway values. 4700type LocalNetworkGatewayListResultPage struct { 4701 fn func(context.Context, LocalNetworkGatewayListResult) (LocalNetworkGatewayListResult, error) 4702 lnglr LocalNetworkGatewayListResult 4703} 4704 4705// NextWithContext advances to the next page of values. If there was an error making 4706// the request the page does not advance and the error is returned. 4707func (page *LocalNetworkGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { 4708 if tracing.IsEnabled() { 4709 ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewayListResultPage.NextWithContext") 4710 defer func() { 4711 sc := -1 4712 if page.Response().Response.Response != nil { 4713 sc = page.Response().Response.Response.StatusCode 4714 } 4715 tracing.EndSpan(ctx, sc, err) 4716 }() 4717 } 4718 for { 4719 next, err := page.fn(ctx, page.lnglr) 4720 if err != nil { 4721 return err 4722 } 4723 page.lnglr = next 4724 if !next.hasNextLink() || !next.IsEmpty() { 4725 break 4726 } 4727 } 4728 return nil 4729} 4730 4731// Next advances to the next page of values. If there was an error making 4732// the request the page does not advance and the error is returned. 4733// Deprecated: Use NextWithContext() instead. 4734func (page *LocalNetworkGatewayListResultPage) Next() error { 4735 return page.NextWithContext(context.Background()) 4736} 4737 4738// NotDone returns true if the page enumeration should be started or is not yet complete. 4739func (page LocalNetworkGatewayListResultPage) NotDone() bool { 4740 return !page.lnglr.IsEmpty() 4741} 4742 4743// Response returns the raw server response from the last page request. 4744func (page LocalNetworkGatewayListResultPage) Response() LocalNetworkGatewayListResult { 4745 return page.lnglr 4746} 4747 4748// Values returns the slice of values for the current page or nil if there are no values. 4749func (page LocalNetworkGatewayListResultPage) Values() []LocalNetworkGateway { 4750 if page.lnglr.IsEmpty() { 4751 return nil 4752 } 4753 return *page.lnglr.Value 4754} 4755 4756// Creates a new instance of the LocalNetworkGatewayListResultPage type. 4757func NewLocalNetworkGatewayListResultPage(cur LocalNetworkGatewayListResult, getNextPage func(context.Context, LocalNetworkGatewayListResult) (LocalNetworkGatewayListResult, error)) LocalNetworkGatewayListResultPage { 4758 return LocalNetworkGatewayListResultPage{ 4759 fn: getNextPage, 4760 lnglr: cur, 4761 } 4762} 4763 4764// LocalNetworkGatewayPropertiesFormat localNetworkGateway properties 4765type LocalNetworkGatewayPropertiesFormat struct { 4766 // LocalNetworkAddressSpace - Local network site Address space 4767 LocalNetworkAddressSpace *AddressSpace `json:"localNetworkAddressSpace,omitempty"` 4768 // GatewayIPAddress - IP address of local network gateway. 4769 GatewayIPAddress *string `json:"gatewayIpAddress,omitempty"` 4770 // ResourceGUID - Gets or sets resource guid property of the LocalNetworkGateway resource 4771 ResourceGUID *string `json:"resourceGuid,omitempty"` 4772 // ProvisioningState - Gets or sets Provisioning state of the LocalNetworkGateway resource Updating/Deleting/Failed 4773 ProvisioningState *string `json:"provisioningState,omitempty"` 4774} 4775 4776// LocalNetworkGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 4777// long-running operation. 4778type LocalNetworkGatewaysCreateOrUpdateFuture struct { 4779 azure.FutureAPI 4780 // Result returns the result of the asynchronous operation. 4781 // If the operation has not completed it will return an error. 4782 Result func(LocalNetworkGatewaysClient) (LocalNetworkGateway, error) 4783} 4784 4785// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4786func (future *LocalNetworkGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 4787 var azFuture azure.Future 4788 if err := json.Unmarshal(body, &azFuture); err != nil { 4789 return err 4790 } 4791 future.FutureAPI = &azFuture 4792 future.Result = future.result 4793 return nil 4794} 4795 4796// result is the default implementation for LocalNetworkGatewaysCreateOrUpdateFuture.Result. 4797func (future *LocalNetworkGatewaysCreateOrUpdateFuture) result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { 4798 var done bool 4799 done, err = future.DoneWithContext(context.Background(), client) 4800 if err != nil { 4801 err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 4802 return 4803 } 4804 if !done { 4805 lng.Response.Response = future.Response() 4806 err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysCreateOrUpdateFuture") 4807 return 4808 } 4809 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4810 if lng.Response.Response, err = future.GetResult(sender); err == nil && lng.Response.Response.StatusCode != http.StatusNoContent { 4811 lng, err = client.CreateOrUpdateResponder(lng.Response.Response) 4812 if err != nil { 4813 err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", lng.Response.Response, "Failure responding to request") 4814 } 4815 } 4816 return 4817} 4818 4819// LocalNetworkGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a 4820// long-running operation. 4821type LocalNetworkGatewaysDeleteFuture struct { 4822 azure.FutureAPI 4823 // Result returns the result of the asynchronous operation. 4824 // If the operation has not completed it will return an error. 4825 Result func(LocalNetworkGatewaysClient) (autorest.Response, error) 4826} 4827 4828// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4829func (future *LocalNetworkGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { 4830 var azFuture azure.Future 4831 if err := json.Unmarshal(body, &azFuture); err != nil { 4832 return err 4833 } 4834 future.FutureAPI = &azFuture 4835 future.Result = future.result 4836 return nil 4837} 4838 4839// result is the default implementation for LocalNetworkGatewaysDeleteFuture.Result. 4840func (future *LocalNetworkGatewaysDeleteFuture) result(client LocalNetworkGatewaysClient) (ar autorest.Response, err error) { 4841 var done bool 4842 done, err = future.DoneWithContext(context.Background(), client) 4843 if err != nil { 4844 err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") 4845 return 4846 } 4847 if !done { 4848 ar.Response = future.Response() 4849 err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysDeleteFuture") 4850 return 4851 } 4852 ar.Response = future.Response() 4853 return 4854} 4855 4856// OutboundNatRule outbound NAT pool of the loadbalancer 4857type OutboundNatRule struct { 4858 *OutboundNatRulePropertiesFormat `json:"properties,omitempty"` 4859 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 4860 Name *string `json:"name,omitempty"` 4861 // Etag - A unique read-only string that changes whenever the resource is updated 4862 Etag *string `json:"etag,omitempty"` 4863 // ID - Resource Id 4864 ID *string `json:"id,omitempty"` 4865} 4866 4867// MarshalJSON is the custom marshaler for OutboundNatRule. 4868func (onr OutboundNatRule) MarshalJSON() ([]byte, error) { 4869 objectMap := make(map[string]interface{}) 4870 if onr.OutboundNatRulePropertiesFormat != nil { 4871 objectMap["properties"] = onr.OutboundNatRulePropertiesFormat 4872 } 4873 if onr.Name != nil { 4874 objectMap["name"] = onr.Name 4875 } 4876 if onr.Etag != nil { 4877 objectMap["etag"] = onr.Etag 4878 } 4879 if onr.ID != nil { 4880 objectMap["id"] = onr.ID 4881 } 4882 return json.Marshal(objectMap) 4883} 4884 4885// UnmarshalJSON is the custom unmarshaler for OutboundNatRule struct. 4886func (onr *OutboundNatRule) UnmarshalJSON(body []byte) error { 4887 var m map[string]*json.RawMessage 4888 err := json.Unmarshal(body, &m) 4889 if err != nil { 4890 return err 4891 } 4892 for k, v := range m { 4893 switch k { 4894 case "properties": 4895 if v != nil { 4896 var outboundNatRulePropertiesFormat OutboundNatRulePropertiesFormat 4897 err = json.Unmarshal(*v, &outboundNatRulePropertiesFormat) 4898 if err != nil { 4899 return err 4900 } 4901 onr.OutboundNatRulePropertiesFormat = &outboundNatRulePropertiesFormat 4902 } 4903 case "name": 4904 if v != nil { 4905 var name string 4906 err = json.Unmarshal(*v, &name) 4907 if err != nil { 4908 return err 4909 } 4910 onr.Name = &name 4911 } 4912 case "etag": 4913 if v != nil { 4914 var etag string 4915 err = json.Unmarshal(*v, &etag) 4916 if err != nil { 4917 return err 4918 } 4919 onr.Etag = &etag 4920 } 4921 case "id": 4922 if v != nil { 4923 var ID string 4924 err = json.Unmarshal(*v, &ID) 4925 if err != nil { 4926 return err 4927 } 4928 onr.ID = &ID 4929 } 4930 } 4931 } 4932 4933 return nil 4934} 4935 4936// OutboundNatRulePropertiesFormat outbound NAT pool of the loadbalancer 4937type OutboundNatRulePropertiesFormat struct { 4938 // AllocatedOutboundPorts - Gets or sets the number of outbound ports to be used for SNAT 4939 AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` 4940 // FrontendIPConfigurations - Gets or sets Frontend IP addresses of the load balancer 4941 FrontendIPConfigurations *[]SubResource `json:"frontendIPConfigurations,omitempty"` 4942 // BackendAddressPool - Gets or sets a reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs 4943 BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` 4944 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 4945 ProvisioningState *string `json:"provisioningState,omitempty"` 4946} 4947 4948// Probe load balancer Probe 4949type Probe struct { 4950 *ProbePropertiesFormat `json:"properties,omitempty"` 4951 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 4952 Name *string `json:"name,omitempty"` 4953 // Etag - A unique read-only string that changes whenever the resource is updated 4954 Etag *string `json:"etag,omitempty"` 4955 // ID - Resource Id 4956 ID *string `json:"id,omitempty"` 4957} 4958 4959// MarshalJSON is the custom marshaler for Probe. 4960func (p Probe) MarshalJSON() ([]byte, error) { 4961 objectMap := make(map[string]interface{}) 4962 if p.ProbePropertiesFormat != nil { 4963 objectMap["properties"] = p.ProbePropertiesFormat 4964 } 4965 if p.Name != nil { 4966 objectMap["name"] = p.Name 4967 } 4968 if p.Etag != nil { 4969 objectMap["etag"] = p.Etag 4970 } 4971 if p.ID != nil { 4972 objectMap["id"] = p.ID 4973 } 4974 return json.Marshal(objectMap) 4975} 4976 4977// UnmarshalJSON is the custom unmarshaler for Probe struct. 4978func (p *Probe) UnmarshalJSON(body []byte) error { 4979 var m map[string]*json.RawMessage 4980 err := json.Unmarshal(body, &m) 4981 if err != nil { 4982 return err 4983 } 4984 for k, v := range m { 4985 switch k { 4986 case "properties": 4987 if v != nil { 4988 var probePropertiesFormat ProbePropertiesFormat 4989 err = json.Unmarshal(*v, &probePropertiesFormat) 4990 if err != nil { 4991 return err 4992 } 4993 p.ProbePropertiesFormat = &probePropertiesFormat 4994 } 4995 case "name": 4996 if v != nil { 4997 var name string 4998 err = json.Unmarshal(*v, &name) 4999 if err != nil { 5000 return err 5001 } 5002 p.Name = &name 5003 } 5004 case "etag": 5005 if v != nil { 5006 var etag string 5007 err = json.Unmarshal(*v, &etag) 5008 if err != nil { 5009 return err 5010 } 5011 p.Etag = &etag 5012 } 5013 case "id": 5014 if v != nil { 5015 var ID string 5016 err = json.Unmarshal(*v, &ID) 5017 if err != nil { 5018 return err 5019 } 5020 p.ID = &ID 5021 } 5022 } 5023 } 5024 5025 return nil 5026} 5027 5028// ProbePropertiesFormat ... 5029type ProbePropertiesFormat struct { 5030 // LoadBalancingRules - Gets Load balancer rules that use this probe 5031 LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` 5032 // Protocol - Gets or sets the protocol of the end point. Possible values are http pr Tcp. If Tcp is specified, a received ACK is required for the probe to be successful. If http is specified,a 200 OK response from the specifies URI is required for the probe to be successful. Possible values include: 'ProbeProtocolHTTP', 'ProbeProtocolTCP' 5033 Protocol ProbeProtocol `json:"protocol,omitempty"` 5034 // Port - Gets or sets Port for communicating the probe. Possible values range from 1 to 65535, inclusive. 5035 Port *int32 `json:"port,omitempty"` 5036 // IntervalInSeconds - Gets or sets the interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the interval is slightly less than half the allocated timeout period (in seconds) which allows two full probes before taking the instance out of rotation. The default value is 15, the minimum value is 5 5037 IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` 5038 // NumberOfProbes - Gets or sets the number of probes where if no response, will result in stopping further traffic from being delivered to the endpoint. This values allows endpoints to be taken out of rotation faster or slower than the typical times used in Azure. 5039 NumberOfProbes *int32 `json:"numberOfProbes,omitempty"` 5040 // RequestPath - Gets or sets the URI used for requesting health status from the VM. Path is required if a protocol is set to http. Otherwise, it is not allowed. There is no default value 5041 RequestPath *string `json:"requestPath,omitempty"` 5042 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 5043 ProvisioningState *string `json:"provisioningState,omitempty"` 5044} 5045 5046// PublicIPAddress publicIPAddress resource 5047type PublicIPAddress struct { 5048 autorest.Response `json:"-"` 5049 *PublicIPAddressPropertiesFormat `json:"properties,omitempty"` 5050 // Etag - Gets a unique read-only string that changes whenever the resource is updated 5051 Etag *string `json:"etag,omitempty"` 5052 // ID - READ-ONLY; Resource Id 5053 ID *string `json:"id,omitempty"` 5054 // Name - READ-ONLY; Resource name 5055 Name *string `json:"name,omitempty"` 5056 // Type - READ-ONLY; Resource type 5057 Type *string `json:"type,omitempty"` 5058 // Location - Resource location 5059 Location *string `json:"location,omitempty"` 5060 // Tags - Resource tags 5061 Tags map[string]*string `json:"tags"` 5062} 5063 5064// MarshalJSON is the custom marshaler for PublicIPAddress. 5065func (pia PublicIPAddress) MarshalJSON() ([]byte, error) { 5066 objectMap := make(map[string]interface{}) 5067 if pia.PublicIPAddressPropertiesFormat != nil { 5068 objectMap["properties"] = pia.PublicIPAddressPropertiesFormat 5069 } 5070 if pia.Etag != nil { 5071 objectMap["etag"] = pia.Etag 5072 } 5073 if pia.Location != nil { 5074 objectMap["location"] = pia.Location 5075 } 5076 if pia.Tags != nil { 5077 objectMap["tags"] = pia.Tags 5078 } 5079 return json.Marshal(objectMap) 5080} 5081 5082// UnmarshalJSON is the custom unmarshaler for PublicIPAddress struct. 5083func (pia *PublicIPAddress) UnmarshalJSON(body []byte) error { 5084 var m map[string]*json.RawMessage 5085 err := json.Unmarshal(body, &m) 5086 if err != nil { 5087 return err 5088 } 5089 for k, v := range m { 5090 switch k { 5091 case "properties": 5092 if v != nil { 5093 var publicIPAddressPropertiesFormat PublicIPAddressPropertiesFormat 5094 err = json.Unmarshal(*v, &publicIPAddressPropertiesFormat) 5095 if err != nil { 5096 return err 5097 } 5098 pia.PublicIPAddressPropertiesFormat = &publicIPAddressPropertiesFormat 5099 } 5100 case "etag": 5101 if v != nil { 5102 var etag string 5103 err = json.Unmarshal(*v, &etag) 5104 if err != nil { 5105 return err 5106 } 5107 pia.Etag = &etag 5108 } 5109 case "id": 5110 if v != nil { 5111 var ID string 5112 err = json.Unmarshal(*v, &ID) 5113 if err != nil { 5114 return err 5115 } 5116 pia.ID = &ID 5117 } 5118 case "name": 5119 if v != nil { 5120 var name string 5121 err = json.Unmarshal(*v, &name) 5122 if err != nil { 5123 return err 5124 } 5125 pia.Name = &name 5126 } 5127 case "type": 5128 if v != nil { 5129 var typeVar string 5130 err = json.Unmarshal(*v, &typeVar) 5131 if err != nil { 5132 return err 5133 } 5134 pia.Type = &typeVar 5135 } 5136 case "location": 5137 if v != nil { 5138 var location string 5139 err = json.Unmarshal(*v, &location) 5140 if err != nil { 5141 return err 5142 } 5143 pia.Location = &location 5144 } 5145 case "tags": 5146 if v != nil { 5147 var tags map[string]*string 5148 err = json.Unmarshal(*v, &tags) 5149 if err != nil { 5150 return err 5151 } 5152 pia.Tags = tags 5153 } 5154 } 5155 } 5156 5157 return nil 5158} 5159 5160// PublicIPAddressDNSSettings contains FQDN of the DNS record associated with the public IP address 5161type PublicIPAddressDNSSettings struct { 5162 // DomainNameLabel - Gets or sets the Domain name label.The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system. 5163 DomainNameLabel *string `json:"domainNameLabel,omitempty"` 5164 // Fqdn - Gets the FQDN, Fully qualified domain name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone. 5165 Fqdn *string `json:"fqdn,omitempty"` 5166 // ReverseFqdn - Gets or Sets the Reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN. 5167 ReverseFqdn *string `json:"reverseFqdn,omitempty"` 5168} 5169 5170// PublicIPAddressesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 5171// long-running operation. 5172type PublicIPAddressesCreateOrUpdateFuture struct { 5173 azure.FutureAPI 5174 // Result returns the result of the asynchronous operation. 5175 // If the operation has not completed it will return an error. 5176 Result func(PublicIPAddressesClient) (PublicIPAddress, error) 5177} 5178 5179// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5180func (future *PublicIPAddressesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 5181 var azFuture azure.Future 5182 if err := json.Unmarshal(body, &azFuture); err != nil { 5183 return err 5184 } 5185 future.FutureAPI = &azFuture 5186 future.Result = future.result 5187 return nil 5188} 5189 5190// result is the default implementation for PublicIPAddressesCreateOrUpdateFuture.Result. 5191func (future *PublicIPAddressesCreateOrUpdateFuture) result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { 5192 var done bool 5193 done, err = future.DoneWithContext(context.Background(), client) 5194 if err != nil { 5195 err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 5196 return 5197 } 5198 if !done { 5199 pia.Response.Response = future.Response() 5200 err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesCreateOrUpdateFuture") 5201 return 5202 } 5203 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5204 if pia.Response.Response, err = future.GetResult(sender); err == nil && pia.Response.Response.StatusCode != http.StatusNoContent { 5205 pia, err = client.CreateOrUpdateResponder(pia.Response.Response) 5206 if err != nil { 5207 err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", pia.Response.Response, "Failure responding to request") 5208 } 5209 } 5210 return 5211} 5212 5213// PublicIPAddressesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 5214// operation. 5215type PublicIPAddressesDeleteFuture struct { 5216 azure.FutureAPI 5217 // Result returns the result of the asynchronous operation. 5218 // If the operation has not completed it will return an error. 5219 Result func(PublicIPAddressesClient) (autorest.Response, error) 5220} 5221 5222// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5223func (future *PublicIPAddressesDeleteFuture) UnmarshalJSON(body []byte) error { 5224 var azFuture azure.Future 5225 if err := json.Unmarshal(body, &azFuture); err != nil { 5226 return err 5227 } 5228 future.FutureAPI = &azFuture 5229 future.Result = future.result 5230 return nil 5231} 5232 5233// result is the default implementation for PublicIPAddressesDeleteFuture.Result. 5234func (future *PublicIPAddressesDeleteFuture) result(client PublicIPAddressesClient) (ar autorest.Response, err error) { 5235 var done bool 5236 done, err = future.DoneWithContext(context.Background(), client) 5237 if err != nil { 5238 err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDeleteFuture", "Result", future.Response(), "Polling failure") 5239 return 5240 } 5241 if !done { 5242 ar.Response = future.Response() 5243 err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesDeleteFuture") 5244 return 5245 } 5246 ar.Response = future.Response() 5247 return 5248} 5249 5250// PublicIPAddressListResult response for ListPublicIpAddresses Api service call 5251type PublicIPAddressListResult struct { 5252 autorest.Response `json:"-"` 5253 // Value - Gets List of publicIP addresses that exists in a resource group 5254 Value *[]PublicIPAddress `json:"value,omitempty"` 5255 // NextLink - Gets the URL to get the next set of results. 5256 NextLink *string `json:"nextLink,omitempty"` 5257} 5258 5259// PublicIPAddressListResultIterator provides access to a complete listing of PublicIPAddress values. 5260type PublicIPAddressListResultIterator struct { 5261 i int 5262 page PublicIPAddressListResultPage 5263} 5264 5265// NextWithContext advances to the next value. If there was an error making 5266// the request the iterator does not advance and the error is returned. 5267func (iter *PublicIPAddressListResultIterator) NextWithContext(ctx context.Context) (err error) { 5268 if tracing.IsEnabled() { 5269 ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressListResultIterator.NextWithContext") 5270 defer func() { 5271 sc := -1 5272 if iter.Response().Response.Response != nil { 5273 sc = iter.Response().Response.Response.StatusCode 5274 } 5275 tracing.EndSpan(ctx, sc, err) 5276 }() 5277 } 5278 iter.i++ 5279 if iter.i < len(iter.page.Values()) { 5280 return nil 5281 } 5282 err = iter.page.NextWithContext(ctx) 5283 if err != nil { 5284 iter.i-- 5285 return err 5286 } 5287 iter.i = 0 5288 return nil 5289} 5290 5291// Next advances to the next value. If there was an error making 5292// the request the iterator does not advance and the error is returned. 5293// Deprecated: Use NextWithContext() instead. 5294func (iter *PublicIPAddressListResultIterator) Next() error { 5295 return iter.NextWithContext(context.Background()) 5296} 5297 5298// NotDone returns true if the enumeration should be started or is not yet complete. 5299func (iter PublicIPAddressListResultIterator) NotDone() bool { 5300 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5301} 5302 5303// Response returns the raw server response from the last page request. 5304func (iter PublicIPAddressListResultIterator) Response() PublicIPAddressListResult { 5305 return iter.page.Response() 5306} 5307 5308// Value returns the current value or a zero-initialized value if the 5309// iterator has advanced beyond the end of the collection. 5310func (iter PublicIPAddressListResultIterator) Value() PublicIPAddress { 5311 if !iter.page.NotDone() { 5312 return PublicIPAddress{} 5313 } 5314 return iter.page.Values()[iter.i] 5315} 5316 5317// Creates a new instance of the PublicIPAddressListResultIterator type. 5318func NewPublicIPAddressListResultIterator(page PublicIPAddressListResultPage) PublicIPAddressListResultIterator { 5319 return PublicIPAddressListResultIterator{page: page} 5320} 5321 5322// IsEmpty returns true if the ListResult contains no values. 5323func (pialr PublicIPAddressListResult) IsEmpty() bool { 5324 return pialr.Value == nil || len(*pialr.Value) == 0 5325} 5326 5327// hasNextLink returns true if the NextLink is not empty. 5328func (pialr PublicIPAddressListResult) hasNextLink() bool { 5329 return pialr.NextLink != nil && len(*pialr.NextLink) != 0 5330} 5331 5332// publicIPAddressListResultPreparer prepares a request to retrieve the next set of results. 5333// It returns nil if no more results exist. 5334func (pialr PublicIPAddressListResult) publicIPAddressListResultPreparer(ctx context.Context) (*http.Request, error) { 5335 if !pialr.hasNextLink() { 5336 return nil, nil 5337 } 5338 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5339 autorest.AsJSON(), 5340 autorest.AsGet(), 5341 autorest.WithBaseURL(to.String(pialr.NextLink))) 5342} 5343 5344// PublicIPAddressListResultPage contains a page of PublicIPAddress values. 5345type PublicIPAddressListResultPage struct { 5346 fn func(context.Context, PublicIPAddressListResult) (PublicIPAddressListResult, error) 5347 pialr PublicIPAddressListResult 5348} 5349 5350// NextWithContext advances to the next page of values. If there was an error making 5351// the request the page does not advance and the error is returned. 5352func (page *PublicIPAddressListResultPage) NextWithContext(ctx context.Context) (err error) { 5353 if tracing.IsEnabled() { 5354 ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressListResultPage.NextWithContext") 5355 defer func() { 5356 sc := -1 5357 if page.Response().Response.Response != nil { 5358 sc = page.Response().Response.Response.StatusCode 5359 } 5360 tracing.EndSpan(ctx, sc, err) 5361 }() 5362 } 5363 for { 5364 next, err := page.fn(ctx, page.pialr) 5365 if err != nil { 5366 return err 5367 } 5368 page.pialr = next 5369 if !next.hasNextLink() || !next.IsEmpty() { 5370 break 5371 } 5372 } 5373 return nil 5374} 5375 5376// Next advances to the next page of values. If there was an error making 5377// the request the page does not advance and the error is returned. 5378// Deprecated: Use NextWithContext() instead. 5379func (page *PublicIPAddressListResultPage) Next() error { 5380 return page.NextWithContext(context.Background()) 5381} 5382 5383// NotDone returns true if the page enumeration should be started or is not yet complete. 5384func (page PublicIPAddressListResultPage) NotDone() bool { 5385 return !page.pialr.IsEmpty() 5386} 5387 5388// Response returns the raw server response from the last page request. 5389func (page PublicIPAddressListResultPage) Response() PublicIPAddressListResult { 5390 return page.pialr 5391} 5392 5393// Values returns the slice of values for the current page or nil if there are no values. 5394func (page PublicIPAddressListResultPage) Values() []PublicIPAddress { 5395 if page.pialr.IsEmpty() { 5396 return nil 5397 } 5398 return *page.pialr.Value 5399} 5400 5401// Creates a new instance of the PublicIPAddressListResultPage type. 5402func NewPublicIPAddressListResultPage(cur PublicIPAddressListResult, getNextPage func(context.Context, PublicIPAddressListResult) (PublicIPAddressListResult, error)) PublicIPAddressListResultPage { 5403 return PublicIPAddressListResultPage{ 5404 fn: getNextPage, 5405 pialr: cur, 5406 } 5407} 5408 5409// PublicIPAddressPropertiesFormat publicIpAddress properties 5410type PublicIPAddressPropertiesFormat struct { 5411 // PublicIPAllocationMethod - Gets or sets PublicIP allocation method (Static/Dynamic). Possible values include: 'Static', 'Dynamic' 5412 PublicIPAllocationMethod IPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` 5413 // IPConfiguration - Gets a reference to the network interface IP configurations using this public IP address 5414 IPConfiguration *SubResource `json:"ipConfiguration,omitempty"` 5415 // DNSSettings - Gets or sets FQDN of the DNS record associated with the public IP address 5416 DNSSettings *PublicIPAddressDNSSettings `json:"dnsSettings,omitempty"` 5417 // IPAddress - Gets the assigned public IP address 5418 IPAddress *string `json:"ipAddress,omitempty"` 5419 // IdleTimeoutInMinutes - Gets or sets the idle timeout of the public IP address 5420 IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` 5421 // ResourceGUID - Gets or sets resource guid property of the PublicIP resource 5422 ResourceGUID *string `json:"resourceGuid,omitempty"` 5423 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 5424 ProvisioningState *string `json:"provisioningState,omitempty"` 5425} 5426 5427// Resource ... 5428type Resource struct { 5429 // ID - READ-ONLY; Resource Id 5430 ID *string `json:"id,omitempty"` 5431 // Name - READ-ONLY; Resource name 5432 Name *string `json:"name,omitempty"` 5433 // Type - READ-ONLY; Resource type 5434 Type *string `json:"type,omitempty"` 5435 // Location - Resource location 5436 Location *string `json:"location,omitempty"` 5437 // Tags - Resource tags 5438 Tags map[string]*string `json:"tags"` 5439} 5440 5441// MarshalJSON is the custom marshaler for Resource. 5442func (r Resource) MarshalJSON() ([]byte, error) { 5443 objectMap := make(map[string]interface{}) 5444 if r.Location != nil { 5445 objectMap["location"] = r.Location 5446 } 5447 if r.Tags != nil { 5448 objectMap["tags"] = r.Tags 5449 } 5450 return json.Marshal(objectMap) 5451} 5452 5453// Route route resource 5454type Route struct { 5455 autorest.Response `json:"-"` 5456 *RoutePropertiesFormat `json:"properties,omitempty"` 5457 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 5458 Name *string `json:"name,omitempty"` 5459 // Etag - A unique read-only string that changes whenever the resource is updated 5460 Etag *string `json:"etag,omitempty"` 5461 // ID - Resource Id 5462 ID *string `json:"id,omitempty"` 5463} 5464 5465// MarshalJSON is the custom marshaler for Route. 5466func (r Route) MarshalJSON() ([]byte, error) { 5467 objectMap := make(map[string]interface{}) 5468 if r.RoutePropertiesFormat != nil { 5469 objectMap["properties"] = r.RoutePropertiesFormat 5470 } 5471 if r.Name != nil { 5472 objectMap["name"] = r.Name 5473 } 5474 if r.Etag != nil { 5475 objectMap["etag"] = r.Etag 5476 } 5477 if r.ID != nil { 5478 objectMap["id"] = r.ID 5479 } 5480 return json.Marshal(objectMap) 5481} 5482 5483// UnmarshalJSON is the custom unmarshaler for Route struct. 5484func (r *Route) UnmarshalJSON(body []byte) error { 5485 var m map[string]*json.RawMessage 5486 err := json.Unmarshal(body, &m) 5487 if err != nil { 5488 return err 5489 } 5490 for k, v := range m { 5491 switch k { 5492 case "properties": 5493 if v != nil { 5494 var routePropertiesFormat RoutePropertiesFormat 5495 err = json.Unmarshal(*v, &routePropertiesFormat) 5496 if err != nil { 5497 return err 5498 } 5499 r.RoutePropertiesFormat = &routePropertiesFormat 5500 } 5501 case "name": 5502 if v != nil { 5503 var name string 5504 err = json.Unmarshal(*v, &name) 5505 if err != nil { 5506 return err 5507 } 5508 r.Name = &name 5509 } 5510 case "etag": 5511 if v != nil { 5512 var etag string 5513 err = json.Unmarshal(*v, &etag) 5514 if err != nil { 5515 return err 5516 } 5517 r.Etag = &etag 5518 } 5519 case "id": 5520 if v != nil { 5521 var ID string 5522 err = json.Unmarshal(*v, &ID) 5523 if err != nil { 5524 return err 5525 } 5526 r.ID = &ID 5527 } 5528 } 5529 } 5530 5531 return nil 5532} 5533 5534// RouteListResult response for ListRoute Api service call 5535type RouteListResult struct { 5536 autorest.Response `json:"-"` 5537 // Value - Gets List of Routes in a resource group 5538 Value *[]Route `json:"value,omitempty"` 5539 // NextLink - Gets the URL to get the next set of results. 5540 NextLink *string `json:"nextLink,omitempty"` 5541} 5542 5543// RouteListResultIterator provides access to a complete listing of Route values. 5544type RouteListResultIterator struct { 5545 i int 5546 page RouteListResultPage 5547} 5548 5549// NextWithContext advances to the next value. If there was an error making 5550// the request the iterator does not advance and the error is returned. 5551func (iter *RouteListResultIterator) NextWithContext(ctx context.Context) (err error) { 5552 if tracing.IsEnabled() { 5553 ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultIterator.NextWithContext") 5554 defer func() { 5555 sc := -1 5556 if iter.Response().Response.Response != nil { 5557 sc = iter.Response().Response.Response.StatusCode 5558 } 5559 tracing.EndSpan(ctx, sc, err) 5560 }() 5561 } 5562 iter.i++ 5563 if iter.i < len(iter.page.Values()) { 5564 return nil 5565 } 5566 err = iter.page.NextWithContext(ctx) 5567 if err != nil { 5568 iter.i-- 5569 return err 5570 } 5571 iter.i = 0 5572 return nil 5573} 5574 5575// Next advances to the next value. If there was an error making 5576// the request the iterator does not advance and the error is returned. 5577// Deprecated: Use NextWithContext() instead. 5578func (iter *RouteListResultIterator) Next() error { 5579 return iter.NextWithContext(context.Background()) 5580} 5581 5582// NotDone returns true if the enumeration should be started or is not yet complete. 5583func (iter RouteListResultIterator) NotDone() bool { 5584 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5585} 5586 5587// Response returns the raw server response from the last page request. 5588func (iter RouteListResultIterator) Response() RouteListResult { 5589 return iter.page.Response() 5590} 5591 5592// Value returns the current value or a zero-initialized value if the 5593// iterator has advanced beyond the end of the collection. 5594func (iter RouteListResultIterator) Value() Route { 5595 if !iter.page.NotDone() { 5596 return Route{} 5597 } 5598 return iter.page.Values()[iter.i] 5599} 5600 5601// Creates a new instance of the RouteListResultIterator type. 5602func NewRouteListResultIterator(page RouteListResultPage) RouteListResultIterator { 5603 return RouteListResultIterator{page: page} 5604} 5605 5606// IsEmpty returns true if the ListResult contains no values. 5607func (rlr RouteListResult) IsEmpty() bool { 5608 return rlr.Value == nil || len(*rlr.Value) == 0 5609} 5610 5611// hasNextLink returns true if the NextLink is not empty. 5612func (rlr RouteListResult) hasNextLink() bool { 5613 return rlr.NextLink != nil && len(*rlr.NextLink) != 0 5614} 5615 5616// routeListResultPreparer prepares a request to retrieve the next set of results. 5617// It returns nil if no more results exist. 5618func (rlr RouteListResult) routeListResultPreparer(ctx context.Context) (*http.Request, error) { 5619 if !rlr.hasNextLink() { 5620 return nil, nil 5621 } 5622 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5623 autorest.AsJSON(), 5624 autorest.AsGet(), 5625 autorest.WithBaseURL(to.String(rlr.NextLink))) 5626} 5627 5628// RouteListResultPage contains a page of Route values. 5629type RouteListResultPage struct { 5630 fn func(context.Context, RouteListResult) (RouteListResult, error) 5631 rlr RouteListResult 5632} 5633 5634// NextWithContext advances to the next page of values. If there was an error making 5635// the request the page does not advance and the error is returned. 5636func (page *RouteListResultPage) NextWithContext(ctx context.Context) (err error) { 5637 if tracing.IsEnabled() { 5638 ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultPage.NextWithContext") 5639 defer func() { 5640 sc := -1 5641 if page.Response().Response.Response != nil { 5642 sc = page.Response().Response.Response.StatusCode 5643 } 5644 tracing.EndSpan(ctx, sc, err) 5645 }() 5646 } 5647 for { 5648 next, err := page.fn(ctx, page.rlr) 5649 if err != nil { 5650 return err 5651 } 5652 page.rlr = next 5653 if !next.hasNextLink() || !next.IsEmpty() { 5654 break 5655 } 5656 } 5657 return nil 5658} 5659 5660// Next advances to the next page of values. If there was an error making 5661// the request the page does not advance and the error is returned. 5662// Deprecated: Use NextWithContext() instead. 5663func (page *RouteListResultPage) Next() error { 5664 return page.NextWithContext(context.Background()) 5665} 5666 5667// NotDone returns true if the page enumeration should be started or is not yet complete. 5668func (page RouteListResultPage) NotDone() bool { 5669 return !page.rlr.IsEmpty() 5670} 5671 5672// Response returns the raw server response from the last page request. 5673func (page RouteListResultPage) Response() RouteListResult { 5674 return page.rlr 5675} 5676 5677// Values returns the slice of values for the current page or nil if there are no values. 5678func (page RouteListResultPage) Values() []Route { 5679 if page.rlr.IsEmpty() { 5680 return nil 5681 } 5682 return *page.rlr.Value 5683} 5684 5685// Creates a new instance of the RouteListResultPage type. 5686func NewRouteListResultPage(cur RouteListResult, getNextPage func(context.Context, RouteListResult) (RouteListResult, error)) RouteListResultPage { 5687 return RouteListResultPage{ 5688 fn: getNextPage, 5689 rlr: cur, 5690 } 5691} 5692 5693// RoutePropertiesFormat route resource 5694type RoutePropertiesFormat struct { 5695 // AddressPrefix - Gets or sets the destination CIDR to which the route applies. 5696 AddressPrefix *string `json:"addressPrefix,omitempty"` 5697 // NextHopType - Gets or sets the type of Azure hop the packet should be sent to. Possible values include: 'RouteNextHopTypeVirtualNetworkGateway', 'RouteNextHopTypeVnetLocal', 'RouteNextHopTypeInternet', 'RouteNextHopTypeVirtualAppliance', 'RouteNextHopTypeNone' 5698 NextHopType RouteNextHopType `json:"nextHopType,omitempty"` 5699 // NextHopIPAddress - Gets or sets the IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. 5700 NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` 5701 // ProvisioningState - Gets or sets Provisioning state of the resource Updating/Deleting/Failed 5702 ProvisioningState *string `json:"provisioningState,omitempty"` 5703} 5704 5705// RoutesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 5706// operation. 5707type RoutesCreateOrUpdateFuture struct { 5708 azure.FutureAPI 5709 // Result returns the result of the asynchronous operation. 5710 // If the operation has not completed it will return an error. 5711 Result func(RoutesClient) (Route, error) 5712} 5713 5714// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5715func (future *RoutesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 5716 var azFuture azure.Future 5717 if err := json.Unmarshal(body, &azFuture); err != nil { 5718 return err 5719 } 5720 future.FutureAPI = &azFuture 5721 future.Result = future.result 5722 return nil 5723} 5724 5725// result is the default implementation for RoutesCreateOrUpdateFuture.Result. 5726func (future *RoutesCreateOrUpdateFuture) result(client RoutesClient) (r Route, err error) { 5727 var done bool 5728 done, err = future.DoneWithContext(context.Background(), client) 5729 if err != nil { 5730 err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 5731 return 5732 } 5733 if !done { 5734 r.Response.Response = future.Response() 5735 err = azure.NewAsyncOpIncompleteError("network.RoutesCreateOrUpdateFuture") 5736 return 5737 } 5738 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5739 if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { 5740 r, err = client.CreateOrUpdateResponder(r.Response.Response) 5741 if err != nil { 5742 err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", r.Response.Response, "Failure responding to request") 5743 } 5744 } 5745 return 5746} 5747 5748// RoutesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 5749type RoutesDeleteFuture struct { 5750 azure.FutureAPI 5751 // Result returns the result of the asynchronous operation. 5752 // If the operation has not completed it will return an error. 5753 Result func(RoutesClient) (autorest.Response, error) 5754} 5755 5756// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5757func (future *RoutesDeleteFuture) UnmarshalJSON(body []byte) error { 5758 var azFuture azure.Future 5759 if err := json.Unmarshal(body, &azFuture); err != nil { 5760 return err 5761 } 5762 future.FutureAPI = &azFuture 5763 future.Result = future.result 5764 return nil 5765} 5766 5767// result is the default implementation for RoutesDeleteFuture.Result. 5768func (future *RoutesDeleteFuture) result(client RoutesClient) (ar autorest.Response, err error) { 5769 var done bool 5770 done, err = future.DoneWithContext(context.Background(), client) 5771 if err != nil { 5772 err = autorest.NewErrorWithError(err, "network.RoutesDeleteFuture", "Result", future.Response(), "Polling failure") 5773 return 5774 } 5775 if !done { 5776 ar.Response = future.Response() 5777 err = azure.NewAsyncOpIncompleteError("network.RoutesDeleteFuture") 5778 return 5779 } 5780 ar.Response = future.Response() 5781 return 5782} 5783 5784// RouteTable routeTable resource 5785type RouteTable struct { 5786 autorest.Response `json:"-"` 5787 *RouteTablePropertiesFormat `json:"properties,omitempty"` 5788 // Etag - Gets a unique read-only string that changes whenever the resource is updated 5789 Etag *string `json:"etag,omitempty"` 5790 // ID - READ-ONLY; Resource Id 5791 ID *string `json:"id,omitempty"` 5792 // Name - READ-ONLY; Resource name 5793 Name *string `json:"name,omitempty"` 5794 // Type - READ-ONLY; Resource type 5795 Type *string `json:"type,omitempty"` 5796 // Location - Resource location 5797 Location *string `json:"location,omitempty"` 5798 // Tags - Resource tags 5799 Tags map[string]*string `json:"tags"` 5800} 5801 5802// MarshalJSON is the custom marshaler for RouteTable. 5803func (rt RouteTable) MarshalJSON() ([]byte, error) { 5804 objectMap := make(map[string]interface{}) 5805 if rt.RouteTablePropertiesFormat != nil { 5806 objectMap["properties"] = rt.RouteTablePropertiesFormat 5807 } 5808 if rt.Etag != nil { 5809 objectMap["etag"] = rt.Etag 5810 } 5811 if rt.Location != nil { 5812 objectMap["location"] = rt.Location 5813 } 5814 if rt.Tags != nil { 5815 objectMap["tags"] = rt.Tags 5816 } 5817 return json.Marshal(objectMap) 5818} 5819 5820// UnmarshalJSON is the custom unmarshaler for RouteTable struct. 5821func (rt *RouteTable) UnmarshalJSON(body []byte) error { 5822 var m map[string]*json.RawMessage 5823 err := json.Unmarshal(body, &m) 5824 if err != nil { 5825 return err 5826 } 5827 for k, v := range m { 5828 switch k { 5829 case "properties": 5830 if v != nil { 5831 var routeTablePropertiesFormat RouteTablePropertiesFormat 5832 err = json.Unmarshal(*v, &routeTablePropertiesFormat) 5833 if err != nil { 5834 return err 5835 } 5836 rt.RouteTablePropertiesFormat = &routeTablePropertiesFormat 5837 } 5838 case "etag": 5839 if v != nil { 5840 var etag string 5841 err = json.Unmarshal(*v, &etag) 5842 if err != nil { 5843 return err 5844 } 5845 rt.Etag = &etag 5846 } 5847 case "id": 5848 if v != nil { 5849 var ID string 5850 err = json.Unmarshal(*v, &ID) 5851 if err != nil { 5852 return err 5853 } 5854 rt.ID = &ID 5855 } 5856 case "name": 5857 if v != nil { 5858 var name string 5859 err = json.Unmarshal(*v, &name) 5860 if err != nil { 5861 return err 5862 } 5863 rt.Name = &name 5864 } 5865 case "type": 5866 if v != nil { 5867 var typeVar string 5868 err = json.Unmarshal(*v, &typeVar) 5869 if err != nil { 5870 return err 5871 } 5872 rt.Type = &typeVar 5873 } 5874 case "location": 5875 if v != nil { 5876 var location string 5877 err = json.Unmarshal(*v, &location) 5878 if err != nil { 5879 return err 5880 } 5881 rt.Location = &location 5882 } 5883 case "tags": 5884 if v != nil { 5885 var tags map[string]*string 5886 err = json.Unmarshal(*v, &tags) 5887 if err != nil { 5888 return err 5889 } 5890 rt.Tags = tags 5891 } 5892 } 5893 } 5894 5895 return nil 5896} 5897 5898// RouteTableListResult response for ListRouteTable Api service call 5899type RouteTableListResult struct { 5900 autorest.Response `json:"-"` 5901 // Value - Gets List of RouteTables in a resource group 5902 Value *[]RouteTable `json:"value,omitempty"` 5903 // NextLink - Gets the URL to get the next set of results. 5904 NextLink *string `json:"nextLink,omitempty"` 5905} 5906 5907// RouteTableListResultIterator provides access to a complete listing of RouteTable values. 5908type RouteTableListResultIterator struct { 5909 i int 5910 page RouteTableListResultPage 5911} 5912 5913// NextWithContext advances to the next value. If there was an error making 5914// the request the iterator does not advance and the error is returned. 5915func (iter *RouteTableListResultIterator) NextWithContext(ctx context.Context) (err error) { 5916 if tracing.IsEnabled() { 5917 ctx = tracing.StartSpan(ctx, fqdn+"/RouteTableListResultIterator.NextWithContext") 5918 defer func() { 5919 sc := -1 5920 if iter.Response().Response.Response != nil { 5921 sc = iter.Response().Response.Response.StatusCode 5922 } 5923 tracing.EndSpan(ctx, sc, err) 5924 }() 5925 } 5926 iter.i++ 5927 if iter.i < len(iter.page.Values()) { 5928 return nil 5929 } 5930 err = iter.page.NextWithContext(ctx) 5931 if err != nil { 5932 iter.i-- 5933 return err 5934 } 5935 iter.i = 0 5936 return nil 5937} 5938 5939// Next advances to the next value. If there was an error making 5940// the request the iterator does not advance and the error is returned. 5941// Deprecated: Use NextWithContext() instead. 5942func (iter *RouteTableListResultIterator) Next() error { 5943 return iter.NextWithContext(context.Background()) 5944} 5945 5946// NotDone returns true if the enumeration should be started or is not yet complete. 5947func (iter RouteTableListResultIterator) NotDone() bool { 5948 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5949} 5950 5951// Response returns the raw server response from the last page request. 5952func (iter RouteTableListResultIterator) Response() RouteTableListResult { 5953 return iter.page.Response() 5954} 5955 5956// Value returns the current value or a zero-initialized value if the 5957// iterator has advanced beyond the end of the collection. 5958func (iter RouteTableListResultIterator) Value() RouteTable { 5959 if !iter.page.NotDone() { 5960 return RouteTable{} 5961 } 5962 return iter.page.Values()[iter.i] 5963} 5964 5965// Creates a new instance of the RouteTableListResultIterator type. 5966func NewRouteTableListResultIterator(page RouteTableListResultPage) RouteTableListResultIterator { 5967 return RouteTableListResultIterator{page: page} 5968} 5969 5970// IsEmpty returns true if the ListResult contains no values. 5971func (rtlr RouteTableListResult) IsEmpty() bool { 5972 return rtlr.Value == nil || len(*rtlr.Value) == 0 5973} 5974 5975// hasNextLink returns true if the NextLink is not empty. 5976func (rtlr RouteTableListResult) hasNextLink() bool { 5977 return rtlr.NextLink != nil && len(*rtlr.NextLink) != 0 5978} 5979 5980// routeTableListResultPreparer prepares a request to retrieve the next set of results. 5981// It returns nil if no more results exist. 5982func (rtlr RouteTableListResult) routeTableListResultPreparer(ctx context.Context) (*http.Request, error) { 5983 if !rtlr.hasNextLink() { 5984 return nil, nil 5985 } 5986 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5987 autorest.AsJSON(), 5988 autorest.AsGet(), 5989 autorest.WithBaseURL(to.String(rtlr.NextLink))) 5990} 5991 5992// RouteTableListResultPage contains a page of RouteTable values. 5993type RouteTableListResultPage struct { 5994 fn func(context.Context, RouteTableListResult) (RouteTableListResult, error) 5995 rtlr RouteTableListResult 5996} 5997 5998// NextWithContext advances to the next page of values. If there was an error making 5999// the request the page does not advance and the error is returned. 6000func (page *RouteTableListResultPage) NextWithContext(ctx context.Context) (err error) { 6001 if tracing.IsEnabled() { 6002 ctx = tracing.StartSpan(ctx, fqdn+"/RouteTableListResultPage.NextWithContext") 6003 defer func() { 6004 sc := -1 6005 if page.Response().Response.Response != nil { 6006 sc = page.Response().Response.Response.StatusCode 6007 } 6008 tracing.EndSpan(ctx, sc, err) 6009 }() 6010 } 6011 for { 6012 next, err := page.fn(ctx, page.rtlr) 6013 if err != nil { 6014 return err 6015 } 6016 page.rtlr = next 6017 if !next.hasNextLink() || !next.IsEmpty() { 6018 break 6019 } 6020 } 6021 return nil 6022} 6023 6024// Next advances to the next page of values. If there was an error making 6025// the request the page does not advance and the error is returned. 6026// Deprecated: Use NextWithContext() instead. 6027func (page *RouteTableListResultPage) Next() error { 6028 return page.NextWithContext(context.Background()) 6029} 6030 6031// NotDone returns true if the page enumeration should be started or is not yet complete. 6032func (page RouteTableListResultPage) NotDone() bool { 6033 return !page.rtlr.IsEmpty() 6034} 6035 6036// Response returns the raw server response from the last page request. 6037func (page RouteTableListResultPage) Response() RouteTableListResult { 6038 return page.rtlr 6039} 6040 6041// Values returns the slice of values for the current page or nil if there are no values. 6042func (page RouteTableListResultPage) Values() []RouteTable { 6043 if page.rtlr.IsEmpty() { 6044 return nil 6045 } 6046 return *page.rtlr.Value 6047} 6048 6049// Creates a new instance of the RouteTableListResultPage type. 6050func NewRouteTableListResultPage(cur RouteTableListResult, getNextPage func(context.Context, RouteTableListResult) (RouteTableListResult, error)) RouteTableListResultPage { 6051 return RouteTableListResultPage{ 6052 fn: getNextPage, 6053 rtlr: cur, 6054 } 6055} 6056 6057// RouteTablePropertiesFormat route Table resource 6058type RouteTablePropertiesFormat struct { 6059 // Routes - Gets or sets Routes in a Route Table 6060 Routes *[]Route `json:"routes,omitempty"` 6061 // Subnets - Gets collection of references to subnets 6062 Subnets *[]SubResource `json:"subnets,omitempty"` 6063 // ProvisioningState - Gets or sets Provisioning state of the resource Updating/Deleting/Failed 6064 ProvisioningState *string `json:"provisioningState,omitempty"` 6065} 6066 6067// RouteTablesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 6068// long-running operation. 6069type RouteTablesCreateOrUpdateFuture struct { 6070 azure.FutureAPI 6071 // Result returns the result of the asynchronous operation. 6072 // If the operation has not completed it will return an error. 6073 Result func(RouteTablesClient) (RouteTable, error) 6074} 6075 6076// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6077func (future *RouteTablesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 6078 var azFuture azure.Future 6079 if err := json.Unmarshal(body, &azFuture); err != nil { 6080 return err 6081 } 6082 future.FutureAPI = &azFuture 6083 future.Result = future.result 6084 return nil 6085} 6086 6087// result is the default implementation for RouteTablesCreateOrUpdateFuture.Result. 6088func (future *RouteTablesCreateOrUpdateFuture) result(client RouteTablesClient) (rt RouteTable, err error) { 6089 var done bool 6090 done, err = future.DoneWithContext(context.Background(), client) 6091 if err != nil { 6092 err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 6093 return 6094 } 6095 if !done { 6096 rt.Response.Response = future.Response() 6097 err = azure.NewAsyncOpIncompleteError("network.RouteTablesCreateOrUpdateFuture") 6098 return 6099 } 6100 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6101 if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { 6102 rt, err = client.CreateOrUpdateResponder(rt.Response.Response) 6103 if err != nil { 6104 err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", rt.Response.Response, "Failure responding to request") 6105 } 6106 } 6107 return 6108} 6109 6110// RouteTablesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 6111// operation. 6112type RouteTablesDeleteFuture struct { 6113 azure.FutureAPI 6114 // Result returns the result of the asynchronous operation. 6115 // If the operation has not completed it will return an error. 6116 Result func(RouteTablesClient) (autorest.Response, error) 6117} 6118 6119// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6120func (future *RouteTablesDeleteFuture) UnmarshalJSON(body []byte) error { 6121 var azFuture azure.Future 6122 if err := json.Unmarshal(body, &azFuture); err != nil { 6123 return err 6124 } 6125 future.FutureAPI = &azFuture 6126 future.Result = future.result 6127 return nil 6128} 6129 6130// result is the default implementation for RouteTablesDeleteFuture.Result. 6131func (future *RouteTablesDeleteFuture) result(client RouteTablesClient) (ar autorest.Response, err error) { 6132 var done bool 6133 done, err = future.DoneWithContext(context.Background(), client) 6134 if err != nil { 6135 err = autorest.NewErrorWithError(err, "network.RouteTablesDeleteFuture", "Result", future.Response(), "Polling failure") 6136 return 6137 } 6138 if !done { 6139 ar.Response = future.Response() 6140 err = azure.NewAsyncOpIncompleteError("network.RouteTablesDeleteFuture") 6141 return 6142 } 6143 ar.Response = future.Response() 6144 return 6145} 6146 6147// SecurityGroup networkSecurityGroup resource 6148type SecurityGroup struct { 6149 autorest.Response `json:"-"` 6150 *SecurityGroupPropertiesFormat `json:"properties,omitempty"` 6151 // Etag - Gets a unique read-only string that changes whenever the resource is updated 6152 Etag *string `json:"etag,omitempty"` 6153 // ID - READ-ONLY; Resource Id 6154 ID *string `json:"id,omitempty"` 6155 // Name - READ-ONLY; Resource name 6156 Name *string `json:"name,omitempty"` 6157 // Type - READ-ONLY; Resource type 6158 Type *string `json:"type,omitempty"` 6159 // Location - Resource location 6160 Location *string `json:"location,omitempty"` 6161 // Tags - Resource tags 6162 Tags map[string]*string `json:"tags"` 6163} 6164 6165// MarshalJSON is the custom marshaler for SecurityGroup. 6166func (sg SecurityGroup) MarshalJSON() ([]byte, error) { 6167 objectMap := make(map[string]interface{}) 6168 if sg.SecurityGroupPropertiesFormat != nil { 6169 objectMap["properties"] = sg.SecurityGroupPropertiesFormat 6170 } 6171 if sg.Etag != nil { 6172 objectMap["etag"] = sg.Etag 6173 } 6174 if sg.Location != nil { 6175 objectMap["location"] = sg.Location 6176 } 6177 if sg.Tags != nil { 6178 objectMap["tags"] = sg.Tags 6179 } 6180 return json.Marshal(objectMap) 6181} 6182 6183// UnmarshalJSON is the custom unmarshaler for SecurityGroup struct. 6184func (sg *SecurityGroup) UnmarshalJSON(body []byte) error { 6185 var m map[string]*json.RawMessage 6186 err := json.Unmarshal(body, &m) 6187 if err != nil { 6188 return err 6189 } 6190 for k, v := range m { 6191 switch k { 6192 case "properties": 6193 if v != nil { 6194 var securityGroupPropertiesFormat SecurityGroupPropertiesFormat 6195 err = json.Unmarshal(*v, &securityGroupPropertiesFormat) 6196 if err != nil { 6197 return err 6198 } 6199 sg.SecurityGroupPropertiesFormat = &securityGroupPropertiesFormat 6200 } 6201 case "etag": 6202 if v != nil { 6203 var etag string 6204 err = json.Unmarshal(*v, &etag) 6205 if err != nil { 6206 return err 6207 } 6208 sg.Etag = &etag 6209 } 6210 case "id": 6211 if v != nil { 6212 var ID string 6213 err = json.Unmarshal(*v, &ID) 6214 if err != nil { 6215 return err 6216 } 6217 sg.ID = &ID 6218 } 6219 case "name": 6220 if v != nil { 6221 var name string 6222 err = json.Unmarshal(*v, &name) 6223 if err != nil { 6224 return err 6225 } 6226 sg.Name = &name 6227 } 6228 case "type": 6229 if v != nil { 6230 var typeVar string 6231 err = json.Unmarshal(*v, &typeVar) 6232 if err != nil { 6233 return err 6234 } 6235 sg.Type = &typeVar 6236 } 6237 case "location": 6238 if v != nil { 6239 var location string 6240 err = json.Unmarshal(*v, &location) 6241 if err != nil { 6242 return err 6243 } 6244 sg.Location = &location 6245 } 6246 case "tags": 6247 if v != nil { 6248 var tags map[string]*string 6249 err = json.Unmarshal(*v, &tags) 6250 if err != nil { 6251 return err 6252 } 6253 sg.Tags = tags 6254 } 6255 } 6256 } 6257 6258 return nil 6259} 6260 6261// SecurityGroupListResult response for ListNetworkSecurityGroups Api service call 6262type SecurityGroupListResult struct { 6263 autorest.Response `json:"-"` 6264 // Value - Gets List of NetworkSecurityGroups in a resource group 6265 Value *[]SecurityGroup `json:"value,omitempty"` 6266 // NextLink - Gets the URL to get the next set of results. 6267 NextLink *string `json:"nextLink,omitempty"` 6268} 6269 6270// SecurityGroupListResultIterator provides access to a complete listing of SecurityGroup values. 6271type SecurityGroupListResultIterator struct { 6272 i int 6273 page SecurityGroupListResultPage 6274} 6275 6276// NextWithContext advances to the next value. If there was an error making 6277// the request the iterator does not advance and the error is returned. 6278func (iter *SecurityGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { 6279 if tracing.IsEnabled() { 6280 ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupListResultIterator.NextWithContext") 6281 defer func() { 6282 sc := -1 6283 if iter.Response().Response.Response != nil { 6284 sc = iter.Response().Response.Response.StatusCode 6285 } 6286 tracing.EndSpan(ctx, sc, err) 6287 }() 6288 } 6289 iter.i++ 6290 if iter.i < len(iter.page.Values()) { 6291 return nil 6292 } 6293 err = iter.page.NextWithContext(ctx) 6294 if err != nil { 6295 iter.i-- 6296 return err 6297 } 6298 iter.i = 0 6299 return nil 6300} 6301 6302// Next advances to the next value. If there was an error making 6303// the request the iterator does not advance and the error is returned. 6304// Deprecated: Use NextWithContext() instead. 6305func (iter *SecurityGroupListResultIterator) Next() error { 6306 return iter.NextWithContext(context.Background()) 6307} 6308 6309// NotDone returns true if the enumeration should be started or is not yet complete. 6310func (iter SecurityGroupListResultIterator) NotDone() bool { 6311 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6312} 6313 6314// Response returns the raw server response from the last page request. 6315func (iter SecurityGroupListResultIterator) Response() SecurityGroupListResult { 6316 return iter.page.Response() 6317} 6318 6319// Value returns the current value or a zero-initialized value if the 6320// iterator has advanced beyond the end of the collection. 6321func (iter SecurityGroupListResultIterator) Value() SecurityGroup { 6322 if !iter.page.NotDone() { 6323 return SecurityGroup{} 6324 } 6325 return iter.page.Values()[iter.i] 6326} 6327 6328// Creates a new instance of the SecurityGroupListResultIterator type. 6329func NewSecurityGroupListResultIterator(page SecurityGroupListResultPage) SecurityGroupListResultIterator { 6330 return SecurityGroupListResultIterator{page: page} 6331} 6332 6333// IsEmpty returns true if the ListResult contains no values. 6334func (sglr SecurityGroupListResult) IsEmpty() bool { 6335 return sglr.Value == nil || len(*sglr.Value) == 0 6336} 6337 6338// hasNextLink returns true if the NextLink is not empty. 6339func (sglr SecurityGroupListResult) hasNextLink() bool { 6340 return sglr.NextLink != nil && len(*sglr.NextLink) != 0 6341} 6342 6343// securityGroupListResultPreparer prepares a request to retrieve the next set of results. 6344// It returns nil if no more results exist. 6345func (sglr SecurityGroupListResult) securityGroupListResultPreparer(ctx context.Context) (*http.Request, error) { 6346 if !sglr.hasNextLink() { 6347 return nil, nil 6348 } 6349 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6350 autorest.AsJSON(), 6351 autorest.AsGet(), 6352 autorest.WithBaseURL(to.String(sglr.NextLink))) 6353} 6354 6355// SecurityGroupListResultPage contains a page of SecurityGroup values. 6356type SecurityGroupListResultPage struct { 6357 fn func(context.Context, SecurityGroupListResult) (SecurityGroupListResult, error) 6358 sglr SecurityGroupListResult 6359} 6360 6361// NextWithContext advances to the next page of values. If there was an error making 6362// the request the page does not advance and the error is returned. 6363func (page *SecurityGroupListResultPage) NextWithContext(ctx context.Context) (err error) { 6364 if tracing.IsEnabled() { 6365 ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupListResultPage.NextWithContext") 6366 defer func() { 6367 sc := -1 6368 if page.Response().Response.Response != nil { 6369 sc = page.Response().Response.Response.StatusCode 6370 } 6371 tracing.EndSpan(ctx, sc, err) 6372 }() 6373 } 6374 for { 6375 next, err := page.fn(ctx, page.sglr) 6376 if err != nil { 6377 return err 6378 } 6379 page.sglr = next 6380 if !next.hasNextLink() || !next.IsEmpty() { 6381 break 6382 } 6383 } 6384 return nil 6385} 6386 6387// Next advances to the next page of values. If there was an error making 6388// the request the page does not advance and the error is returned. 6389// Deprecated: Use NextWithContext() instead. 6390func (page *SecurityGroupListResultPage) Next() error { 6391 return page.NextWithContext(context.Background()) 6392} 6393 6394// NotDone returns true if the page enumeration should be started or is not yet complete. 6395func (page SecurityGroupListResultPage) NotDone() bool { 6396 return !page.sglr.IsEmpty() 6397} 6398 6399// Response returns the raw server response from the last page request. 6400func (page SecurityGroupListResultPage) Response() SecurityGroupListResult { 6401 return page.sglr 6402} 6403 6404// Values returns the slice of values for the current page or nil if there are no values. 6405func (page SecurityGroupListResultPage) Values() []SecurityGroup { 6406 if page.sglr.IsEmpty() { 6407 return nil 6408 } 6409 return *page.sglr.Value 6410} 6411 6412// Creates a new instance of the SecurityGroupListResultPage type. 6413func NewSecurityGroupListResultPage(cur SecurityGroupListResult, getNextPage func(context.Context, SecurityGroupListResult) (SecurityGroupListResult, error)) SecurityGroupListResultPage { 6414 return SecurityGroupListResultPage{ 6415 fn: getNextPage, 6416 sglr: cur, 6417 } 6418} 6419 6420// SecurityGroupPropertiesFormat network Security Group resource 6421type SecurityGroupPropertiesFormat struct { 6422 // SecurityRules - Gets or sets Security rules of network security group 6423 SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` 6424 // DefaultSecurityRules - Gets or sets Default security rules of network security group 6425 DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` 6426 // NetworkInterfaces - Gets collection of references to Network Interfaces 6427 NetworkInterfaces *[]SubResource `json:"networkInterfaces,omitempty"` 6428 // Subnets - Gets collection of references to subnets 6429 Subnets *[]SubResource `json:"subnets,omitempty"` 6430 // ResourceGUID - Gets or sets resource guid property of the network security group resource 6431 ResourceGUID *string `json:"resourceGuid,omitempty"` 6432 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 6433 ProvisioningState *string `json:"provisioningState,omitempty"` 6434} 6435 6436// SecurityGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 6437// long-running operation. 6438type SecurityGroupsCreateOrUpdateFuture struct { 6439 azure.FutureAPI 6440 // Result returns the result of the asynchronous operation. 6441 // If the operation has not completed it will return an error. 6442 Result func(SecurityGroupsClient) (SecurityGroup, error) 6443} 6444 6445// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6446func (future *SecurityGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 6447 var azFuture azure.Future 6448 if err := json.Unmarshal(body, &azFuture); err != nil { 6449 return err 6450 } 6451 future.FutureAPI = &azFuture 6452 future.Result = future.result 6453 return nil 6454} 6455 6456// result is the default implementation for SecurityGroupsCreateOrUpdateFuture.Result. 6457func (future *SecurityGroupsCreateOrUpdateFuture) result(client SecurityGroupsClient) (sg SecurityGroup, err error) { 6458 var done bool 6459 done, err = future.DoneWithContext(context.Background(), client) 6460 if err != nil { 6461 err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 6462 return 6463 } 6464 if !done { 6465 sg.Response.Response = future.Response() 6466 err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsCreateOrUpdateFuture") 6467 return 6468 } 6469 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6470 if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { 6471 sg, err = client.CreateOrUpdateResponder(sg.Response.Response) 6472 if err != nil { 6473 err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") 6474 } 6475 } 6476 return 6477} 6478 6479// SecurityGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 6480// operation. 6481type SecurityGroupsDeleteFuture struct { 6482 azure.FutureAPI 6483 // Result returns the result of the asynchronous operation. 6484 // If the operation has not completed it will return an error. 6485 Result func(SecurityGroupsClient) (autorest.Response, error) 6486} 6487 6488// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6489func (future *SecurityGroupsDeleteFuture) UnmarshalJSON(body []byte) error { 6490 var azFuture azure.Future 6491 if err := json.Unmarshal(body, &azFuture); err != nil { 6492 return err 6493 } 6494 future.FutureAPI = &azFuture 6495 future.Result = future.result 6496 return nil 6497} 6498 6499// result is the default implementation for SecurityGroupsDeleteFuture.Result. 6500func (future *SecurityGroupsDeleteFuture) result(client SecurityGroupsClient) (ar autorest.Response, err error) { 6501 var done bool 6502 done, err = future.DoneWithContext(context.Background(), client) 6503 if err != nil { 6504 err = autorest.NewErrorWithError(err, "network.SecurityGroupsDeleteFuture", "Result", future.Response(), "Polling failure") 6505 return 6506 } 6507 if !done { 6508 ar.Response = future.Response() 6509 err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsDeleteFuture") 6510 return 6511 } 6512 ar.Response = future.Response() 6513 return 6514} 6515 6516// SecurityRule network security rule 6517type SecurityRule struct { 6518 autorest.Response `json:"-"` 6519 *SecurityRulePropertiesFormat `json:"properties,omitempty"` 6520 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 6521 Name *string `json:"name,omitempty"` 6522 // Etag - A unique read-only string that changes whenever the resource is updated 6523 Etag *string `json:"etag,omitempty"` 6524 // ID - Resource Id 6525 ID *string `json:"id,omitempty"` 6526} 6527 6528// MarshalJSON is the custom marshaler for SecurityRule. 6529func (sr SecurityRule) MarshalJSON() ([]byte, error) { 6530 objectMap := make(map[string]interface{}) 6531 if sr.SecurityRulePropertiesFormat != nil { 6532 objectMap["properties"] = sr.SecurityRulePropertiesFormat 6533 } 6534 if sr.Name != nil { 6535 objectMap["name"] = sr.Name 6536 } 6537 if sr.Etag != nil { 6538 objectMap["etag"] = sr.Etag 6539 } 6540 if sr.ID != nil { 6541 objectMap["id"] = sr.ID 6542 } 6543 return json.Marshal(objectMap) 6544} 6545 6546// UnmarshalJSON is the custom unmarshaler for SecurityRule struct. 6547func (sr *SecurityRule) UnmarshalJSON(body []byte) error { 6548 var m map[string]*json.RawMessage 6549 err := json.Unmarshal(body, &m) 6550 if err != nil { 6551 return err 6552 } 6553 for k, v := range m { 6554 switch k { 6555 case "properties": 6556 if v != nil { 6557 var securityRulePropertiesFormat SecurityRulePropertiesFormat 6558 err = json.Unmarshal(*v, &securityRulePropertiesFormat) 6559 if err != nil { 6560 return err 6561 } 6562 sr.SecurityRulePropertiesFormat = &securityRulePropertiesFormat 6563 } 6564 case "name": 6565 if v != nil { 6566 var name string 6567 err = json.Unmarshal(*v, &name) 6568 if err != nil { 6569 return err 6570 } 6571 sr.Name = &name 6572 } 6573 case "etag": 6574 if v != nil { 6575 var etag string 6576 err = json.Unmarshal(*v, &etag) 6577 if err != nil { 6578 return err 6579 } 6580 sr.Etag = &etag 6581 } 6582 case "id": 6583 if v != nil { 6584 var ID string 6585 err = json.Unmarshal(*v, &ID) 6586 if err != nil { 6587 return err 6588 } 6589 sr.ID = &ID 6590 } 6591 } 6592 } 6593 6594 return nil 6595} 6596 6597// SecurityRuleListResult response for ListSecurityRule Api service callRetrieves all security rules that 6598// belongs to a network security group 6599type SecurityRuleListResult struct { 6600 autorest.Response `json:"-"` 6601 // Value - Gets security rules in a network security group 6602 Value *[]SecurityRule `json:"value,omitempty"` 6603 // NextLink - Gets the URL to get the next set of results. 6604 NextLink *string `json:"nextLink,omitempty"` 6605} 6606 6607// SecurityRuleListResultIterator provides access to a complete listing of SecurityRule values. 6608type SecurityRuleListResultIterator struct { 6609 i int 6610 page SecurityRuleListResultPage 6611} 6612 6613// NextWithContext advances to the next value. If there was an error making 6614// the request the iterator does not advance and the error is returned. 6615func (iter *SecurityRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { 6616 if tracing.IsEnabled() { 6617 ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRuleListResultIterator.NextWithContext") 6618 defer func() { 6619 sc := -1 6620 if iter.Response().Response.Response != nil { 6621 sc = iter.Response().Response.Response.StatusCode 6622 } 6623 tracing.EndSpan(ctx, sc, err) 6624 }() 6625 } 6626 iter.i++ 6627 if iter.i < len(iter.page.Values()) { 6628 return nil 6629 } 6630 err = iter.page.NextWithContext(ctx) 6631 if err != nil { 6632 iter.i-- 6633 return err 6634 } 6635 iter.i = 0 6636 return nil 6637} 6638 6639// Next advances to the next value. If there was an error making 6640// the request the iterator does not advance and the error is returned. 6641// Deprecated: Use NextWithContext() instead. 6642func (iter *SecurityRuleListResultIterator) Next() error { 6643 return iter.NextWithContext(context.Background()) 6644} 6645 6646// NotDone returns true if the enumeration should be started or is not yet complete. 6647func (iter SecurityRuleListResultIterator) NotDone() bool { 6648 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6649} 6650 6651// Response returns the raw server response from the last page request. 6652func (iter SecurityRuleListResultIterator) Response() SecurityRuleListResult { 6653 return iter.page.Response() 6654} 6655 6656// Value returns the current value or a zero-initialized value if the 6657// iterator has advanced beyond the end of the collection. 6658func (iter SecurityRuleListResultIterator) Value() SecurityRule { 6659 if !iter.page.NotDone() { 6660 return SecurityRule{} 6661 } 6662 return iter.page.Values()[iter.i] 6663} 6664 6665// Creates a new instance of the SecurityRuleListResultIterator type. 6666func NewSecurityRuleListResultIterator(page SecurityRuleListResultPage) SecurityRuleListResultIterator { 6667 return SecurityRuleListResultIterator{page: page} 6668} 6669 6670// IsEmpty returns true if the ListResult contains no values. 6671func (srlr SecurityRuleListResult) IsEmpty() bool { 6672 return srlr.Value == nil || len(*srlr.Value) == 0 6673} 6674 6675// hasNextLink returns true if the NextLink is not empty. 6676func (srlr SecurityRuleListResult) hasNextLink() bool { 6677 return srlr.NextLink != nil && len(*srlr.NextLink) != 0 6678} 6679 6680// securityRuleListResultPreparer prepares a request to retrieve the next set of results. 6681// It returns nil if no more results exist. 6682func (srlr SecurityRuleListResult) securityRuleListResultPreparer(ctx context.Context) (*http.Request, error) { 6683 if !srlr.hasNextLink() { 6684 return nil, nil 6685 } 6686 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6687 autorest.AsJSON(), 6688 autorest.AsGet(), 6689 autorest.WithBaseURL(to.String(srlr.NextLink))) 6690} 6691 6692// SecurityRuleListResultPage contains a page of SecurityRule values. 6693type SecurityRuleListResultPage struct { 6694 fn func(context.Context, SecurityRuleListResult) (SecurityRuleListResult, error) 6695 srlr SecurityRuleListResult 6696} 6697 6698// NextWithContext advances to the next page of values. If there was an error making 6699// the request the page does not advance and the error is returned. 6700func (page *SecurityRuleListResultPage) NextWithContext(ctx context.Context) (err error) { 6701 if tracing.IsEnabled() { 6702 ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRuleListResultPage.NextWithContext") 6703 defer func() { 6704 sc := -1 6705 if page.Response().Response.Response != nil { 6706 sc = page.Response().Response.Response.StatusCode 6707 } 6708 tracing.EndSpan(ctx, sc, err) 6709 }() 6710 } 6711 for { 6712 next, err := page.fn(ctx, page.srlr) 6713 if err != nil { 6714 return err 6715 } 6716 page.srlr = next 6717 if !next.hasNextLink() || !next.IsEmpty() { 6718 break 6719 } 6720 } 6721 return nil 6722} 6723 6724// Next advances to the next page of values. If there was an error making 6725// the request the page does not advance and the error is returned. 6726// Deprecated: Use NextWithContext() instead. 6727func (page *SecurityRuleListResultPage) Next() error { 6728 return page.NextWithContext(context.Background()) 6729} 6730 6731// NotDone returns true if the page enumeration should be started or is not yet complete. 6732func (page SecurityRuleListResultPage) NotDone() bool { 6733 return !page.srlr.IsEmpty() 6734} 6735 6736// Response returns the raw server response from the last page request. 6737func (page SecurityRuleListResultPage) Response() SecurityRuleListResult { 6738 return page.srlr 6739} 6740 6741// Values returns the slice of values for the current page or nil if there are no values. 6742func (page SecurityRuleListResultPage) Values() []SecurityRule { 6743 if page.srlr.IsEmpty() { 6744 return nil 6745 } 6746 return *page.srlr.Value 6747} 6748 6749// Creates a new instance of the SecurityRuleListResultPage type. 6750func NewSecurityRuleListResultPage(cur SecurityRuleListResult, getNextPage func(context.Context, SecurityRuleListResult) (SecurityRuleListResult, error)) SecurityRuleListResultPage { 6751 return SecurityRuleListResultPage{ 6752 fn: getNextPage, 6753 srlr: cur, 6754 } 6755} 6756 6757// SecurityRulePropertiesFormat ... 6758type SecurityRulePropertiesFormat struct { 6759 // Description - Gets or sets a description for this rule. Restricted to 140 chars. 6760 Description *string `json:"description,omitempty"` 6761 // Protocol - Gets or sets Network protocol this rule applies to. Can be Tcp, Udp or All(*). Possible values include: 'TCP', 'UDP', 'Asterisk' 6762 Protocol SecurityRuleProtocol `json:"protocol,omitempty"` 6763 // SourcePortRange - Gets or sets Source Port or Range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. 6764 SourcePortRange *string `json:"sourcePortRange,omitempty"` 6765 // DestinationPortRange - Gets or sets Destination Port or Range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. 6766 DestinationPortRange *string `json:"destinationPortRange,omitempty"` 6767 // SourceAddressPrefix - Gets or sets source address prefix. CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. 6768 SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` 6769 // DestinationAddressPrefix - Gets or sets destination address prefix. CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. 6770 DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` 6771 // Access - Gets or sets network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'. Possible values include: 'Allow', 'Deny' 6772 Access SecurityRuleAccess `json:"access,omitempty"` 6773 // Priority - Gets or sets the priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. 6774 Priority *int32 `json:"priority,omitempty"` 6775 // Direction - Gets or sets the direction of the rule.InBound or Outbound. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values include: 'Inbound', 'Outbound' 6776 Direction SecurityRuleDirection `json:"direction,omitempty"` 6777 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 6778 ProvisioningState *string `json:"provisioningState,omitempty"` 6779} 6780 6781// SecurityRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 6782// long-running operation. 6783type SecurityRulesCreateOrUpdateFuture struct { 6784 azure.FutureAPI 6785 // Result returns the result of the asynchronous operation. 6786 // If the operation has not completed it will return an error. 6787 Result func(SecurityRulesClient) (SecurityRule, error) 6788} 6789 6790// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6791func (future *SecurityRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 6792 var azFuture azure.Future 6793 if err := json.Unmarshal(body, &azFuture); err != nil { 6794 return err 6795 } 6796 future.FutureAPI = &azFuture 6797 future.Result = future.result 6798 return nil 6799} 6800 6801// result is the default implementation for SecurityRulesCreateOrUpdateFuture.Result. 6802func (future *SecurityRulesCreateOrUpdateFuture) result(client SecurityRulesClient) (sr SecurityRule, err error) { 6803 var done bool 6804 done, err = future.DoneWithContext(context.Background(), client) 6805 if err != nil { 6806 err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 6807 return 6808 } 6809 if !done { 6810 sr.Response.Response = future.Response() 6811 err = azure.NewAsyncOpIncompleteError("network.SecurityRulesCreateOrUpdateFuture") 6812 return 6813 } 6814 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6815 if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { 6816 sr, err = client.CreateOrUpdateResponder(sr.Response.Response) 6817 if err != nil { 6818 err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") 6819 } 6820 } 6821 return 6822} 6823 6824// SecurityRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 6825// operation. 6826type SecurityRulesDeleteFuture struct { 6827 azure.FutureAPI 6828 // Result returns the result of the asynchronous operation. 6829 // If the operation has not completed it will return an error. 6830 Result func(SecurityRulesClient) (autorest.Response, error) 6831} 6832 6833// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6834func (future *SecurityRulesDeleteFuture) UnmarshalJSON(body []byte) error { 6835 var azFuture azure.Future 6836 if err := json.Unmarshal(body, &azFuture); err != nil { 6837 return err 6838 } 6839 future.FutureAPI = &azFuture 6840 future.Result = future.result 6841 return nil 6842} 6843 6844// result is the default implementation for SecurityRulesDeleteFuture.Result. 6845func (future *SecurityRulesDeleteFuture) result(client SecurityRulesClient) (ar autorest.Response, err error) { 6846 var done bool 6847 done, err = future.DoneWithContext(context.Background(), client) 6848 if err != nil { 6849 err = autorest.NewErrorWithError(err, "network.SecurityRulesDeleteFuture", "Result", future.Response(), "Polling failure") 6850 return 6851 } 6852 if !done { 6853 ar.Response = future.Response() 6854 err = azure.NewAsyncOpIncompleteError("network.SecurityRulesDeleteFuture") 6855 return 6856 } 6857 ar.Response = future.Response() 6858 return 6859} 6860 6861// Subnet subnet in a VirtualNetwork resource 6862type Subnet struct { 6863 autorest.Response `json:"-"` 6864 *SubnetPropertiesFormat `json:"properties,omitempty"` 6865 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 6866 Name *string `json:"name,omitempty"` 6867 // Etag - A unique read-only string that changes whenever the resource is updated 6868 Etag *string `json:"etag,omitempty"` 6869 // ID - Resource Id 6870 ID *string `json:"id,omitempty"` 6871} 6872 6873// MarshalJSON is the custom marshaler for Subnet. 6874func (s Subnet) MarshalJSON() ([]byte, error) { 6875 objectMap := make(map[string]interface{}) 6876 if s.SubnetPropertiesFormat != nil { 6877 objectMap["properties"] = s.SubnetPropertiesFormat 6878 } 6879 if s.Name != nil { 6880 objectMap["name"] = s.Name 6881 } 6882 if s.Etag != nil { 6883 objectMap["etag"] = s.Etag 6884 } 6885 if s.ID != nil { 6886 objectMap["id"] = s.ID 6887 } 6888 return json.Marshal(objectMap) 6889} 6890 6891// UnmarshalJSON is the custom unmarshaler for Subnet struct. 6892func (s *Subnet) UnmarshalJSON(body []byte) error { 6893 var m map[string]*json.RawMessage 6894 err := json.Unmarshal(body, &m) 6895 if err != nil { 6896 return err 6897 } 6898 for k, v := range m { 6899 switch k { 6900 case "properties": 6901 if v != nil { 6902 var subnetPropertiesFormat SubnetPropertiesFormat 6903 err = json.Unmarshal(*v, &subnetPropertiesFormat) 6904 if err != nil { 6905 return err 6906 } 6907 s.SubnetPropertiesFormat = &subnetPropertiesFormat 6908 } 6909 case "name": 6910 if v != nil { 6911 var name string 6912 err = json.Unmarshal(*v, &name) 6913 if err != nil { 6914 return err 6915 } 6916 s.Name = &name 6917 } 6918 case "etag": 6919 if v != nil { 6920 var etag string 6921 err = json.Unmarshal(*v, &etag) 6922 if err != nil { 6923 return err 6924 } 6925 s.Etag = &etag 6926 } 6927 case "id": 6928 if v != nil { 6929 var ID string 6930 err = json.Unmarshal(*v, &ID) 6931 if err != nil { 6932 return err 6933 } 6934 s.ID = &ID 6935 } 6936 } 6937 } 6938 6939 return nil 6940} 6941 6942// SubnetListResult response for ListSubnets Api service callRetrieves all subnet that belongs to a virtual 6943// network 6944type SubnetListResult struct { 6945 autorest.Response `json:"-"` 6946 // Value - Gets the subnets in a virtual network 6947 Value *[]Subnet `json:"value,omitempty"` 6948 // NextLink - Gets the URL to get the next set of results. 6949 NextLink *string `json:"nextLink,omitempty"` 6950} 6951 6952// SubnetListResultIterator provides access to a complete listing of Subnet values. 6953type SubnetListResultIterator struct { 6954 i int 6955 page SubnetListResultPage 6956} 6957 6958// NextWithContext advances to the next value. If there was an error making 6959// the request the iterator does not advance and the error is returned. 6960func (iter *SubnetListResultIterator) NextWithContext(ctx context.Context) (err error) { 6961 if tracing.IsEnabled() { 6962 ctx = tracing.StartSpan(ctx, fqdn+"/SubnetListResultIterator.NextWithContext") 6963 defer func() { 6964 sc := -1 6965 if iter.Response().Response.Response != nil { 6966 sc = iter.Response().Response.Response.StatusCode 6967 } 6968 tracing.EndSpan(ctx, sc, err) 6969 }() 6970 } 6971 iter.i++ 6972 if iter.i < len(iter.page.Values()) { 6973 return nil 6974 } 6975 err = iter.page.NextWithContext(ctx) 6976 if err != nil { 6977 iter.i-- 6978 return err 6979 } 6980 iter.i = 0 6981 return nil 6982} 6983 6984// Next advances to the next value. If there was an error making 6985// the request the iterator does not advance and the error is returned. 6986// Deprecated: Use NextWithContext() instead. 6987func (iter *SubnetListResultIterator) Next() error { 6988 return iter.NextWithContext(context.Background()) 6989} 6990 6991// NotDone returns true if the enumeration should be started or is not yet complete. 6992func (iter SubnetListResultIterator) NotDone() bool { 6993 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6994} 6995 6996// Response returns the raw server response from the last page request. 6997func (iter SubnetListResultIterator) Response() SubnetListResult { 6998 return iter.page.Response() 6999} 7000 7001// Value returns the current value or a zero-initialized value if the 7002// iterator has advanced beyond the end of the collection. 7003func (iter SubnetListResultIterator) Value() Subnet { 7004 if !iter.page.NotDone() { 7005 return Subnet{} 7006 } 7007 return iter.page.Values()[iter.i] 7008} 7009 7010// Creates a new instance of the SubnetListResultIterator type. 7011func NewSubnetListResultIterator(page SubnetListResultPage) SubnetListResultIterator { 7012 return SubnetListResultIterator{page: page} 7013} 7014 7015// IsEmpty returns true if the ListResult contains no values. 7016func (slr SubnetListResult) IsEmpty() bool { 7017 return slr.Value == nil || len(*slr.Value) == 0 7018} 7019 7020// hasNextLink returns true if the NextLink is not empty. 7021func (slr SubnetListResult) hasNextLink() bool { 7022 return slr.NextLink != nil && len(*slr.NextLink) != 0 7023} 7024 7025// subnetListResultPreparer prepares a request to retrieve the next set of results. 7026// It returns nil if no more results exist. 7027func (slr SubnetListResult) subnetListResultPreparer(ctx context.Context) (*http.Request, error) { 7028 if !slr.hasNextLink() { 7029 return nil, nil 7030 } 7031 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7032 autorest.AsJSON(), 7033 autorest.AsGet(), 7034 autorest.WithBaseURL(to.String(slr.NextLink))) 7035} 7036 7037// SubnetListResultPage contains a page of Subnet values. 7038type SubnetListResultPage struct { 7039 fn func(context.Context, SubnetListResult) (SubnetListResult, error) 7040 slr SubnetListResult 7041} 7042 7043// NextWithContext advances to the next page of values. If there was an error making 7044// the request the page does not advance and the error is returned. 7045func (page *SubnetListResultPage) NextWithContext(ctx context.Context) (err error) { 7046 if tracing.IsEnabled() { 7047 ctx = tracing.StartSpan(ctx, fqdn+"/SubnetListResultPage.NextWithContext") 7048 defer func() { 7049 sc := -1 7050 if page.Response().Response.Response != nil { 7051 sc = page.Response().Response.Response.StatusCode 7052 } 7053 tracing.EndSpan(ctx, sc, err) 7054 }() 7055 } 7056 for { 7057 next, err := page.fn(ctx, page.slr) 7058 if err != nil { 7059 return err 7060 } 7061 page.slr = next 7062 if !next.hasNextLink() || !next.IsEmpty() { 7063 break 7064 } 7065 } 7066 return nil 7067} 7068 7069// Next advances to the next page of values. If there was an error making 7070// the request the page does not advance and the error is returned. 7071// Deprecated: Use NextWithContext() instead. 7072func (page *SubnetListResultPage) Next() error { 7073 return page.NextWithContext(context.Background()) 7074} 7075 7076// NotDone returns true if the page enumeration should be started or is not yet complete. 7077func (page SubnetListResultPage) NotDone() bool { 7078 return !page.slr.IsEmpty() 7079} 7080 7081// Response returns the raw server response from the last page request. 7082func (page SubnetListResultPage) Response() SubnetListResult { 7083 return page.slr 7084} 7085 7086// Values returns the slice of values for the current page or nil if there are no values. 7087func (page SubnetListResultPage) Values() []Subnet { 7088 if page.slr.IsEmpty() { 7089 return nil 7090 } 7091 return *page.slr.Value 7092} 7093 7094// Creates a new instance of the SubnetListResultPage type. 7095func NewSubnetListResultPage(cur SubnetListResult, getNextPage func(context.Context, SubnetListResult) (SubnetListResult, error)) SubnetListResultPage { 7096 return SubnetListResultPage{ 7097 fn: getNextPage, 7098 slr: cur, 7099 } 7100} 7101 7102// SubnetPropertiesFormat ... 7103type SubnetPropertiesFormat struct { 7104 // AddressPrefix - Gets or sets Address prefix for the subnet. 7105 AddressPrefix *string `json:"addressPrefix,omitempty"` 7106 // NetworkSecurityGroup - Gets or sets the reference of the NetworkSecurityGroup resource 7107 NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` 7108 // RouteTable - Gets or sets the reference of the RouteTable resource 7109 RouteTable *SubResource `json:"routeTable,omitempty"` 7110 // IPConfigurations - Gets array of references to the network interface IP configurations using subnet 7111 IPConfigurations *[]SubResource `json:"ipConfigurations,omitempty"` 7112 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 7113 ProvisioningState *string `json:"provisioningState,omitempty"` 7114} 7115 7116// SubnetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 7117// operation. 7118type SubnetsCreateOrUpdateFuture struct { 7119 azure.FutureAPI 7120 // Result returns the result of the asynchronous operation. 7121 // If the operation has not completed it will return an error. 7122 Result func(SubnetsClient) (Subnet, error) 7123} 7124 7125// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7126func (future *SubnetsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 7127 var azFuture azure.Future 7128 if err := json.Unmarshal(body, &azFuture); err != nil { 7129 return err 7130 } 7131 future.FutureAPI = &azFuture 7132 future.Result = future.result 7133 return nil 7134} 7135 7136// result is the default implementation for SubnetsCreateOrUpdateFuture.Result. 7137func (future *SubnetsCreateOrUpdateFuture) result(client SubnetsClient) (s Subnet, err error) { 7138 var done bool 7139 done, err = future.DoneWithContext(context.Background(), client) 7140 if err != nil { 7141 err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 7142 return 7143 } 7144 if !done { 7145 s.Response.Response = future.Response() 7146 err = azure.NewAsyncOpIncompleteError("network.SubnetsCreateOrUpdateFuture") 7147 return 7148 } 7149 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7150 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 7151 s, err = client.CreateOrUpdateResponder(s.Response.Response) 7152 if err != nil { 7153 err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") 7154 } 7155 } 7156 return 7157} 7158 7159// SubnetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 7160// operation. 7161type SubnetsDeleteFuture struct { 7162 azure.FutureAPI 7163 // Result returns the result of the asynchronous operation. 7164 // If the operation has not completed it will return an error. 7165 Result func(SubnetsClient) (autorest.Response, error) 7166} 7167 7168// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7169func (future *SubnetsDeleteFuture) UnmarshalJSON(body []byte) error { 7170 var azFuture azure.Future 7171 if err := json.Unmarshal(body, &azFuture); err != nil { 7172 return err 7173 } 7174 future.FutureAPI = &azFuture 7175 future.Result = future.result 7176 return nil 7177} 7178 7179// result is the default implementation for SubnetsDeleteFuture.Result. 7180func (future *SubnetsDeleteFuture) result(client SubnetsClient) (ar autorest.Response, err error) { 7181 var done bool 7182 done, err = future.DoneWithContext(context.Background(), client) 7183 if err != nil { 7184 err = autorest.NewErrorWithError(err, "network.SubnetsDeleteFuture", "Result", future.Response(), "Polling failure") 7185 return 7186 } 7187 if !done { 7188 ar.Response = future.Response() 7189 err = azure.NewAsyncOpIncompleteError("network.SubnetsDeleteFuture") 7190 return 7191 } 7192 ar.Response = future.Response() 7193 return 7194} 7195 7196// SubResource ... 7197type SubResource struct { 7198 // ID - Resource Id 7199 ID *string `json:"id,omitempty"` 7200} 7201 7202// Usage describes Network Resource Usage. 7203type Usage struct { 7204 // Unit - Gets or sets an enum describing the unit of measurement. 7205 Unit *string `json:"unit,omitempty"` 7206 // CurrentValue - Gets or sets the current value of the usage. 7207 CurrentValue *int32 `json:"currentValue,omitempty"` 7208 // Limit - Gets or sets the limit of usage. 7209 Limit *int64 `json:"limit,omitempty"` 7210 // Name - Gets or sets the name of the type of usage. 7211 Name *UsageName `json:"name,omitempty"` 7212} 7213 7214// UsageName the Usage Names. 7215type UsageName struct { 7216 // Value - Gets or sets a string describing the resource name. 7217 Value *string `json:"value,omitempty"` 7218 // LocalizedValue - Gets or sets a localized string describing the resource name. 7219 LocalizedValue *string `json:"localizedValue,omitempty"` 7220} 7221 7222// UsagesListResult the List Usages operation response. 7223type UsagesListResult struct { 7224 autorest.Response `json:"-"` 7225 // Value - Gets or sets the list Network Resource Usages. 7226 Value *[]Usage `json:"value,omitempty"` 7227 // NextLink - URL to get the next set of results. 7228 NextLink *string `json:"nextLink,omitempty"` 7229} 7230 7231// UsagesListResultIterator provides access to a complete listing of Usage values. 7232type UsagesListResultIterator struct { 7233 i int 7234 page UsagesListResultPage 7235} 7236 7237// NextWithContext advances to the next value. If there was an error making 7238// the request the iterator does not advance and the error is returned. 7239func (iter *UsagesListResultIterator) NextWithContext(ctx context.Context) (err error) { 7240 if tracing.IsEnabled() { 7241 ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultIterator.NextWithContext") 7242 defer func() { 7243 sc := -1 7244 if iter.Response().Response.Response != nil { 7245 sc = iter.Response().Response.Response.StatusCode 7246 } 7247 tracing.EndSpan(ctx, sc, err) 7248 }() 7249 } 7250 iter.i++ 7251 if iter.i < len(iter.page.Values()) { 7252 return nil 7253 } 7254 err = iter.page.NextWithContext(ctx) 7255 if err != nil { 7256 iter.i-- 7257 return err 7258 } 7259 iter.i = 0 7260 return nil 7261} 7262 7263// Next advances to the next value. If there was an error making 7264// the request the iterator does not advance and the error is returned. 7265// Deprecated: Use NextWithContext() instead. 7266func (iter *UsagesListResultIterator) Next() error { 7267 return iter.NextWithContext(context.Background()) 7268} 7269 7270// NotDone returns true if the enumeration should be started or is not yet complete. 7271func (iter UsagesListResultIterator) NotDone() bool { 7272 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 7273} 7274 7275// Response returns the raw server response from the last page request. 7276func (iter UsagesListResultIterator) Response() UsagesListResult { 7277 return iter.page.Response() 7278} 7279 7280// Value returns the current value or a zero-initialized value if the 7281// iterator has advanced beyond the end of the collection. 7282func (iter UsagesListResultIterator) Value() Usage { 7283 if !iter.page.NotDone() { 7284 return Usage{} 7285 } 7286 return iter.page.Values()[iter.i] 7287} 7288 7289// Creates a new instance of the UsagesListResultIterator type. 7290func NewUsagesListResultIterator(page UsagesListResultPage) UsagesListResultIterator { 7291 return UsagesListResultIterator{page: page} 7292} 7293 7294// IsEmpty returns true if the ListResult contains no values. 7295func (ulr UsagesListResult) IsEmpty() bool { 7296 return ulr.Value == nil || len(*ulr.Value) == 0 7297} 7298 7299// hasNextLink returns true if the NextLink is not empty. 7300func (ulr UsagesListResult) hasNextLink() bool { 7301 return ulr.NextLink != nil && len(*ulr.NextLink) != 0 7302} 7303 7304// usagesListResultPreparer prepares a request to retrieve the next set of results. 7305// It returns nil if no more results exist. 7306func (ulr UsagesListResult) usagesListResultPreparer(ctx context.Context) (*http.Request, error) { 7307 if !ulr.hasNextLink() { 7308 return nil, nil 7309 } 7310 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7311 autorest.AsJSON(), 7312 autorest.AsGet(), 7313 autorest.WithBaseURL(to.String(ulr.NextLink))) 7314} 7315 7316// UsagesListResultPage contains a page of Usage values. 7317type UsagesListResultPage struct { 7318 fn func(context.Context, UsagesListResult) (UsagesListResult, error) 7319 ulr UsagesListResult 7320} 7321 7322// NextWithContext advances to the next page of values. If there was an error making 7323// the request the page does not advance and the error is returned. 7324func (page *UsagesListResultPage) NextWithContext(ctx context.Context) (err error) { 7325 if tracing.IsEnabled() { 7326 ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultPage.NextWithContext") 7327 defer func() { 7328 sc := -1 7329 if page.Response().Response.Response != nil { 7330 sc = page.Response().Response.Response.StatusCode 7331 } 7332 tracing.EndSpan(ctx, sc, err) 7333 }() 7334 } 7335 for { 7336 next, err := page.fn(ctx, page.ulr) 7337 if err != nil { 7338 return err 7339 } 7340 page.ulr = next 7341 if !next.hasNextLink() || !next.IsEmpty() { 7342 break 7343 } 7344 } 7345 return nil 7346} 7347 7348// Next advances to the next page of values. If there was an error making 7349// the request the page does not advance and the error is returned. 7350// Deprecated: Use NextWithContext() instead. 7351func (page *UsagesListResultPage) Next() error { 7352 return page.NextWithContext(context.Background()) 7353} 7354 7355// NotDone returns true if the page enumeration should be started or is not yet complete. 7356func (page UsagesListResultPage) NotDone() bool { 7357 return !page.ulr.IsEmpty() 7358} 7359 7360// Response returns the raw server response from the last page request. 7361func (page UsagesListResultPage) Response() UsagesListResult { 7362 return page.ulr 7363} 7364 7365// Values returns the slice of values for the current page or nil if there are no values. 7366func (page UsagesListResultPage) Values() []Usage { 7367 if page.ulr.IsEmpty() { 7368 return nil 7369 } 7370 return *page.ulr.Value 7371} 7372 7373// Creates a new instance of the UsagesListResultPage type. 7374func NewUsagesListResultPage(cur UsagesListResult, getNextPage func(context.Context, UsagesListResult) (UsagesListResult, error)) UsagesListResultPage { 7375 return UsagesListResultPage{ 7376 fn: getNextPage, 7377 ulr: cur, 7378 } 7379} 7380 7381// VirtualNetwork virtual Network resource 7382type VirtualNetwork struct { 7383 autorest.Response `json:"-"` 7384 *VirtualNetworkPropertiesFormat `json:"properties,omitempty"` 7385 // Etag - Gets a unique read-only string that changes whenever the resource is updated 7386 Etag *string `json:"etag,omitempty"` 7387 // ID - READ-ONLY; Resource Id 7388 ID *string `json:"id,omitempty"` 7389 // Name - READ-ONLY; Resource name 7390 Name *string `json:"name,omitempty"` 7391 // Type - READ-ONLY; Resource type 7392 Type *string `json:"type,omitempty"` 7393 // Location - Resource location 7394 Location *string `json:"location,omitempty"` 7395 // Tags - Resource tags 7396 Tags map[string]*string `json:"tags"` 7397} 7398 7399// MarshalJSON is the custom marshaler for VirtualNetwork. 7400func (vn VirtualNetwork) MarshalJSON() ([]byte, error) { 7401 objectMap := make(map[string]interface{}) 7402 if vn.VirtualNetworkPropertiesFormat != nil { 7403 objectMap["properties"] = vn.VirtualNetworkPropertiesFormat 7404 } 7405 if vn.Etag != nil { 7406 objectMap["etag"] = vn.Etag 7407 } 7408 if vn.Location != nil { 7409 objectMap["location"] = vn.Location 7410 } 7411 if vn.Tags != nil { 7412 objectMap["tags"] = vn.Tags 7413 } 7414 return json.Marshal(objectMap) 7415} 7416 7417// UnmarshalJSON is the custom unmarshaler for VirtualNetwork struct. 7418func (vn *VirtualNetwork) UnmarshalJSON(body []byte) error { 7419 var m map[string]*json.RawMessage 7420 err := json.Unmarshal(body, &m) 7421 if err != nil { 7422 return err 7423 } 7424 for k, v := range m { 7425 switch k { 7426 case "properties": 7427 if v != nil { 7428 var virtualNetworkPropertiesFormat VirtualNetworkPropertiesFormat 7429 err = json.Unmarshal(*v, &virtualNetworkPropertiesFormat) 7430 if err != nil { 7431 return err 7432 } 7433 vn.VirtualNetworkPropertiesFormat = &virtualNetworkPropertiesFormat 7434 } 7435 case "etag": 7436 if v != nil { 7437 var etag string 7438 err = json.Unmarshal(*v, &etag) 7439 if err != nil { 7440 return err 7441 } 7442 vn.Etag = &etag 7443 } 7444 case "id": 7445 if v != nil { 7446 var ID string 7447 err = json.Unmarshal(*v, &ID) 7448 if err != nil { 7449 return err 7450 } 7451 vn.ID = &ID 7452 } 7453 case "name": 7454 if v != nil { 7455 var name string 7456 err = json.Unmarshal(*v, &name) 7457 if err != nil { 7458 return err 7459 } 7460 vn.Name = &name 7461 } 7462 case "type": 7463 if v != nil { 7464 var typeVar string 7465 err = json.Unmarshal(*v, &typeVar) 7466 if err != nil { 7467 return err 7468 } 7469 vn.Type = &typeVar 7470 } 7471 case "location": 7472 if v != nil { 7473 var location string 7474 err = json.Unmarshal(*v, &location) 7475 if err != nil { 7476 return err 7477 } 7478 vn.Location = &location 7479 } 7480 case "tags": 7481 if v != nil { 7482 var tags map[string]*string 7483 err = json.Unmarshal(*v, &tags) 7484 if err != nil { 7485 return err 7486 } 7487 vn.Tags = tags 7488 } 7489 } 7490 } 7491 7492 return nil 7493} 7494 7495// VirtualNetworkGateway a common class for general resource information 7496type VirtualNetworkGateway struct { 7497 autorest.Response `json:"-"` 7498 *VirtualNetworkGatewayPropertiesFormat `json:"properties,omitempty"` 7499 // Etag - Gets a unique read-only string that changes whenever the resource is updated 7500 Etag *string `json:"etag,omitempty"` 7501 // ID - READ-ONLY; Resource Id 7502 ID *string `json:"id,omitempty"` 7503 // Name - READ-ONLY; Resource name 7504 Name *string `json:"name,omitempty"` 7505 // Type - READ-ONLY; Resource type 7506 Type *string `json:"type,omitempty"` 7507 // Location - Resource location 7508 Location *string `json:"location,omitempty"` 7509 // Tags - Resource tags 7510 Tags map[string]*string `json:"tags"` 7511} 7512 7513// MarshalJSON is the custom marshaler for VirtualNetworkGateway. 7514func (vng VirtualNetworkGateway) MarshalJSON() ([]byte, error) { 7515 objectMap := make(map[string]interface{}) 7516 if vng.VirtualNetworkGatewayPropertiesFormat != nil { 7517 objectMap["properties"] = vng.VirtualNetworkGatewayPropertiesFormat 7518 } 7519 if vng.Etag != nil { 7520 objectMap["etag"] = vng.Etag 7521 } 7522 if vng.Location != nil { 7523 objectMap["location"] = vng.Location 7524 } 7525 if vng.Tags != nil { 7526 objectMap["tags"] = vng.Tags 7527 } 7528 return json.Marshal(objectMap) 7529} 7530 7531// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGateway struct. 7532func (vng *VirtualNetworkGateway) UnmarshalJSON(body []byte) error { 7533 var m map[string]*json.RawMessage 7534 err := json.Unmarshal(body, &m) 7535 if err != nil { 7536 return err 7537 } 7538 for k, v := range m { 7539 switch k { 7540 case "properties": 7541 if v != nil { 7542 var virtualNetworkGatewayPropertiesFormat VirtualNetworkGatewayPropertiesFormat 7543 err = json.Unmarshal(*v, &virtualNetworkGatewayPropertiesFormat) 7544 if err != nil { 7545 return err 7546 } 7547 vng.VirtualNetworkGatewayPropertiesFormat = &virtualNetworkGatewayPropertiesFormat 7548 } 7549 case "etag": 7550 if v != nil { 7551 var etag string 7552 err = json.Unmarshal(*v, &etag) 7553 if err != nil { 7554 return err 7555 } 7556 vng.Etag = &etag 7557 } 7558 case "id": 7559 if v != nil { 7560 var ID string 7561 err = json.Unmarshal(*v, &ID) 7562 if err != nil { 7563 return err 7564 } 7565 vng.ID = &ID 7566 } 7567 case "name": 7568 if v != nil { 7569 var name string 7570 err = json.Unmarshal(*v, &name) 7571 if err != nil { 7572 return err 7573 } 7574 vng.Name = &name 7575 } 7576 case "type": 7577 if v != nil { 7578 var typeVar string 7579 err = json.Unmarshal(*v, &typeVar) 7580 if err != nil { 7581 return err 7582 } 7583 vng.Type = &typeVar 7584 } 7585 case "location": 7586 if v != nil { 7587 var location string 7588 err = json.Unmarshal(*v, &location) 7589 if err != nil { 7590 return err 7591 } 7592 vng.Location = &location 7593 } 7594 case "tags": 7595 if v != nil { 7596 var tags map[string]*string 7597 err = json.Unmarshal(*v, &tags) 7598 if err != nil { 7599 return err 7600 } 7601 vng.Tags = tags 7602 } 7603 } 7604 } 7605 7606 return nil 7607} 7608 7609// VirtualNetworkGatewayConnection a common class for general resource information 7610type VirtualNetworkGatewayConnection struct { 7611 autorest.Response `json:"-"` 7612 *VirtualNetworkGatewayConnectionPropertiesFormat `json:"properties,omitempty"` 7613 // Etag - Gets a unique read-only string that changes whenever the resource is updated 7614 Etag *string `json:"etag,omitempty"` 7615 // ID - READ-ONLY; Resource Id 7616 ID *string `json:"id,omitempty"` 7617 // Name - READ-ONLY; Resource name 7618 Name *string `json:"name,omitempty"` 7619 // Type - READ-ONLY; Resource type 7620 Type *string `json:"type,omitempty"` 7621 // Location - Resource location 7622 Location *string `json:"location,omitempty"` 7623 // Tags - Resource tags 7624 Tags map[string]*string `json:"tags"` 7625} 7626 7627// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnection. 7628func (vngc VirtualNetworkGatewayConnection) MarshalJSON() ([]byte, error) { 7629 objectMap := make(map[string]interface{}) 7630 if vngc.VirtualNetworkGatewayConnectionPropertiesFormat != nil { 7631 objectMap["properties"] = vngc.VirtualNetworkGatewayConnectionPropertiesFormat 7632 } 7633 if vngc.Etag != nil { 7634 objectMap["etag"] = vngc.Etag 7635 } 7636 if vngc.Location != nil { 7637 objectMap["location"] = vngc.Location 7638 } 7639 if vngc.Tags != nil { 7640 objectMap["tags"] = vngc.Tags 7641 } 7642 return json.Marshal(objectMap) 7643} 7644 7645// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayConnection struct. 7646func (vngc *VirtualNetworkGatewayConnection) UnmarshalJSON(body []byte) error { 7647 var m map[string]*json.RawMessage 7648 err := json.Unmarshal(body, &m) 7649 if err != nil { 7650 return err 7651 } 7652 for k, v := range m { 7653 switch k { 7654 case "properties": 7655 if v != nil { 7656 var virtualNetworkGatewayConnectionPropertiesFormat VirtualNetworkGatewayConnectionPropertiesFormat 7657 err = json.Unmarshal(*v, &virtualNetworkGatewayConnectionPropertiesFormat) 7658 if err != nil { 7659 return err 7660 } 7661 vngc.VirtualNetworkGatewayConnectionPropertiesFormat = &virtualNetworkGatewayConnectionPropertiesFormat 7662 } 7663 case "etag": 7664 if v != nil { 7665 var etag string 7666 err = json.Unmarshal(*v, &etag) 7667 if err != nil { 7668 return err 7669 } 7670 vngc.Etag = &etag 7671 } 7672 case "id": 7673 if v != nil { 7674 var ID string 7675 err = json.Unmarshal(*v, &ID) 7676 if err != nil { 7677 return err 7678 } 7679 vngc.ID = &ID 7680 } 7681 case "name": 7682 if v != nil { 7683 var name string 7684 err = json.Unmarshal(*v, &name) 7685 if err != nil { 7686 return err 7687 } 7688 vngc.Name = &name 7689 } 7690 case "type": 7691 if v != nil { 7692 var typeVar string 7693 err = json.Unmarshal(*v, &typeVar) 7694 if err != nil { 7695 return err 7696 } 7697 vngc.Type = &typeVar 7698 } 7699 case "location": 7700 if v != nil { 7701 var location string 7702 err = json.Unmarshal(*v, &location) 7703 if err != nil { 7704 return err 7705 } 7706 vngc.Location = &location 7707 } 7708 case "tags": 7709 if v != nil { 7710 var tags map[string]*string 7711 err = json.Unmarshal(*v, &tags) 7712 if err != nil { 7713 return err 7714 } 7715 vngc.Tags = tags 7716 } 7717 } 7718 } 7719 7720 return nil 7721} 7722 7723// VirtualNetworkGatewayConnectionListResult response for ListVirtualNetworkGatewayConnections Api service 7724// call 7725type VirtualNetworkGatewayConnectionListResult struct { 7726 autorest.Response `json:"-"` 7727 // Value - Gets List of VirtualNetworkGatewayConnections that exists in a resource group 7728 Value *[]VirtualNetworkGatewayConnection `json:"value,omitempty"` 7729 // NextLink - Gets the URL to get the next set of results. 7730 NextLink *string `json:"nextLink,omitempty"` 7731} 7732 7733// VirtualNetworkGatewayConnectionListResultIterator provides access to a complete listing of 7734// VirtualNetworkGatewayConnection values. 7735type VirtualNetworkGatewayConnectionListResultIterator struct { 7736 i int 7737 page VirtualNetworkGatewayConnectionListResultPage 7738} 7739 7740// NextWithContext advances to the next value. If there was an error making 7741// the request the iterator does not advance and the error is returned. 7742func (iter *VirtualNetworkGatewayConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { 7743 if tracing.IsEnabled() { 7744 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionListResultIterator.NextWithContext") 7745 defer func() { 7746 sc := -1 7747 if iter.Response().Response.Response != nil { 7748 sc = iter.Response().Response.Response.StatusCode 7749 } 7750 tracing.EndSpan(ctx, sc, err) 7751 }() 7752 } 7753 iter.i++ 7754 if iter.i < len(iter.page.Values()) { 7755 return nil 7756 } 7757 err = iter.page.NextWithContext(ctx) 7758 if err != nil { 7759 iter.i-- 7760 return err 7761 } 7762 iter.i = 0 7763 return nil 7764} 7765 7766// Next advances to the next value. If there was an error making 7767// the request the iterator does not advance and the error is returned. 7768// Deprecated: Use NextWithContext() instead. 7769func (iter *VirtualNetworkGatewayConnectionListResultIterator) Next() error { 7770 return iter.NextWithContext(context.Background()) 7771} 7772 7773// NotDone returns true if the enumeration should be started or is not yet complete. 7774func (iter VirtualNetworkGatewayConnectionListResultIterator) NotDone() bool { 7775 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 7776} 7777 7778// Response returns the raw server response from the last page request. 7779func (iter VirtualNetworkGatewayConnectionListResultIterator) Response() VirtualNetworkGatewayConnectionListResult { 7780 return iter.page.Response() 7781} 7782 7783// Value returns the current value or a zero-initialized value if the 7784// iterator has advanced beyond the end of the collection. 7785func (iter VirtualNetworkGatewayConnectionListResultIterator) Value() VirtualNetworkGatewayConnection { 7786 if !iter.page.NotDone() { 7787 return VirtualNetworkGatewayConnection{} 7788 } 7789 return iter.page.Values()[iter.i] 7790} 7791 7792// Creates a new instance of the VirtualNetworkGatewayConnectionListResultIterator type. 7793func NewVirtualNetworkGatewayConnectionListResultIterator(page VirtualNetworkGatewayConnectionListResultPage) VirtualNetworkGatewayConnectionListResultIterator { 7794 return VirtualNetworkGatewayConnectionListResultIterator{page: page} 7795} 7796 7797// IsEmpty returns true if the ListResult contains no values. 7798func (vngclr VirtualNetworkGatewayConnectionListResult) IsEmpty() bool { 7799 return vngclr.Value == nil || len(*vngclr.Value) == 0 7800} 7801 7802// hasNextLink returns true if the NextLink is not empty. 7803func (vngclr VirtualNetworkGatewayConnectionListResult) hasNextLink() bool { 7804 return vngclr.NextLink != nil && len(*vngclr.NextLink) != 0 7805} 7806 7807// virtualNetworkGatewayConnectionListResultPreparer prepares a request to retrieve the next set of results. 7808// It returns nil if no more results exist. 7809func (vngclr VirtualNetworkGatewayConnectionListResult) virtualNetworkGatewayConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { 7810 if !vngclr.hasNextLink() { 7811 return nil, nil 7812 } 7813 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7814 autorest.AsJSON(), 7815 autorest.AsGet(), 7816 autorest.WithBaseURL(to.String(vngclr.NextLink))) 7817} 7818 7819// VirtualNetworkGatewayConnectionListResultPage contains a page of VirtualNetworkGatewayConnection values. 7820type VirtualNetworkGatewayConnectionListResultPage struct { 7821 fn func(context.Context, VirtualNetworkGatewayConnectionListResult) (VirtualNetworkGatewayConnectionListResult, error) 7822 vngclr VirtualNetworkGatewayConnectionListResult 7823} 7824 7825// NextWithContext advances to the next page of values. If there was an error making 7826// the request the page does not advance and the error is returned. 7827func (page *VirtualNetworkGatewayConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { 7828 if tracing.IsEnabled() { 7829 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionListResultPage.NextWithContext") 7830 defer func() { 7831 sc := -1 7832 if page.Response().Response.Response != nil { 7833 sc = page.Response().Response.Response.StatusCode 7834 } 7835 tracing.EndSpan(ctx, sc, err) 7836 }() 7837 } 7838 for { 7839 next, err := page.fn(ctx, page.vngclr) 7840 if err != nil { 7841 return err 7842 } 7843 page.vngclr = next 7844 if !next.hasNextLink() || !next.IsEmpty() { 7845 break 7846 } 7847 } 7848 return nil 7849} 7850 7851// Next advances to the next page of values. If there was an error making 7852// the request the page does not advance and the error is returned. 7853// Deprecated: Use NextWithContext() instead. 7854func (page *VirtualNetworkGatewayConnectionListResultPage) Next() error { 7855 return page.NextWithContext(context.Background()) 7856} 7857 7858// NotDone returns true if the page enumeration should be started or is not yet complete. 7859func (page VirtualNetworkGatewayConnectionListResultPage) NotDone() bool { 7860 return !page.vngclr.IsEmpty() 7861} 7862 7863// Response returns the raw server response from the last page request. 7864func (page VirtualNetworkGatewayConnectionListResultPage) Response() VirtualNetworkGatewayConnectionListResult { 7865 return page.vngclr 7866} 7867 7868// Values returns the slice of values for the current page or nil if there are no values. 7869func (page VirtualNetworkGatewayConnectionListResultPage) Values() []VirtualNetworkGatewayConnection { 7870 if page.vngclr.IsEmpty() { 7871 return nil 7872 } 7873 return *page.vngclr.Value 7874} 7875 7876// Creates a new instance of the VirtualNetworkGatewayConnectionListResultPage type. 7877func NewVirtualNetworkGatewayConnectionListResultPage(cur VirtualNetworkGatewayConnectionListResult, getNextPage func(context.Context, VirtualNetworkGatewayConnectionListResult) (VirtualNetworkGatewayConnectionListResult, error)) VirtualNetworkGatewayConnectionListResultPage { 7878 return VirtualNetworkGatewayConnectionListResultPage{ 7879 fn: getNextPage, 7880 vngclr: cur, 7881 } 7882} 7883 7884// VirtualNetworkGatewayConnectionPropertiesFormat virtualNetworkGatewayConnection properties 7885type VirtualNetworkGatewayConnectionPropertiesFormat struct { 7886 VirtualNetworkGateway1 *VirtualNetworkGateway `json:"virtualNetworkGateway1,omitempty"` 7887 VirtualNetworkGateway2 *VirtualNetworkGateway `json:"virtualNetworkGateway2,omitempty"` 7888 LocalNetworkGateway2 *LocalNetworkGateway `json:"localNetworkGateway2,omitempty"` 7889 // ConnectionType - Gateway connection type IPsec/Dedicated/VpnClient/Vnet2Vnet. Possible values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' 7890 ConnectionType VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` 7891 // RoutingWeight - The Routing weight. 7892 RoutingWeight *int32 `json:"routingWeight,omitempty"` 7893 // SharedKey - The IPsec share key. 7894 SharedKey *string `json:"sharedKey,omitempty"` 7895 // ConnectionStatus - Virtual network Gateway connection status. Possible values include: 'Unknown', 'Connecting', 'Connected', 'NotConnected' 7896 ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` 7897 // EgressBytesTransferred - The Egress Bytes Transferred in this connection 7898 EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` 7899 // IngressBytesTransferred - The Ingress Bytes Transferred in this connection 7900 IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` 7901 // Peer - The reference to peerings resource. 7902 Peer *SubResource `json:"peer,omitempty"` 7903 // ResourceGUID - Gets or sets resource guid property of the VirtualNetworkGatewayConnection resource 7904 ResourceGUID *string `json:"resourceGuid,omitempty"` 7905 // ProvisioningState - Gets or sets Provisioning state of the VirtualNetworkGatewayConnection resource Updating/Deleting/Failed 7906 ProvisioningState *string `json:"provisioningState,omitempty"` 7907} 7908 7909// VirtualNetworkGatewayConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the 7910// results of a long-running operation. 7911type VirtualNetworkGatewayConnectionsCreateOrUpdateFuture struct { 7912 azure.FutureAPI 7913 // Result returns the result of the asynchronous operation. 7914 // If the operation has not completed it will return an error. 7915 Result func(VirtualNetworkGatewayConnectionsClient) (VirtualNetworkGatewayConnection, error) 7916} 7917 7918// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7919func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 7920 var azFuture azure.Future 7921 if err := json.Unmarshal(body, &azFuture); err != nil { 7922 return err 7923 } 7924 future.FutureAPI = &azFuture 7925 future.Result = future.result 7926 return nil 7927} 7928 7929// result is the default implementation for VirtualNetworkGatewayConnectionsCreateOrUpdateFuture.Result. 7930func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { 7931 var done bool 7932 done, err = future.DoneWithContext(context.Background(), client) 7933 if err != nil { 7934 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 7935 return 7936 } 7937 if !done { 7938 vngc.Response.Response = future.Response() 7939 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture") 7940 return 7941 } 7942 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7943 if vngc.Response.Response, err = future.GetResult(sender); err == nil && vngc.Response.Response.StatusCode != http.StatusNoContent { 7944 vngc, err = client.CreateOrUpdateResponder(vngc.Response.Response) 7945 if err != nil { 7946 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", vngc.Response.Response, "Failure responding to request") 7947 } 7948 } 7949 return 7950} 7951 7952// VirtualNetworkGatewayConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of 7953// a long-running operation. 7954type VirtualNetworkGatewayConnectionsDeleteFuture struct { 7955 azure.FutureAPI 7956 // Result returns the result of the asynchronous operation. 7957 // If the operation has not completed it will return an error. 7958 Result func(VirtualNetworkGatewayConnectionsClient) (autorest.Response, error) 7959} 7960 7961// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7962func (future *VirtualNetworkGatewayConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { 7963 var azFuture azure.Future 7964 if err := json.Unmarshal(body, &azFuture); err != nil { 7965 return err 7966 } 7967 future.FutureAPI = &azFuture 7968 future.Result = future.result 7969 return nil 7970} 7971 7972// result is the default implementation for VirtualNetworkGatewayConnectionsDeleteFuture.Result. 7973func (future *VirtualNetworkGatewayConnectionsDeleteFuture) result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { 7974 var done bool 7975 done, err = future.DoneWithContext(context.Background(), client) 7976 if err != nil { 7977 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") 7978 return 7979 } 7980 if !done { 7981 ar.Response = future.Response() 7982 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsDeleteFuture") 7983 return 7984 } 7985 ar.Response = future.Response() 7986 return 7987} 7988 7989// VirtualNetworkGatewayConnectionsResetSharedKeyFuture an abstraction for monitoring and retrieving the 7990// results of a long-running operation. 7991type VirtualNetworkGatewayConnectionsResetSharedKeyFuture struct { 7992 azure.FutureAPI 7993 // Result returns the result of the asynchronous operation. 7994 // If the operation has not completed it will return an error. 7995 Result func(VirtualNetworkGatewayConnectionsClient) (ConnectionResetSharedKey, error) 7996} 7997 7998// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7999func (future *VirtualNetworkGatewayConnectionsResetSharedKeyFuture) UnmarshalJSON(body []byte) error { 8000 var azFuture azure.Future 8001 if err := json.Unmarshal(body, &azFuture); err != nil { 8002 return err 8003 } 8004 future.FutureAPI = &azFuture 8005 future.Result = future.result 8006 return nil 8007} 8008 8009// result is the default implementation for VirtualNetworkGatewayConnectionsResetSharedKeyFuture.Result. 8010func (future *VirtualNetworkGatewayConnectionsResetSharedKeyFuture) result(client VirtualNetworkGatewayConnectionsClient) (crsk ConnectionResetSharedKey, err error) { 8011 var done bool 8012 done, err = future.DoneWithContext(context.Background(), client) 8013 if err != nil { 8014 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", future.Response(), "Polling failure") 8015 return 8016 } 8017 if !done { 8018 crsk.Response.Response = future.Response() 8019 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture") 8020 return 8021 } 8022 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 8023 if crsk.Response.Response, err = future.GetResult(sender); err == nil && crsk.Response.Response.StatusCode != http.StatusNoContent { 8024 crsk, err = client.ResetSharedKeyResponder(crsk.Response.Response) 8025 if err != nil { 8026 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", crsk.Response.Response, "Failure responding to request") 8027 } 8028 } 8029 return 8030} 8031 8032// VirtualNetworkGatewayConnectionsSetSharedKeyFuture an abstraction for monitoring and retrieving the 8033// results of a long-running operation. 8034type VirtualNetworkGatewayConnectionsSetSharedKeyFuture struct { 8035 azure.FutureAPI 8036 // Result returns the result of the asynchronous operation. 8037 // If the operation has not completed it will return an error. 8038 Result func(VirtualNetworkGatewayConnectionsClient) (ConnectionSharedKey, error) 8039} 8040 8041// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8042func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) UnmarshalJSON(body []byte) error { 8043 var azFuture azure.Future 8044 if err := json.Unmarshal(body, &azFuture); err != nil { 8045 return err 8046 } 8047 future.FutureAPI = &azFuture 8048 future.Result = future.result 8049 return nil 8050} 8051 8052// result is the default implementation for VirtualNetworkGatewayConnectionsSetSharedKeyFuture.Result. 8053func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) result(client VirtualNetworkGatewayConnectionsClient) (csk ConnectionSharedKey, err error) { 8054 var done bool 8055 done, err = future.DoneWithContext(context.Background(), client) 8056 if err != nil { 8057 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", future.Response(), "Polling failure") 8058 return 8059 } 8060 if !done { 8061 csk.Response.Response = future.Response() 8062 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture") 8063 return 8064 } 8065 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 8066 if csk.Response.Response, err = future.GetResult(sender); err == nil && csk.Response.Response.StatusCode != http.StatusNoContent { 8067 csk, err = client.SetSharedKeyResponder(csk.Response.Response) 8068 if err != nil { 8069 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", csk.Response.Response, "Failure responding to request") 8070 } 8071 } 8072 return 8073} 8074 8075// VirtualNetworkGatewayIPConfiguration ipConfiguration for Virtual network gateway 8076type VirtualNetworkGatewayIPConfiguration struct { 8077 *VirtualNetworkGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` 8078 // Name - Gets name of the resource that is unique within a resource group. This name can be used to access the resource 8079 Name *string `json:"name,omitempty"` 8080 // Etag - A unique read-only string that changes whenever the resource is updated 8081 Etag *string `json:"etag,omitempty"` 8082 // ID - Resource Id 8083 ID *string `json:"id,omitempty"` 8084} 8085 8086// MarshalJSON is the custom marshaler for VirtualNetworkGatewayIPConfiguration. 8087func (vngic VirtualNetworkGatewayIPConfiguration) MarshalJSON() ([]byte, error) { 8088 objectMap := make(map[string]interface{}) 8089 if vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat != nil { 8090 objectMap["properties"] = vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat 8091 } 8092 if vngic.Name != nil { 8093 objectMap["name"] = vngic.Name 8094 } 8095 if vngic.Etag != nil { 8096 objectMap["etag"] = vngic.Etag 8097 } 8098 if vngic.ID != nil { 8099 objectMap["id"] = vngic.ID 8100 } 8101 return json.Marshal(objectMap) 8102} 8103 8104// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayIPConfiguration struct. 8105func (vngic *VirtualNetworkGatewayIPConfiguration) UnmarshalJSON(body []byte) error { 8106 var m map[string]*json.RawMessage 8107 err := json.Unmarshal(body, &m) 8108 if err != nil { 8109 return err 8110 } 8111 for k, v := range m { 8112 switch k { 8113 case "properties": 8114 if v != nil { 8115 var virtualNetworkGatewayIPConfigurationPropertiesFormat VirtualNetworkGatewayIPConfigurationPropertiesFormat 8116 err = json.Unmarshal(*v, &virtualNetworkGatewayIPConfigurationPropertiesFormat) 8117 if err != nil { 8118 return err 8119 } 8120 vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat = &virtualNetworkGatewayIPConfigurationPropertiesFormat 8121 } 8122 case "name": 8123 if v != nil { 8124 var name string 8125 err = json.Unmarshal(*v, &name) 8126 if err != nil { 8127 return err 8128 } 8129 vngic.Name = &name 8130 } 8131 case "etag": 8132 if v != nil { 8133 var etag string 8134 err = json.Unmarshal(*v, &etag) 8135 if err != nil { 8136 return err 8137 } 8138 vngic.Etag = &etag 8139 } 8140 case "id": 8141 if v != nil { 8142 var ID string 8143 err = json.Unmarshal(*v, &ID) 8144 if err != nil { 8145 return err 8146 } 8147 vngic.ID = &ID 8148 } 8149 } 8150 } 8151 8152 return nil 8153} 8154 8155// VirtualNetworkGatewayIPConfigurationPropertiesFormat properties of VirtualNetworkGatewayIPConfiguration 8156type VirtualNetworkGatewayIPConfigurationPropertiesFormat struct { 8157 // PrivateIPAddress - Gets or sets the privateIPAddress of the Network Interface IP Configuration 8158 PrivateIPAddress *string `json:"privateIPAddress,omitempty"` 8159 // PrivateIPAllocationMethod - Gets or sets PrivateIP allocation method (Static/Dynamic). Possible values include: 'Static', 'Dynamic' 8160 PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` 8161 // Subnet - Gets or sets the reference of the subnet resource 8162 Subnet *SubResource `json:"subnet,omitempty"` 8163 // PublicIPAddress - Gets or sets the reference of the PublicIP resource 8164 PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` 8165 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 8166 ProvisioningState *string `json:"provisioningState,omitempty"` 8167} 8168 8169// VirtualNetworkGatewayListResult response for ListVirtualNetworkGateways Api service call 8170type VirtualNetworkGatewayListResult struct { 8171 autorest.Response `json:"-"` 8172 // Value - Gets List of VirtualNetworkGateways that exists in a resource group 8173 Value *[]VirtualNetworkGateway `json:"value,omitempty"` 8174 // NextLink - Gets the URL to get the next set of results. 8175 NextLink *string `json:"nextLink,omitempty"` 8176} 8177 8178// VirtualNetworkGatewayListResultIterator provides access to a complete listing of VirtualNetworkGateway 8179// values. 8180type VirtualNetworkGatewayListResultIterator struct { 8181 i int 8182 page VirtualNetworkGatewayListResultPage 8183} 8184 8185// NextWithContext advances to the next value. If there was an error making 8186// the request the iterator does not advance and the error is returned. 8187func (iter *VirtualNetworkGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { 8188 if tracing.IsEnabled() { 8189 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListResultIterator.NextWithContext") 8190 defer func() { 8191 sc := -1 8192 if iter.Response().Response.Response != nil { 8193 sc = iter.Response().Response.Response.StatusCode 8194 } 8195 tracing.EndSpan(ctx, sc, err) 8196 }() 8197 } 8198 iter.i++ 8199 if iter.i < len(iter.page.Values()) { 8200 return nil 8201 } 8202 err = iter.page.NextWithContext(ctx) 8203 if err != nil { 8204 iter.i-- 8205 return err 8206 } 8207 iter.i = 0 8208 return nil 8209} 8210 8211// Next advances to the next value. If there was an error making 8212// the request the iterator does not advance and the error is returned. 8213// Deprecated: Use NextWithContext() instead. 8214func (iter *VirtualNetworkGatewayListResultIterator) Next() error { 8215 return iter.NextWithContext(context.Background()) 8216} 8217 8218// NotDone returns true if the enumeration should be started or is not yet complete. 8219func (iter VirtualNetworkGatewayListResultIterator) NotDone() bool { 8220 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 8221} 8222 8223// Response returns the raw server response from the last page request. 8224func (iter VirtualNetworkGatewayListResultIterator) Response() VirtualNetworkGatewayListResult { 8225 return iter.page.Response() 8226} 8227 8228// Value returns the current value or a zero-initialized value if the 8229// iterator has advanced beyond the end of the collection. 8230func (iter VirtualNetworkGatewayListResultIterator) Value() VirtualNetworkGateway { 8231 if !iter.page.NotDone() { 8232 return VirtualNetworkGateway{} 8233 } 8234 return iter.page.Values()[iter.i] 8235} 8236 8237// Creates a new instance of the VirtualNetworkGatewayListResultIterator type. 8238func NewVirtualNetworkGatewayListResultIterator(page VirtualNetworkGatewayListResultPage) VirtualNetworkGatewayListResultIterator { 8239 return VirtualNetworkGatewayListResultIterator{page: page} 8240} 8241 8242// IsEmpty returns true if the ListResult contains no values. 8243func (vnglr VirtualNetworkGatewayListResult) IsEmpty() bool { 8244 return vnglr.Value == nil || len(*vnglr.Value) == 0 8245} 8246 8247// hasNextLink returns true if the NextLink is not empty. 8248func (vnglr VirtualNetworkGatewayListResult) hasNextLink() bool { 8249 return vnglr.NextLink != nil && len(*vnglr.NextLink) != 0 8250} 8251 8252// virtualNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. 8253// It returns nil if no more results exist. 8254func (vnglr VirtualNetworkGatewayListResult) virtualNetworkGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { 8255 if !vnglr.hasNextLink() { 8256 return nil, nil 8257 } 8258 return autorest.Prepare((&http.Request{}).WithContext(ctx), 8259 autorest.AsJSON(), 8260 autorest.AsGet(), 8261 autorest.WithBaseURL(to.String(vnglr.NextLink))) 8262} 8263 8264// VirtualNetworkGatewayListResultPage contains a page of VirtualNetworkGateway values. 8265type VirtualNetworkGatewayListResultPage struct { 8266 fn func(context.Context, VirtualNetworkGatewayListResult) (VirtualNetworkGatewayListResult, error) 8267 vnglr VirtualNetworkGatewayListResult 8268} 8269 8270// NextWithContext advances to the next page of values. If there was an error making 8271// the request the page does not advance and the error is returned. 8272func (page *VirtualNetworkGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { 8273 if tracing.IsEnabled() { 8274 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListResultPage.NextWithContext") 8275 defer func() { 8276 sc := -1 8277 if page.Response().Response.Response != nil { 8278 sc = page.Response().Response.Response.StatusCode 8279 } 8280 tracing.EndSpan(ctx, sc, err) 8281 }() 8282 } 8283 for { 8284 next, err := page.fn(ctx, page.vnglr) 8285 if err != nil { 8286 return err 8287 } 8288 page.vnglr = next 8289 if !next.hasNextLink() || !next.IsEmpty() { 8290 break 8291 } 8292 } 8293 return nil 8294} 8295 8296// Next advances to the next page of values. If there was an error making 8297// the request the page does not advance and the error is returned. 8298// Deprecated: Use NextWithContext() instead. 8299func (page *VirtualNetworkGatewayListResultPage) Next() error { 8300 return page.NextWithContext(context.Background()) 8301} 8302 8303// NotDone returns true if the page enumeration should be started or is not yet complete. 8304func (page VirtualNetworkGatewayListResultPage) NotDone() bool { 8305 return !page.vnglr.IsEmpty() 8306} 8307 8308// Response returns the raw server response from the last page request. 8309func (page VirtualNetworkGatewayListResultPage) Response() VirtualNetworkGatewayListResult { 8310 return page.vnglr 8311} 8312 8313// Values returns the slice of values for the current page or nil if there are no values. 8314func (page VirtualNetworkGatewayListResultPage) Values() []VirtualNetworkGateway { 8315 if page.vnglr.IsEmpty() { 8316 return nil 8317 } 8318 return *page.vnglr.Value 8319} 8320 8321// Creates a new instance of the VirtualNetworkGatewayListResultPage type. 8322func NewVirtualNetworkGatewayListResultPage(cur VirtualNetworkGatewayListResult, getNextPage func(context.Context, VirtualNetworkGatewayListResult) (VirtualNetworkGatewayListResult, error)) VirtualNetworkGatewayListResultPage { 8323 return VirtualNetworkGatewayListResultPage{ 8324 fn: getNextPage, 8325 vnglr: cur, 8326 } 8327} 8328 8329// VirtualNetworkGatewayPropertiesFormat virtualNetworkGateway properties 8330type VirtualNetworkGatewayPropertiesFormat struct { 8331 // IPConfigurations - IpConfigurations for Virtual network gateway. 8332 IPConfigurations *[]VirtualNetworkGatewayIPConfiguration `json:"ipConfigurations,omitempty"` 8333 // GatewayType - The type of this virtual network gateway. Possible values include: 'VirtualNetworkGatewayTypeVpn', 'VirtualNetworkGatewayTypeExpressRoute' 8334 GatewayType VirtualNetworkGatewayType `json:"gatewayType,omitempty"` 8335 // VpnType - The type of this virtual network gateway. Possible values include: 'PolicyBased', 'RouteBased' 8336 VpnType VpnType `json:"vpnType,omitempty"` 8337 // EnableBgp - EnableBgp Flag 8338 EnableBgp *bool `json:"enableBgp,omitempty"` 8339 // GatewayDefaultSite - Gets or sets the reference of the LocalNetworkGateway resource which represents Local network site having default routes. Assign Null value in case of removing existing default site setting. 8340 GatewayDefaultSite *SubResource `json:"gatewayDefaultSite,omitempty"` 8341 // ResourceGUID - Gets or sets resource guid property of the VirtualNetworkGateway resource 8342 ResourceGUID *string `json:"resourceGuid,omitempty"` 8343 // ProvisioningState - Gets or sets Provisioning state of the VirtualNetworkGateway resource Updating/Deleting/Failed 8344 ProvisioningState *string `json:"provisioningState,omitempty"` 8345} 8346 8347// VirtualNetworkGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 8348// long-running operation. 8349type VirtualNetworkGatewaysCreateOrUpdateFuture struct { 8350 azure.FutureAPI 8351 // Result returns the result of the asynchronous operation. 8352 // If the operation has not completed it will return an error. 8353 Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) 8354} 8355 8356// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8357func (future *VirtualNetworkGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 8358 var azFuture azure.Future 8359 if err := json.Unmarshal(body, &azFuture); err != nil { 8360 return err 8361 } 8362 future.FutureAPI = &azFuture 8363 future.Result = future.result 8364 return nil 8365} 8366 8367// result is the default implementation for VirtualNetworkGatewaysCreateOrUpdateFuture.Result. 8368func (future *VirtualNetworkGatewaysCreateOrUpdateFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { 8369 var done bool 8370 done, err = future.DoneWithContext(context.Background(), client) 8371 if err != nil { 8372 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 8373 return 8374 } 8375 if !done { 8376 vng.Response.Response = future.Response() 8377 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysCreateOrUpdateFuture") 8378 return 8379 } 8380 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 8381 if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { 8382 vng, err = client.CreateOrUpdateResponder(vng.Response.Response) 8383 if err != nil { 8384 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", vng.Response.Response, "Failure responding to request") 8385 } 8386 } 8387 return 8388} 8389 8390// VirtualNetworkGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a 8391// long-running operation. 8392type VirtualNetworkGatewaysDeleteFuture struct { 8393 azure.FutureAPI 8394 // Result returns the result of the asynchronous operation. 8395 // If the operation has not completed it will return an error. 8396 Result func(VirtualNetworkGatewaysClient) (autorest.Response, error) 8397} 8398 8399// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8400func (future *VirtualNetworkGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { 8401 var azFuture azure.Future 8402 if err := json.Unmarshal(body, &azFuture); err != nil { 8403 return err 8404 } 8405 future.FutureAPI = &azFuture 8406 future.Result = future.result 8407 return nil 8408} 8409 8410// result is the default implementation for VirtualNetworkGatewaysDeleteFuture.Result. 8411func (future *VirtualNetworkGatewaysDeleteFuture) result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { 8412 var done bool 8413 done, err = future.DoneWithContext(context.Background(), client) 8414 if err != nil { 8415 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") 8416 return 8417 } 8418 if !done { 8419 ar.Response = future.Response() 8420 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDeleteFuture") 8421 return 8422 } 8423 ar.Response = future.Response() 8424 return 8425} 8426 8427// VirtualNetworkGatewaysResetFuture an abstraction for monitoring and retrieving the results of a 8428// long-running operation. 8429type VirtualNetworkGatewaysResetFuture struct { 8430 azure.FutureAPI 8431 // Result returns the result of the asynchronous operation. 8432 // If the operation has not completed it will return an error. 8433 Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) 8434} 8435 8436// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8437func (future *VirtualNetworkGatewaysResetFuture) UnmarshalJSON(body []byte) error { 8438 var azFuture azure.Future 8439 if err := json.Unmarshal(body, &azFuture); err != nil { 8440 return err 8441 } 8442 future.FutureAPI = &azFuture 8443 future.Result = future.result 8444 return nil 8445} 8446 8447// result is the default implementation for VirtualNetworkGatewaysResetFuture.Result. 8448func (future *VirtualNetworkGatewaysResetFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { 8449 var done bool 8450 done, err = future.DoneWithContext(context.Background(), client) 8451 if err != nil { 8452 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", future.Response(), "Polling failure") 8453 return 8454 } 8455 if !done { 8456 vng.Response.Response = future.Response() 8457 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetFuture") 8458 return 8459 } 8460 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 8461 if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { 8462 vng, err = client.ResetResponder(vng.Response.Response) 8463 if err != nil { 8464 err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", vng.Response.Response, "Failure responding to request") 8465 } 8466 } 8467 return 8468} 8469 8470// VirtualNetworkListResult response for ListVirtualNetworks Api service call 8471type VirtualNetworkListResult struct { 8472 autorest.Response `json:"-"` 8473 // Value - Gets list of VirtualNetworks in a resource group 8474 Value *[]VirtualNetwork `json:"value,omitempty"` 8475 // NextLink - Gets the URL to get the next set of results. 8476 NextLink *string `json:"nextLink,omitempty"` 8477} 8478 8479// VirtualNetworkListResultIterator provides access to a complete listing of VirtualNetwork values. 8480type VirtualNetworkListResultIterator struct { 8481 i int 8482 page VirtualNetworkListResultPage 8483} 8484 8485// NextWithContext advances to the next value. If there was an error making 8486// the request the iterator does not advance and the error is returned. 8487func (iter *VirtualNetworkListResultIterator) NextWithContext(ctx context.Context) (err error) { 8488 if tracing.IsEnabled() { 8489 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResultIterator.NextWithContext") 8490 defer func() { 8491 sc := -1 8492 if iter.Response().Response.Response != nil { 8493 sc = iter.Response().Response.Response.StatusCode 8494 } 8495 tracing.EndSpan(ctx, sc, err) 8496 }() 8497 } 8498 iter.i++ 8499 if iter.i < len(iter.page.Values()) { 8500 return nil 8501 } 8502 err = iter.page.NextWithContext(ctx) 8503 if err != nil { 8504 iter.i-- 8505 return err 8506 } 8507 iter.i = 0 8508 return nil 8509} 8510 8511// Next advances to the next value. If there was an error making 8512// the request the iterator does not advance and the error is returned. 8513// Deprecated: Use NextWithContext() instead. 8514func (iter *VirtualNetworkListResultIterator) Next() error { 8515 return iter.NextWithContext(context.Background()) 8516} 8517 8518// NotDone returns true if the enumeration should be started or is not yet complete. 8519func (iter VirtualNetworkListResultIterator) NotDone() bool { 8520 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 8521} 8522 8523// Response returns the raw server response from the last page request. 8524func (iter VirtualNetworkListResultIterator) Response() VirtualNetworkListResult { 8525 return iter.page.Response() 8526} 8527 8528// Value returns the current value or a zero-initialized value if the 8529// iterator has advanced beyond the end of the collection. 8530func (iter VirtualNetworkListResultIterator) Value() VirtualNetwork { 8531 if !iter.page.NotDone() { 8532 return VirtualNetwork{} 8533 } 8534 return iter.page.Values()[iter.i] 8535} 8536 8537// Creates a new instance of the VirtualNetworkListResultIterator type. 8538func NewVirtualNetworkListResultIterator(page VirtualNetworkListResultPage) VirtualNetworkListResultIterator { 8539 return VirtualNetworkListResultIterator{page: page} 8540} 8541 8542// IsEmpty returns true if the ListResult contains no values. 8543func (vnlr VirtualNetworkListResult) IsEmpty() bool { 8544 return vnlr.Value == nil || len(*vnlr.Value) == 0 8545} 8546 8547// hasNextLink returns true if the NextLink is not empty. 8548func (vnlr VirtualNetworkListResult) hasNextLink() bool { 8549 return vnlr.NextLink != nil && len(*vnlr.NextLink) != 0 8550} 8551 8552// virtualNetworkListResultPreparer prepares a request to retrieve the next set of results. 8553// It returns nil if no more results exist. 8554func (vnlr VirtualNetworkListResult) virtualNetworkListResultPreparer(ctx context.Context) (*http.Request, error) { 8555 if !vnlr.hasNextLink() { 8556 return nil, nil 8557 } 8558 return autorest.Prepare((&http.Request{}).WithContext(ctx), 8559 autorest.AsJSON(), 8560 autorest.AsGet(), 8561 autorest.WithBaseURL(to.String(vnlr.NextLink))) 8562} 8563 8564// VirtualNetworkListResultPage contains a page of VirtualNetwork values. 8565type VirtualNetworkListResultPage struct { 8566 fn func(context.Context, VirtualNetworkListResult) (VirtualNetworkListResult, error) 8567 vnlr VirtualNetworkListResult 8568} 8569 8570// NextWithContext advances to the next page of values. If there was an error making 8571// the request the page does not advance and the error is returned. 8572func (page *VirtualNetworkListResultPage) NextWithContext(ctx context.Context) (err error) { 8573 if tracing.IsEnabled() { 8574 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResultPage.NextWithContext") 8575 defer func() { 8576 sc := -1 8577 if page.Response().Response.Response != nil { 8578 sc = page.Response().Response.Response.StatusCode 8579 } 8580 tracing.EndSpan(ctx, sc, err) 8581 }() 8582 } 8583 for { 8584 next, err := page.fn(ctx, page.vnlr) 8585 if err != nil { 8586 return err 8587 } 8588 page.vnlr = next 8589 if !next.hasNextLink() || !next.IsEmpty() { 8590 break 8591 } 8592 } 8593 return nil 8594} 8595 8596// Next advances to the next page of values. If there was an error making 8597// the request the page does not advance and the error is returned. 8598// Deprecated: Use NextWithContext() instead. 8599func (page *VirtualNetworkListResultPage) Next() error { 8600 return page.NextWithContext(context.Background()) 8601} 8602 8603// NotDone returns true if the page enumeration should be started or is not yet complete. 8604func (page VirtualNetworkListResultPage) NotDone() bool { 8605 return !page.vnlr.IsEmpty() 8606} 8607 8608// Response returns the raw server response from the last page request. 8609func (page VirtualNetworkListResultPage) Response() VirtualNetworkListResult { 8610 return page.vnlr 8611} 8612 8613// Values returns the slice of values for the current page or nil if there are no values. 8614func (page VirtualNetworkListResultPage) Values() []VirtualNetwork { 8615 if page.vnlr.IsEmpty() { 8616 return nil 8617 } 8618 return *page.vnlr.Value 8619} 8620 8621// Creates a new instance of the VirtualNetworkListResultPage type. 8622func NewVirtualNetworkListResultPage(cur VirtualNetworkListResult, getNextPage func(context.Context, VirtualNetworkListResult) (VirtualNetworkListResult, error)) VirtualNetworkListResultPage { 8623 return VirtualNetworkListResultPage{ 8624 fn: getNextPage, 8625 vnlr: cur, 8626 } 8627} 8628 8629// VirtualNetworkPropertiesFormat ... 8630type VirtualNetworkPropertiesFormat struct { 8631 // AddressSpace - Gets or sets AddressSpace that contains an array of IP address ranges that can be used by subnets 8632 AddressSpace *AddressSpace `json:"addressSpace,omitempty"` 8633 // DhcpOptions - Gets or sets DHCPOptions that contains an array of DNS servers available to VMs deployed in the virtual network 8634 DhcpOptions *DhcpOptions `json:"dhcpOptions,omitempty"` 8635 // Subnets - Gets or sets List of subnets in a VirtualNetwork 8636 Subnets *[]Subnet `json:"subnets,omitempty"` 8637 // ResourceGUID - Gets or sets resource guid property of the VirtualNetwork resource 8638 ResourceGUID *string `json:"resourceGuid,omitempty"` 8639 // ProvisioningState - Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed 8640 ProvisioningState *string `json:"provisioningState,omitempty"` 8641} 8642 8643// VirtualNetworksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 8644// long-running operation. 8645type VirtualNetworksCreateOrUpdateFuture struct { 8646 azure.FutureAPI 8647 // Result returns the result of the asynchronous operation. 8648 // If the operation has not completed it will return an error. 8649 Result func(VirtualNetworksClient) (VirtualNetwork, error) 8650} 8651 8652// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8653func (future *VirtualNetworksCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 8654 var azFuture azure.Future 8655 if err := json.Unmarshal(body, &azFuture); err != nil { 8656 return err 8657 } 8658 future.FutureAPI = &azFuture 8659 future.Result = future.result 8660 return nil 8661} 8662 8663// result is the default implementation for VirtualNetworksCreateOrUpdateFuture.Result. 8664func (future *VirtualNetworksCreateOrUpdateFuture) result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { 8665 var done bool 8666 done, err = future.DoneWithContext(context.Background(), client) 8667 if err != nil { 8668 err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 8669 return 8670 } 8671 if !done { 8672 vn.Response.Response = future.Response() 8673 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksCreateOrUpdateFuture") 8674 return 8675 } 8676 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 8677 if vn.Response.Response, err = future.GetResult(sender); err == nil && vn.Response.Response.StatusCode != http.StatusNoContent { 8678 vn, err = client.CreateOrUpdateResponder(vn.Response.Response) 8679 if err != nil { 8680 err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", vn.Response.Response, "Failure responding to request") 8681 } 8682 } 8683 return 8684} 8685 8686// VirtualNetworksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 8687// operation. 8688type VirtualNetworksDeleteFuture struct { 8689 azure.FutureAPI 8690 // Result returns the result of the asynchronous operation. 8691 // If the operation has not completed it will return an error. 8692 Result func(VirtualNetworksClient) (autorest.Response, error) 8693} 8694 8695// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8696func (future *VirtualNetworksDeleteFuture) UnmarshalJSON(body []byte) error { 8697 var azFuture azure.Future 8698 if err := json.Unmarshal(body, &azFuture); err != nil { 8699 return err 8700 } 8701 future.FutureAPI = &azFuture 8702 future.Result = future.result 8703 return nil 8704} 8705 8706// result is the default implementation for VirtualNetworksDeleteFuture.Result. 8707func (future *VirtualNetworksDeleteFuture) result(client VirtualNetworksClient) (ar autorest.Response, err error) { 8708 var done bool 8709 done, err = future.DoneWithContext(context.Background(), client) 8710 if err != nil { 8711 err = autorest.NewErrorWithError(err, "network.VirtualNetworksDeleteFuture", "Result", future.Response(), "Polling failure") 8712 return 8713 } 8714 if !done { 8715 ar.Response = future.Response() 8716 err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksDeleteFuture") 8717 return 8718 } 8719 ar.Response = future.Response() 8720 return 8721} 8722