1package storagepool 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/azure" 25 "github.com/Azure/go-autorest/autorest/to" 26 "github.com/Azure/go-autorest/tracing" 27 "net/http" 28) 29 30// The package's fully qualified name. 31const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/storagepool/mgmt/2020-03-15-preview/storagepool" 32 33// ACL access Control List (ACL) for an iSCSI target lun 34type ACL struct { 35 // InitiatorIqn - iSCSI initiator iqn (iSCSI Qualified Name); example: iqn.2005-03.org.iscsi:client 36 InitiatorIqn *string `json:"initiatorIqn,omitempty"` 37 // MappedLuns - Array of lun names mapped to the ACL 38 MappedLuns *[]string `json:"mappedLuns,omitempty"` 39 // IscsiTargetCredentials - CHAP credentials for iSCSI target. 40 *IscsiTargetCredentials `json:"credentials,omitempty"` 41} 42 43// MarshalJSON is the custom marshaler for ACL. 44func (a ACL) MarshalJSON() ([]byte, error) { 45 objectMap := make(map[string]interface{}) 46 if a.InitiatorIqn != nil { 47 objectMap["initiatorIqn"] = a.InitiatorIqn 48 } 49 if a.MappedLuns != nil { 50 objectMap["mappedLuns"] = a.MappedLuns 51 } 52 if a.IscsiTargetCredentials != nil { 53 objectMap["credentials"] = a.IscsiTargetCredentials 54 } 55 return json.Marshal(objectMap) 56} 57 58// UnmarshalJSON is the custom unmarshaler for ACL struct. 59func (a *ACL) UnmarshalJSON(body []byte) error { 60 var m map[string]*json.RawMessage 61 err := json.Unmarshal(body, &m) 62 if err != nil { 63 return err 64 } 65 for k, v := range m { 66 switch k { 67 case "initiatorIqn": 68 if v != nil { 69 var initiatorIqn string 70 err = json.Unmarshal(*v, &initiatorIqn) 71 if err != nil { 72 return err 73 } 74 a.InitiatorIqn = &initiatorIqn 75 } 76 case "mappedLuns": 77 if v != nil { 78 var mappedLuns []string 79 err = json.Unmarshal(*v, &mappedLuns) 80 if err != nil { 81 return err 82 } 83 a.MappedLuns = &mappedLuns 84 } 85 case "credentials": 86 if v != nil { 87 var iscsiTargetCredentials IscsiTargetCredentials 88 err = json.Unmarshal(*v, &iscsiTargetCredentials) 89 if err != nil { 90 return err 91 } 92 a.IscsiTargetCredentials = &iscsiTargetCredentials 93 } 94 } 95 } 96 97 return nil 98} 99 100// Attributes attributes of an iSCSI target 101type Attributes struct { 102 // Authentication - Indicates whether or not authentication is enabled on the ACL. 103 Authentication *bool `json:"authentication,omitempty"` 104 // ProdModeWriteProtect - Indicates whether or not write protect is enabled on the luns. 105 ProdModeWriteProtect *bool `json:"prodModeWriteProtect,omitempty"` 106} 107 108// Disk managed disk to attach to the DiskPool. Required. 109type Disk struct { 110 // ID - Unique Azure resource id of the managed disk. Required. 111 ID *string `json:"id,omitempty"` 112} 113 114// DiskPool request payload for Create or Update Disk Pool requests. 115type DiskPool struct { 116 autorest.Response `json:"-"` 117 // DiskPoolProperties - RP defined properties for Disk Pool operations. 118 *DiskPoolProperties `json:"properties,omitempty"` 119 // Sku - Sku description. 120 Sku *Sku `json:"sku,omitempty"` 121 // SystemData - READ-ONLY; Resource metadata required by ARM RPC 122 SystemData *SystemMetadata `json:"systemData,omitempty"` 123 // Tags - Resource tags. 124 Tags map[string]*string `json:"tags"` 125 // Location - The geo-location where the resource lives 126 Location *string `json:"location,omitempty"` 127 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 128 ID *string `json:"id,omitempty"` 129 // Name - READ-ONLY; The name of the resource 130 Name *string `json:"name,omitempty"` 131 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 132 Type *string `json:"type,omitempty"` 133} 134 135// MarshalJSON is the custom marshaler for DiskPool. 136func (dp DiskPool) MarshalJSON() ([]byte, error) { 137 objectMap := make(map[string]interface{}) 138 if dp.DiskPoolProperties != nil { 139 objectMap["properties"] = dp.DiskPoolProperties 140 } 141 if dp.Sku != nil { 142 objectMap["sku"] = dp.Sku 143 } 144 if dp.Tags != nil { 145 objectMap["tags"] = dp.Tags 146 } 147 if dp.Location != nil { 148 objectMap["location"] = dp.Location 149 } 150 return json.Marshal(objectMap) 151} 152 153// UnmarshalJSON is the custom unmarshaler for DiskPool struct. 154func (dp *DiskPool) UnmarshalJSON(body []byte) error { 155 var m map[string]*json.RawMessage 156 err := json.Unmarshal(body, &m) 157 if err != nil { 158 return err 159 } 160 for k, v := range m { 161 switch k { 162 case "properties": 163 if v != nil { 164 var diskPoolProperties DiskPoolProperties 165 err = json.Unmarshal(*v, &diskPoolProperties) 166 if err != nil { 167 return err 168 } 169 dp.DiskPoolProperties = &diskPoolProperties 170 } 171 case "sku": 172 if v != nil { 173 var sku Sku 174 err = json.Unmarshal(*v, &sku) 175 if err != nil { 176 return err 177 } 178 dp.Sku = &sku 179 } 180 case "systemData": 181 if v != nil { 182 var systemData SystemMetadata 183 err = json.Unmarshal(*v, &systemData) 184 if err != nil { 185 return err 186 } 187 dp.SystemData = &systemData 188 } 189 case "tags": 190 if v != nil { 191 var tags map[string]*string 192 err = json.Unmarshal(*v, &tags) 193 if err != nil { 194 return err 195 } 196 dp.Tags = tags 197 } 198 case "location": 199 if v != nil { 200 var location string 201 err = json.Unmarshal(*v, &location) 202 if err != nil { 203 return err 204 } 205 dp.Location = &location 206 } 207 case "id": 208 if v != nil { 209 var ID string 210 err = json.Unmarshal(*v, &ID) 211 if err != nil { 212 return err 213 } 214 dp.ID = &ID 215 } 216 case "name": 217 if v != nil { 218 var name string 219 err = json.Unmarshal(*v, &name) 220 if err != nil { 221 return err 222 } 223 dp.Name = &name 224 } 225 case "type": 226 if v != nil { 227 var typeVar string 228 err = json.Unmarshal(*v, &typeVar) 229 if err != nil { 230 return err 231 } 232 dp.Type = &typeVar 233 } 234 } 235 } 236 237 return nil 238} 239 240// DiskPoolListResult list of Disk Pools 241type DiskPoolListResult struct { 242 autorest.Response `json:"-"` 243 // Value - An array of Disk Pool objects. 244 Value *[]DiskPool `json:"value,omitempty"` 245 // NextLink - READ-ONLY; URI to fetch the next section of the paginated response. 246 NextLink *string `json:"nextLink,omitempty"` 247} 248 249// MarshalJSON is the custom marshaler for DiskPoolListResult. 250func (dplr DiskPoolListResult) MarshalJSON() ([]byte, error) { 251 objectMap := make(map[string]interface{}) 252 if dplr.Value != nil { 253 objectMap["value"] = dplr.Value 254 } 255 return json.Marshal(objectMap) 256} 257 258// DiskPoolListResultIterator provides access to a complete listing of DiskPool values. 259type DiskPoolListResultIterator struct { 260 i int 261 page DiskPoolListResultPage 262} 263 264// NextWithContext advances to the next value. If there was an error making 265// the request the iterator does not advance and the error is returned. 266func (iter *DiskPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { 267 if tracing.IsEnabled() { 268 ctx = tracing.StartSpan(ctx, fqdn+"/DiskPoolListResultIterator.NextWithContext") 269 defer func() { 270 sc := -1 271 if iter.Response().Response.Response != nil { 272 sc = iter.Response().Response.Response.StatusCode 273 } 274 tracing.EndSpan(ctx, sc, err) 275 }() 276 } 277 iter.i++ 278 if iter.i < len(iter.page.Values()) { 279 return nil 280 } 281 err = iter.page.NextWithContext(ctx) 282 if err != nil { 283 iter.i-- 284 return err 285 } 286 iter.i = 0 287 return nil 288} 289 290// Next advances to the next value. If there was an error making 291// the request the iterator does not advance and the error is returned. 292// Deprecated: Use NextWithContext() instead. 293func (iter *DiskPoolListResultIterator) Next() error { 294 return iter.NextWithContext(context.Background()) 295} 296 297// NotDone returns true if the enumeration should be started or is not yet complete. 298func (iter DiskPoolListResultIterator) NotDone() bool { 299 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 300} 301 302// Response returns the raw server response from the last page request. 303func (iter DiskPoolListResultIterator) Response() DiskPoolListResult { 304 return iter.page.Response() 305} 306 307// Value returns the current value or a zero-initialized value if the 308// iterator has advanced beyond the end of the collection. 309func (iter DiskPoolListResultIterator) Value() DiskPool { 310 if !iter.page.NotDone() { 311 return DiskPool{} 312 } 313 return iter.page.Values()[iter.i] 314} 315 316// Creates a new instance of the DiskPoolListResultIterator type. 317func NewDiskPoolListResultIterator(page DiskPoolListResultPage) DiskPoolListResultIterator { 318 return DiskPoolListResultIterator{page: page} 319} 320 321// IsEmpty returns true if the ListResult contains no values. 322func (dplr DiskPoolListResult) IsEmpty() bool { 323 return dplr.Value == nil || len(*dplr.Value) == 0 324} 325 326// hasNextLink returns true if the NextLink is not empty. 327func (dplr DiskPoolListResult) hasNextLink() bool { 328 return dplr.NextLink != nil && len(*dplr.NextLink) != 0 329} 330 331// diskPoolListResultPreparer prepares a request to retrieve the next set of results. 332// It returns nil if no more results exist. 333func (dplr DiskPoolListResult) diskPoolListResultPreparer(ctx context.Context) (*http.Request, error) { 334 if !dplr.hasNextLink() { 335 return nil, nil 336 } 337 return autorest.Prepare((&http.Request{}).WithContext(ctx), 338 autorest.AsJSON(), 339 autorest.AsGet(), 340 autorest.WithBaseURL(to.String(dplr.NextLink))) 341} 342 343// DiskPoolListResultPage contains a page of DiskPool values. 344type DiskPoolListResultPage struct { 345 fn func(context.Context, DiskPoolListResult) (DiskPoolListResult, error) 346 dplr DiskPoolListResult 347} 348 349// NextWithContext advances to the next page of values. If there was an error making 350// the request the page does not advance and the error is returned. 351func (page *DiskPoolListResultPage) NextWithContext(ctx context.Context) (err error) { 352 if tracing.IsEnabled() { 353 ctx = tracing.StartSpan(ctx, fqdn+"/DiskPoolListResultPage.NextWithContext") 354 defer func() { 355 sc := -1 356 if page.Response().Response.Response != nil { 357 sc = page.Response().Response.Response.StatusCode 358 } 359 tracing.EndSpan(ctx, sc, err) 360 }() 361 } 362 for { 363 next, err := page.fn(ctx, page.dplr) 364 if err != nil { 365 return err 366 } 367 page.dplr = next 368 if !next.hasNextLink() || !next.IsEmpty() { 369 break 370 } 371 } 372 return nil 373} 374 375// Next advances to the next page of values. If there was an error making 376// the request the page does not advance and the error is returned. 377// Deprecated: Use NextWithContext() instead. 378func (page *DiskPoolListResultPage) Next() error { 379 return page.NextWithContext(context.Background()) 380} 381 382// NotDone returns true if the page enumeration should be started or is not yet complete. 383func (page DiskPoolListResultPage) NotDone() bool { 384 return !page.dplr.IsEmpty() 385} 386 387// Response returns the raw server response from the last page request. 388func (page DiskPoolListResultPage) Response() DiskPoolListResult { 389 return page.dplr 390} 391 392// Values returns the slice of values for the current page or nil if there are no values. 393func (page DiskPoolListResultPage) Values() []DiskPool { 394 if page.dplr.IsEmpty() { 395 return nil 396 } 397 return *page.dplr.Value 398} 399 400// Creates a new instance of the DiskPoolListResultPage type. 401func NewDiskPoolListResultPage(cur DiskPoolListResult, getNextPage func(context.Context, DiskPoolListResult) (DiskPoolListResult, error)) DiskPoolListResultPage { 402 return DiskPoolListResultPage{ 403 fn: getNextPage, 404 dplr: cur, 405 } 406} 407 408// DiskPoolProperties properties section of the Disk Pool request payload. 409type DiskPoolProperties struct { 410 // ProvisioningState - READ-ONLY; State of the operation on the resource. Possible values include: 'ProvisioningStatesInvalid', 'ProvisioningStatesSucceeded', 'ProvisioningStatesFailed', 'ProvisioningStatesCanceled', 'ProvisioningStatesPending', 'ProvisioningStatesCreating', 'ProvisioningStatesUpdating', 'ProvisioningStatesDeleting' 411 ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` 412 // AvailabilityZones - Logical zone for DiskPool resource. 413 AvailabilityZones *[]string `json:"availabilityZones,omitempty"` 414 // Status - READ-ONLY; Operational status of the Disk pool. Possible values include: 'Invalid', 'Unknown', 'Healthy', 'Unhealthy' 415 Status OperationalStatus `json:"status,omitempty"` 416 // Disks - List of Azure managed disks to attach to a DiskPool 417 Disks *[]Disk `json:"disks,omitempty"` 418 // SubnetID - Azure resource id of the subnet for the DiskPool 419 SubnetID *string `json:"subnetId,omitempty"` 420} 421 422// MarshalJSON is the custom marshaler for DiskPoolProperties. 423func (dpp DiskPoolProperties) MarshalJSON() ([]byte, error) { 424 objectMap := make(map[string]interface{}) 425 if dpp.AvailabilityZones != nil { 426 objectMap["availabilityZones"] = dpp.AvailabilityZones 427 } 428 if dpp.Disks != nil { 429 objectMap["disks"] = dpp.Disks 430 } 431 if dpp.SubnetID != nil { 432 objectMap["subnetId"] = dpp.SubnetID 433 } 434 return json.Marshal(objectMap) 435} 436 437// DiskPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 438// operation. 439type DiskPoolsCreateOrUpdateFuture struct { 440 azure.FutureAPI 441 // Result returns the result of the asynchronous operation. 442 // If the operation has not completed it will return an error. 443 Result func(DiskPoolsClient) (DiskPool, error) 444} 445 446// DiskPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 447// operation. 448type DiskPoolsDeleteFuture struct { 449 azure.FutureAPI 450 // Result returns the result of the asynchronous operation. 451 // If the operation has not completed it will return an error. 452 Result func(DiskPoolsClient) (autorest.Response, error) 453} 454 455// Error the resource management error response. 456type Error struct { 457 // Error - RP error response 458 Error *ErrorResponse `json:"error,omitempty"` 459} 460 461// ErrorAdditionalInfo the resource management error additional info. 462type ErrorAdditionalInfo struct { 463 // Type - READ-ONLY; The additional info type. 464 Type *string `json:"type,omitempty"` 465 // Info - READ-ONLY; The additional info. 466 Info interface{} `json:"info,omitempty"` 467} 468 469// ErrorResponse the resource management error response. 470type ErrorResponse struct { 471 // Code - READ-ONLY; The error code. 472 Code *string `json:"code,omitempty"` 473 // Message - READ-ONLY; The error message. 474 Message *string `json:"message,omitempty"` 475 // Target - READ-ONLY; The error target. 476 Target *string `json:"target,omitempty"` 477 // Details - READ-ONLY; The error details. 478 Details *[]ErrorResponse `json:"details,omitempty"` 479 // AdditionalInfo - READ-ONLY; The error additional info. 480 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 481} 482 483// IscsiLun lun to expose the ManagedDisk. 484type IscsiLun struct { 485 // Name - Lun name. 486 Name *string `json:"name,omitempty"` 487 // ManagedDiskAzureResourceID - Unique Azure resource id of the managed disk. Required. 488 ManagedDiskAzureResourceID *string `json:"managedDiskAzureResourceId,omitempty"` 489} 490 491// IscsiTarget payload for iSCSI Target Create or Update requests. 492type IscsiTarget struct { 493 autorest.Response `json:"-"` 494 // IscsiTargetProperties - RP defined properties for iSCSI Target operations. 495 *IscsiTargetProperties `json:"properties,omitempty"` 496 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 497 ID *string `json:"id,omitempty"` 498 // Name - READ-ONLY; The name of the resource 499 Name *string `json:"name,omitempty"` 500 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 501 Type *string `json:"type,omitempty"` 502} 503 504// MarshalJSON is the custom marshaler for IscsiTarget. 505func (it IscsiTarget) MarshalJSON() ([]byte, error) { 506 objectMap := make(map[string]interface{}) 507 if it.IscsiTargetProperties != nil { 508 objectMap["properties"] = it.IscsiTargetProperties 509 } 510 return json.Marshal(objectMap) 511} 512 513// UnmarshalJSON is the custom unmarshaler for IscsiTarget struct. 514func (it *IscsiTarget) UnmarshalJSON(body []byte) error { 515 var m map[string]*json.RawMessage 516 err := json.Unmarshal(body, &m) 517 if err != nil { 518 return err 519 } 520 for k, v := range m { 521 switch k { 522 case "properties": 523 if v != nil { 524 var iscsiTargetProperties IscsiTargetProperties 525 err = json.Unmarshal(*v, &iscsiTargetProperties) 526 if err != nil { 527 return err 528 } 529 it.IscsiTargetProperties = &iscsiTargetProperties 530 } 531 case "id": 532 if v != nil { 533 var ID string 534 err = json.Unmarshal(*v, &ID) 535 if err != nil { 536 return err 537 } 538 it.ID = &ID 539 } 540 case "name": 541 if v != nil { 542 var name string 543 err = json.Unmarshal(*v, &name) 544 if err != nil { 545 return err 546 } 547 it.Name = &name 548 } 549 case "type": 550 if v != nil { 551 var typeVar string 552 err = json.Unmarshal(*v, &typeVar) 553 if err != nil { 554 return err 555 } 556 it.Type = &typeVar 557 } 558 } 559 } 560 561 return nil 562} 563 564// IscsiTargetCredentials CHAP credentials for an iSCSI target 565type IscsiTargetCredentials struct { 566 // Username - Username for Challenge Handshake Authentication Protocol (CHAP) authentication 567 Username *string `json:"username,omitempty"` 568 // Password - Password for Challenge Handshake Authentication Protocol (CHAP) authentication 569 Password *string `json:"password,omitempty"` 570} 571 572// IscsiTargetList list of iSCSI Targets. 573type IscsiTargetList struct { 574 autorest.Response `json:"-"` 575 // Value - An array of iSCSI targets within a Disk Pool. 576 Value *[]IscsiTarget `json:"value,omitempty"` 577 // NextLink - READ-ONLY; URI to fetch the next section of the paginated response. 578 NextLink *string `json:"nextLink,omitempty"` 579} 580 581// MarshalJSON is the custom marshaler for IscsiTargetList. 582func (itl IscsiTargetList) MarshalJSON() ([]byte, error) { 583 objectMap := make(map[string]interface{}) 584 if itl.Value != nil { 585 objectMap["value"] = itl.Value 586 } 587 return json.Marshal(objectMap) 588} 589 590// IscsiTargetListIterator provides access to a complete listing of IscsiTarget values. 591type IscsiTargetListIterator struct { 592 i int 593 page IscsiTargetListPage 594} 595 596// NextWithContext advances to the next value. If there was an error making 597// the request the iterator does not advance and the error is returned. 598func (iter *IscsiTargetListIterator) NextWithContext(ctx context.Context) (err error) { 599 if tracing.IsEnabled() { 600 ctx = tracing.StartSpan(ctx, fqdn+"/IscsiTargetListIterator.NextWithContext") 601 defer func() { 602 sc := -1 603 if iter.Response().Response.Response != nil { 604 sc = iter.Response().Response.Response.StatusCode 605 } 606 tracing.EndSpan(ctx, sc, err) 607 }() 608 } 609 iter.i++ 610 if iter.i < len(iter.page.Values()) { 611 return nil 612 } 613 err = iter.page.NextWithContext(ctx) 614 if err != nil { 615 iter.i-- 616 return err 617 } 618 iter.i = 0 619 return nil 620} 621 622// Next advances to the next value. If there was an error making 623// the request the iterator does not advance and the error is returned. 624// Deprecated: Use NextWithContext() instead. 625func (iter *IscsiTargetListIterator) Next() error { 626 return iter.NextWithContext(context.Background()) 627} 628 629// NotDone returns true if the enumeration should be started or is not yet complete. 630func (iter IscsiTargetListIterator) NotDone() bool { 631 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 632} 633 634// Response returns the raw server response from the last page request. 635func (iter IscsiTargetListIterator) Response() IscsiTargetList { 636 return iter.page.Response() 637} 638 639// Value returns the current value or a zero-initialized value if the 640// iterator has advanced beyond the end of the collection. 641func (iter IscsiTargetListIterator) Value() IscsiTarget { 642 if !iter.page.NotDone() { 643 return IscsiTarget{} 644 } 645 return iter.page.Values()[iter.i] 646} 647 648// Creates a new instance of the IscsiTargetListIterator type. 649func NewIscsiTargetListIterator(page IscsiTargetListPage) IscsiTargetListIterator { 650 return IscsiTargetListIterator{page: page} 651} 652 653// IsEmpty returns true if the ListResult contains no values. 654func (itl IscsiTargetList) IsEmpty() bool { 655 return itl.Value == nil || len(*itl.Value) == 0 656} 657 658// hasNextLink returns true if the NextLink is not empty. 659func (itl IscsiTargetList) hasNextLink() bool { 660 return itl.NextLink != nil && len(*itl.NextLink) != 0 661} 662 663// iscsiTargetListPreparer prepares a request to retrieve the next set of results. 664// It returns nil if no more results exist. 665func (itl IscsiTargetList) iscsiTargetListPreparer(ctx context.Context) (*http.Request, error) { 666 if !itl.hasNextLink() { 667 return nil, nil 668 } 669 return autorest.Prepare((&http.Request{}).WithContext(ctx), 670 autorest.AsJSON(), 671 autorest.AsGet(), 672 autorest.WithBaseURL(to.String(itl.NextLink))) 673} 674 675// IscsiTargetListPage contains a page of IscsiTarget values. 676type IscsiTargetListPage struct { 677 fn func(context.Context, IscsiTargetList) (IscsiTargetList, error) 678 itl IscsiTargetList 679} 680 681// NextWithContext advances to the next page of values. If there was an error making 682// the request the page does not advance and the error is returned. 683func (page *IscsiTargetListPage) NextWithContext(ctx context.Context) (err error) { 684 if tracing.IsEnabled() { 685 ctx = tracing.StartSpan(ctx, fqdn+"/IscsiTargetListPage.NextWithContext") 686 defer func() { 687 sc := -1 688 if page.Response().Response.Response != nil { 689 sc = page.Response().Response.Response.StatusCode 690 } 691 tracing.EndSpan(ctx, sc, err) 692 }() 693 } 694 for { 695 next, err := page.fn(ctx, page.itl) 696 if err != nil { 697 return err 698 } 699 page.itl = next 700 if !next.hasNextLink() || !next.IsEmpty() { 701 break 702 } 703 } 704 return nil 705} 706 707// Next advances to the next page of values. If there was an error making 708// the request the page does not advance and the error is returned. 709// Deprecated: Use NextWithContext() instead. 710func (page *IscsiTargetListPage) Next() error { 711 return page.NextWithContext(context.Background()) 712} 713 714// NotDone returns true if the page enumeration should be started or is not yet complete. 715func (page IscsiTargetListPage) NotDone() bool { 716 return !page.itl.IsEmpty() 717} 718 719// Response returns the raw server response from the last page request. 720func (page IscsiTargetListPage) Response() IscsiTargetList { 721 return page.itl 722} 723 724// Values returns the slice of values for the current page or nil if there are no values. 725func (page IscsiTargetListPage) Values() []IscsiTarget { 726 if page.itl.IsEmpty() { 727 return nil 728 } 729 return *page.itl.Value 730} 731 732// Creates a new instance of the IscsiTargetListPage type. 733func NewIscsiTargetListPage(cur IscsiTargetList, getNextPage func(context.Context, IscsiTargetList) (IscsiTargetList, error)) IscsiTargetListPage { 734 return IscsiTargetListPage{ 735 fn: getNextPage, 736 itl: cur, 737 } 738} 739 740// IscsiTargetProperties properties of iSCSI Target request payload. 741type IscsiTargetProperties struct { 742 // ProvisioningState - READ-ONLY; State of the operation on the resource. Possible values include: 'ProvisioningStatesInvalid', 'ProvisioningStatesSucceeded', 'ProvisioningStatesFailed', 'ProvisioningStatesCanceled', 'ProvisioningStatesPending', 'ProvisioningStatesCreating', 'ProvisioningStatesUpdating', 'ProvisioningStatesDeleting' 743 ProvisioningState ProvisioningStates `json:"provisioningState,omitempty"` 744 // Status - READ-ONLY; Operational status of the Disk pool. Possible values include: 'Invalid', 'Unknown', 'Healthy', 'Unhealthy' 745 Status OperationalStatus `json:"status,omitempty"` 746 // Tpgs - list of iSCSI target portal groups 747 Tpgs *[]TargetPortalGroup `json:"tpgs,omitempty"` 748 // TargetIqn - iSCSI target iqn (iSCSI Qualified Name); example: iqn.2005-03.org.iscsi:server 749 TargetIqn *string `json:"targetIqn,omitempty"` 750} 751 752// MarshalJSON is the custom marshaler for IscsiTargetProperties. 753func (itp IscsiTargetProperties) MarshalJSON() ([]byte, error) { 754 objectMap := make(map[string]interface{}) 755 if itp.Tpgs != nil { 756 objectMap["tpgs"] = itp.Tpgs 757 } 758 if itp.TargetIqn != nil { 759 objectMap["targetIqn"] = itp.TargetIqn 760 } 761 return json.Marshal(objectMap) 762} 763 764// IscsiTargetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 765// long-running operation. 766type IscsiTargetsCreateOrUpdateFuture struct { 767 azure.FutureAPI 768 // Result returns the result of the asynchronous operation. 769 // If the operation has not completed it will return an error. 770 Result func(IscsiTargetsClient) (IscsiTarget, error) 771} 772 773// IscsiTargetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 774// operation. 775type IscsiTargetsDeleteFuture struct { 776 azure.FutureAPI 777 // Result returns the result of the asynchronous operation. 778 // If the operation has not completed it will return an error. 779 Result func(IscsiTargetsClient) (autorest.Response, error) 780} 781 782// OperationDisplay metadata about an operation. 783type OperationDisplay struct { 784 // Provider - Localized friendly form of the resource provider name. 785 Provider *string `json:"provider,omitempty"` 786 // Resource - Localized friendly form of the resource type related to this action/operation. 787 Resource *string `json:"resource,omitempty"` 788 // Operation - Localized friendly name for the operation, as it should be shown to the user. 789 Operation *string `json:"operation,omitempty"` 790 // Description - Localized friendly description for the operation, as it should be shown to the user. 791 Description *string `json:"description,omitempty"` 792} 793 794// OperationListResult list of operations supported by the RP. 795type OperationListResult struct { 796 autorest.Response `json:"-"` 797 // Value - An array of operations supported by the StoragePool RP. 798 Value *[]RPOperation `json:"value,omitempty"` 799 // NextLink - URI to fetch the next section of the paginated response. 800 NextLink *string `json:"nextLink,omitempty"` 801} 802 803// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than 804// required location and tags 805type ProxyResource struct { 806 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 807 ID *string `json:"id,omitempty"` 808 // Name - READ-ONLY; The name of the resource 809 Name *string `json:"name,omitempty"` 810 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 811 Type *string `json:"type,omitempty"` 812} 813 814// Resource ARM resource model definition. 815type Resource struct { 816 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 817 ID *string `json:"id,omitempty"` 818 // Name - READ-ONLY; The name of the resource 819 Name *string `json:"name,omitempty"` 820 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 821 Type *string `json:"type,omitempty"` 822} 823 824// RPOperation description of a StoragePool RP Operation 825type RPOperation struct { 826 // Name - The name of the operation being performed on this particular object 827 Name *string `json:"name,omitempty"` 828 // IsDataAction - Indicates whether the operation applies to data-plane. 829 IsDataAction *bool `json:"isDataAction,omitempty"` 830 // ActionType - Indicates the action type. 831 ActionType *string `json:"actionType,omitempty"` 832 // Display - Additional metadata about RP operation. 833 Display *OperationDisplay `json:"display,omitempty"` 834 // Origin - The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. 835 Origin *string `json:"origin,omitempty"` 836} 837 838// Sku the resource model definition representing SKU 839type Sku struct { 840 // Name - The name of the SKU. Ex - P3. It is typically a letter+number code 841 Name *string `json:"name,omitempty"` 842 // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' 843 Tier SkuTier `json:"tier,omitempty"` 844 // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. 845 Size *string `json:"size,omitempty"` 846 // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. 847 Family *string `json:"family,omitempty"` 848 // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. 849 Capacity *int32 `json:"capacity,omitempty"` 850} 851 852// SystemMetadata resource metadata required by ARM RPC 853type SystemMetadata struct { 854 // CreatedBy - A string identifier for the identity that created the resource. 855 CreatedBy *string `json:"createdBy,omitempty"` 856 // CreatedByType - The type of identity that created the resource: user, application, managedIdentity 857 CreatedByType *string `json:"createdByType,omitempty"` 858 // CreatedAt - The timestamp of resource creation (UTC) 859 CreatedAt *string `json:"createdAt,omitempty"` 860 // LastModifiedBy - A string identifier for the identity that last modified the resource 861 LastModifiedBy *string `json:"lastModifiedBy,omitempty"` 862 // LastModifiedByType - The type of identity that last modified the resource: user, application, managedIdentity 863 LastModifiedByType *string `json:"lastModifiedByType,omitempty"` 864 // LastModifiedAt - The timestamp of resource last modification (UTC) 865 LastModifiedAt *string `json:"lastModifiedAt,omitempty"` 866} 867 868// TargetPortalGroup iSCSI target portal group 869type TargetPortalGroup struct { 870 // Luns - Lun list to be exposed through the iSCSI target. Required 871 Luns *[]IscsiLun `json:"luns,omitempty"` 872 // Acls - Access Control List (ACL) for an iSCSI target lun 873 Acls *[]ACL `json:"acls,omitempty"` 874 // Attributes - Attributes of an iSCSI target 875 Attributes *Attributes `json:"attributes,omitempty"` 876 // Endpoints - READ-ONLY; list of public ip addresses to connect to the iSCSI target 877 Endpoints *[]string `json:"endpoints,omitempty"` 878 // Tag - READ-ONLY; The tag associated with the iSCSI target portal group 879 Tag *int32 `json:"tag,omitempty"` 880 // Port - READ-ONLY; The port at which the iSCSI target is available 881 Port *int32 `json:"port,omitempty"` 882} 883 884// MarshalJSON is the custom marshaler for TargetPortalGroup. 885func (tpg TargetPortalGroup) MarshalJSON() ([]byte, error) { 886 objectMap := make(map[string]interface{}) 887 if tpg.Luns != nil { 888 objectMap["luns"] = tpg.Luns 889 } 890 if tpg.Acls != nil { 891 objectMap["acls"] = tpg.Acls 892 } 893 if tpg.Attributes != nil { 894 objectMap["attributes"] = tpg.Attributes 895 } 896 return json.Marshal(objectMap) 897} 898 899// TrackedResource the resource model definition for a ARM tracked top level resource 900type TrackedResource struct { 901 // Tags - Resource tags. 902 Tags map[string]*string `json:"tags"` 903 // Location - The geo-location where the resource lives 904 Location *string `json:"location,omitempty"` 905 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 906 ID *string `json:"id,omitempty"` 907 // Name - READ-ONLY; The name of the resource 908 Name *string `json:"name,omitempty"` 909 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 910 Type *string `json:"type,omitempty"` 911} 912 913// MarshalJSON is the custom marshaler for TrackedResource. 914func (tr TrackedResource) MarshalJSON() ([]byte, error) { 915 objectMap := make(map[string]interface{}) 916 if tr.Tags != nil { 917 objectMap["tags"] = tr.Tags 918 } 919 if tr.Location != nil { 920 objectMap["location"] = tr.Location 921 } 922 return json.Marshal(objectMap) 923} 924