1package sql 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/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "github.com/gofrs/uuid" 18 "net/http" 19) 20 21// The package's fully qualified name. 22const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2018-06-01-preview/sql" 23 24// AdministratorListResult a list of active directory administrators. 25type AdministratorListResult struct { 26 autorest.Response `json:"-"` 27 // Value - READ-ONLY; Array of results. 28 Value *[]ServerAzureADAdministrator `json:"value,omitempty"` 29 // NextLink - READ-ONLY; Link to retrieve next page of results. 30 NextLink *string `json:"nextLink,omitempty"` 31} 32 33// MarshalJSON is the custom marshaler for AdministratorListResult. 34func (alr AdministratorListResult) MarshalJSON() ([]byte, error) { 35 objectMap := make(map[string]interface{}) 36 return json.Marshal(objectMap) 37} 38 39// AdministratorListResultIterator provides access to a complete listing of ServerAzureADAdministrator 40// values. 41type AdministratorListResultIterator struct { 42 i int 43 page AdministratorListResultPage 44} 45 46// NextWithContext advances to the next value. If there was an error making 47// the request the iterator does not advance and the error is returned. 48func (iter *AdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) { 49 if tracing.IsEnabled() { 50 ctx = tracing.StartSpan(ctx, fqdn+"/AdministratorListResultIterator.NextWithContext") 51 defer func() { 52 sc := -1 53 if iter.Response().Response.Response != nil { 54 sc = iter.Response().Response.Response.StatusCode 55 } 56 tracing.EndSpan(ctx, sc, err) 57 }() 58 } 59 iter.i++ 60 if iter.i < len(iter.page.Values()) { 61 return nil 62 } 63 err = iter.page.NextWithContext(ctx) 64 if err != nil { 65 iter.i-- 66 return err 67 } 68 iter.i = 0 69 return nil 70} 71 72// Next advances to the next value. If there was an error making 73// the request the iterator does not advance and the error is returned. 74// Deprecated: Use NextWithContext() instead. 75func (iter *AdministratorListResultIterator) Next() error { 76 return iter.NextWithContext(context.Background()) 77} 78 79// NotDone returns true if the enumeration should be started or is not yet complete. 80func (iter AdministratorListResultIterator) NotDone() bool { 81 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 82} 83 84// Response returns the raw server response from the last page request. 85func (iter AdministratorListResultIterator) Response() AdministratorListResult { 86 return iter.page.Response() 87} 88 89// Value returns the current value or a zero-initialized value if the 90// iterator has advanced beyond the end of the collection. 91func (iter AdministratorListResultIterator) Value() ServerAzureADAdministrator { 92 if !iter.page.NotDone() { 93 return ServerAzureADAdministrator{} 94 } 95 return iter.page.Values()[iter.i] 96} 97 98// Creates a new instance of the AdministratorListResultIterator type. 99func NewAdministratorListResultIterator(page AdministratorListResultPage) AdministratorListResultIterator { 100 return AdministratorListResultIterator{page: page} 101} 102 103// IsEmpty returns true if the ListResult contains no values. 104func (alr AdministratorListResult) IsEmpty() bool { 105 return alr.Value == nil || len(*alr.Value) == 0 106} 107 108// hasNextLink returns true if the NextLink is not empty. 109func (alr AdministratorListResult) hasNextLink() bool { 110 return alr.NextLink != nil && len(*alr.NextLink) != 0 111} 112 113// administratorListResultPreparer prepares a request to retrieve the next set of results. 114// It returns nil if no more results exist. 115func (alr AdministratorListResult) administratorListResultPreparer(ctx context.Context) (*http.Request, error) { 116 if !alr.hasNextLink() { 117 return nil, nil 118 } 119 return autorest.Prepare((&http.Request{}).WithContext(ctx), 120 autorest.AsJSON(), 121 autorest.AsGet(), 122 autorest.WithBaseURL(to.String(alr.NextLink))) 123} 124 125// AdministratorListResultPage contains a page of ServerAzureADAdministrator values. 126type AdministratorListResultPage struct { 127 fn func(context.Context, AdministratorListResult) (AdministratorListResult, error) 128 alr AdministratorListResult 129} 130 131// NextWithContext advances to the next page of values. If there was an error making 132// the request the page does not advance and the error is returned. 133func (page *AdministratorListResultPage) NextWithContext(ctx context.Context) (err error) { 134 if tracing.IsEnabled() { 135 ctx = tracing.StartSpan(ctx, fqdn+"/AdministratorListResultPage.NextWithContext") 136 defer func() { 137 sc := -1 138 if page.Response().Response.Response != nil { 139 sc = page.Response().Response.Response.StatusCode 140 } 141 tracing.EndSpan(ctx, sc, err) 142 }() 143 } 144 for { 145 next, err := page.fn(ctx, page.alr) 146 if err != nil { 147 return err 148 } 149 page.alr = next 150 if !next.hasNextLink() || !next.IsEmpty() { 151 break 152 } 153 } 154 return nil 155} 156 157// Next advances to the next page of values. If there was an error making 158// the request the page does not advance and the error is returned. 159// Deprecated: Use NextWithContext() instead. 160func (page *AdministratorListResultPage) Next() error { 161 return page.NextWithContext(context.Background()) 162} 163 164// NotDone returns true if the page enumeration should be started or is not yet complete. 165func (page AdministratorListResultPage) NotDone() bool { 166 return !page.alr.IsEmpty() 167} 168 169// Response returns the raw server response from the last page request. 170func (page AdministratorListResultPage) Response() AdministratorListResult { 171 return page.alr 172} 173 174// Values returns the slice of values for the current page or nil if there are no values. 175func (page AdministratorListResultPage) Values() []ServerAzureADAdministrator { 176 if page.alr.IsEmpty() { 177 return nil 178 } 179 return *page.alr.Value 180} 181 182// Creates a new instance of the AdministratorListResultPage type. 183func NewAdministratorListResultPage(cur AdministratorListResult, getNextPage func(context.Context, AdministratorListResult) (AdministratorListResult, error)) AdministratorListResultPage { 184 return AdministratorListResultPage{ 185 fn: getNextPage, 186 alr: cur, 187 } 188} 189 190// AdministratorProperties properties of a active directory administrator. 191type AdministratorProperties struct { 192 // AdministratorType - Type of the sever administrator. 193 AdministratorType *string `json:"administratorType,omitempty"` 194 // Login - Login name of the server administrator. 195 Login *string `json:"login,omitempty"` 196 // Sid - SID (object ID) of the server administrator. 197 Sid *uuid.UUID `json:"sid,omitempty"` 198 // TenantID - Tenant ID of the administrator. 199 TenantID *uuid.UUID `json:"tenantId,omitempty"` 200} 201 202// BaseLongTermRetentionPolicyProperties properties of a long term retention policy 203type BaseLongTermRetentionPolicyProperties struct { 204 // WeeklyRetention - The weekly retention policy for an LTR backup in an ISO 8601 format. 205 WeeklyRetention *string `json:"weeklyRetention,omitempty"` 206 // MonthlyRetention - The monthly retention policy for an LTR backup in an ISO 8601 format. 207 MonthlyRetention *string `json:"monthlyRetention,omitempty"` 208 // YearlyRetention - The yearly retention policy for an LTR backup in an ISO 8601 format. 209 YearlyRetention *string `json:"yearlyRetention,omitempty"` 210 // WeekOfYear - The week of year to take the yearly backup in an ISO 8601 format. 211 WeekOfYear *int32 `json:"weekOfYear,omitempty"` 212} 213 214// CompleteDatabaseRestoreDefinition contains the information necessary to perform a complete database 215// restore operation. 216type CompleteDatabaseRestoreDefinition struct { 217 // LastBackupName - The last backup name to apply 218 LastBackupName *string `json:"lastBackupName,omitempty"` 219} 220 221// DatabaseSecurityAlertListResult a list of the database's security alert policies. 222type DatabaseSecurityAlertListResult struct { 223 autorest.Response `json:"-"` 224 // Value - READ-ONLY; Array of results. 225 Value *[]DatabaseSecurityAlertPolicy `json:"value,omitempty"` 226 // NextLink - READ-ONLY; Link to retrieve next page of results. 227 NextLink *string `json:"nextLink,omitempty"` 228} 229 230// MarshalJSON is the custom marshaler for DatabaseSecurityAlertListResult. 231func (dsalr DatabaseSecurityAlertListResult) MarshalJSON() ([]byte, error) { 232 objectMap := make(map[string]interface{}) 233 return json.Marshal(objectMap) 234} 235 236// DatabaseSecurityAlertListResultIterator provides access to a complete listing of 237// DatabaseSecurityAlertPolicy values. 238type DatabaseSecurityAlertListResultIterator struct { 239 i int 240 page DatabaseSecurityAlertListResultPage 241} 242 243// NextWithContext advances to the next value. If there was an error making 244// the request the iterator does not advance and the error is returned. 245func (iter *DatabaseSecurityAlertListResultIterator) NextWithContext(ctx context.Context) (err error) { 246 if tracing.IsEnabled() { 247 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseSecurityAlertListResultIterator.NextWithContext") 248 defer func() { 249 sc := -1 250 if iter.Response().Response.Response != nil { 251 sc = iter.Response().Response.Response.StatusCode 252 } 253 tracing.EndSpan(ctx, sc, err) 254 }() 255 } 256 iter.i++ 257 if iter.i < len(iter.page.Values()) { 258 return nil 259 } 260 err = iter.page.NextWithContext(ctx) 261 if err != nil { 262 iter.i-- 263 return err 264 } 265 iter.i = 0 266 return nil 267} 268 269// Next advances to the next value. If there was an error making 270// the request the iterator does not advance and the error is returned. 271// Deprecated: Use NextWithContext() instead. 272func (iter *DatabaseSecurityAlertListResultIterator) Next() error { 273 return iter.NextWithContext(context.Background()) 274} 275 276// NotDone returns true if the enumeration should be started or is not yet complete. 277func (iter DatabaseSecurityAlertListResultIterator) NotDone() bool { 278 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 279} 280 281// Response returns the raw server response from the last page request. 282func (iter DatabaseSecurityAlertListResultIterator) Response() DatabaseSecurityAlertListResult { 283 return iter.page.Response() 284} 285 286// Value returns the current value or a zero-initialized value if the 287// iterator has advanced beyond the end of the collection. 288func (iter DatabaseSecurityAlertListResultIterator) Value() DatabaseSecurityAlertPolicy { 289 if !iter.page.NotDone() { 290 return DatabaseSecurityAlertPolicy{} 291 } 292 return iter.page.Values()[iter.i] 293} 294 295// Creates a new instance of the DatabaseSecurityAlertListResultIterator type. 296func NewDatabaseSecurityAlertListResultIterator(page DatabaseSecurityAlertListResultPage) DatabaseSecurityAlertListResultIterator { 297 return DatabaseSecurityAlertListResultIterator{page: page} 298} 299 300// IsEmpty returns true if the ListResult contains no values. 301func (dsalr DatabaseSecurityAlertListResult) IsEmpty() bool { 302 return dsalr.Value == nil || len(*dsalr.Value) == 0 303} 304 305// hasNextLink returns true if the NextLink is not empty. 306func (dsalr DatabaseSecurityAlertListResult) hasNextLink() bool { 307 return dsalr.NextLink != nil && len(*dsalr.NextLink) != 0 308} 309 310// databaseSecurityAlertListResultPreparer prepares a request to retrieve the next set of results. 311// It returns nil if no more results exist. 312func (dsalr DatabaseSecurityAlertListResult) databaseSecurityAlertListResultPreparer(ctx context.Context) (*http.Request, error) { 313 if !dsalr.hasNextLink() { 314 return nil, nil 315 } 316 return autorest.Prepare((&http.Request{}).WithContext(ctx), 317 autorest.AsJSON(), 318 autorest.AsGet(), 319 autorest.WithBaseURL(to.String(dsalr.NextLink))) 320} 321 322// DatabaseSecurityAlertListResultPage contains a page of DatabaseSecurityAlertPolicy values. 323type DatabaseSecurityAlertListResultPage struct { 324 fn func(context.Context, DatabaseSecurityAlertListResult) (DatabaseSecurityAlertListResult, error) 325 dsalr DatabaseSecurityAlertListResult 326} 327 328// NextWithContext advances to the next page of values. If there was an error making 329// the request the page does not advance and the error is returned. 330func (page *DatabaseSecurityAlertListResultPage) NextWithContext(ctx context.Context) (err error) { 331 if tracing.IsEnabled() { 332 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseSecurityAlertListResultPage.NextWithContext") 333 defer func() { 334 sc := -1 335 if page.Response().Response.Response != nil { 336 sc = page.Response().Response.Response.StatusCode 337 } 338 tracing.EndSpan(ctx, sc, err) 339 }() 340 } 341 for { 342 next, err := page.fn(ctx, page.dsalr) 343 if err != nil { 344 return err 345 } 346 page.dsalr = next 347 if !next.hasNextLink() || !next.IsEmpty() { 348 break 349 } 350 } 351 return nil 352} 353 354// Next advances to the next page of values. If there was an error making 355// the request the page does not advance and the error is returned. 356// Deprecated: Use NextWithContext() instead. 357func (page *DatabaseSecurityAlertListResultPage) Next() error { 358 return page.NextWithContext(context.Background()) 359} 360 361// NotDone returns true if the page enumeration should be started or is not yet complete. 362func (page DatabaseSecurityAlertListResultPage) NotDone() bool { 363 return !page.dsalr.IsEmpty() 364} 365 366// Response returns the raw server response from the last page request. 367func (page DatabaseSecurityAlertListResultPage) Response() DatabaseSecurityAlertListResult { 368 return page.dsalr 369} 370 371// Values returns the slice of values for the current page or nil if there are no values. 372func (page DatabaseSecurityAlertListResultPage) Values() []DatabaseSecurityAlertPolicy { 373 if page.dsalr.IsEmpty() { 374 return nil 375 } 376 return *page.dsalr.Value 377} 378 379// Creates a new instance of the DatabaseSecurityAlertListResultPage type. 380func NewDatabaseSecurityAlertListResultPage(cur DatabaseSecurityAlertListResult, getNextPage func(context.Context, DatabaseSecurityAlertListResult) (DatabaseSecurityAlertListResult, error)) DatabaseSecurityAlertListResultPage { 381 return DatabaseSecurityAlertListResultPage{ 382 fn: getNextPage, 383 dsalr: cur, 384 } 385} 386 387// DatabaseSecurityAlertPolicy a database security alert policy. 388type DatabaseSecurityAlertPolicy struct { 389 autorest.Response `json:"-"` 390 // SecurityAlertPolicyProperties - Resource properties. 391 *SecurityAlertPolicyProperties `json:"properties,omitempty"` 392 // ID - READ-ONLY; Resource ID. 393 ID *string `json:"id,omitempty"` 394 // Name - READ-ONLY; Resource name. 395 Name *string `json:"name,omitempty"` 396 // Type - READ-ONLY; Resource type. 397 Type *string `json:"type,omitempty"` 398} 399 400// MarshalJSON is the custom marshaler for DatabaseSecurityAlertPolicy. 401func (dsap DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { 402 objectMap := make(map[string]interface{}) 403 if dsap.SecurityAlertPolicyProperties != nil { 404 objectMap["properties"] = dsap.SecurityAlertPolicyProperties 405 } 406 return json.Marshal(objectMap) 407} 408 409// UnmarshalJSON is the custom unmarshaler for DatabaseSecurityAlertPolicy struct. 410func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { 411 var m map[string]*json.RawMessage 412 err := json.Unmarshal(body, &m) 413 if err != nil { 414 return err 415 } 416 for k, v := range m { 417 switch k { 418 case "properties": 419 if v != nil { 420 var securityAlertPolicyProperties SecurityAlertPolicyProperties 421 err = json.Unmarshal(*v, &securityAlertPolicyProperties) 422 if err != nil { 423 return err 424 } 425 dsap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties 426 } 427 case "id": 428 if v != nil { 429 var ID string 430 err = json.Unmarshal(*v, &ID) 431 if err != nil { 432 return err 433 } 434 dsap.ID = &ID 435 } 436 case "name": 437 if v != nil { 438 var name string 439 err = json.Unmarshal(*v, &name) 440 if err != nil { 441 return err 442 } 443 dsap.Name = &name 444 } 445 case "type": 446 if v != nil { 447 var typeVar string 448 err = json.Unmarshal(*v, &typeVar) 449 if err != nil { 450 return err 451 } 452 dsap.Type = &typeVar 453 } 454 } 455 } 456 457 return nil 458} 459 460// DatabasesFailoverFuture an abstraction for monitoring and retrieving the results of a long-running 461// operation. 462type DatabasesFailoverFuture struct { 463 azure.FutureAPI 464 // Result returns the result of the asynchronous operation. 465 // If the operation has not completed it will return an error. 466 Result func(DatabasesClient) (autorest.Response, error) 467} 468 469// UnmarshalJSON is the custom unmarshaller for CreateFuture. 470func (future *DatabasesFailoverFuture) UnmarshalJSON(body []byte) error { 471 var azFuture azure.Future 472 if err := json.Unmarshal(body, &azFuture); err != nil { 473 return err 474 } 475 future.FutureAPI = &azFuture 476 future.Result = future.result 477 return nil 478} 479 480// result is the default implementation for DatabasesFailoverFuture.Result. 481func (future *DatabasesFailoverFuture) result(client DatabasesClient) (ar autorest.Response, err error) { 482 var done bool 483 done, err = future.DoneWithContext(context.Background(), client) 484 if err != nil { 485 err = autorest.NewErrorWithError(err, "sql.DatabasesFailoverFuture", "Result", future.Response(), "Polling failure") 486 return 487 } 488 if !done { 489 ar.Response = future.Response() 490 err = azure.NewAsyncOpIncompleteError("sql.DatabasesFailoverFuture") 491 return 492 } 493 ar.Response = future.Response() 494 return 495} 496 497// ElasticPoolsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running 498// operation. 499type ElasticPoolsFailoverFuture struct { 500 azure.FutureAPI 501 // Result returns the result of the asynchronous operation. 502 // If the operation has not completed it will return an error. 503 Result func(ElasticPoolsClient) (autorest.Response, error) 504} 505 506// UnmarshalJSON is the custom unmarshaller for CreateFuture. 507func (future *ElasticPoolsFailoverFuture) UnmarshalJSON(body []byte) error { 508 var azFuture azure.Future 509 if err := json.Unmarshal(body, &azFuture); err != nil { 510 return err 511 } 512 future.FutureAPI = &azFuture 513 future.Result = future.result 514 return nil 515} 516 517// result is the default implementation for ElasticPoolsFailoverFuture.Result. 518func (future *ElasticPoolsFailoverFuture) result(client ElasticPoolsClient) (ar autorest.Response, err error) { 519 var done bool 520 done, err = future.DoneWithContext(context.Background(), client) 521 if err != nil { 522 err = autorest.NewErrorWithError(err, "sql.ElasticPoolsFailoverFuture", "Result", future.Response(), "Polling failure") 523 return 524 } 525 if !done { 526 ar.Response = future.Response() 527 err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsFailoverFuture") 528 return 529 } 530 ar.Response = future.Response() 531 return 532} 533 534// InstancePool an Azure SQL instance pool. 535type InstancePool struct { 536 autorest.Response `json:"-"` 537 // Sku - The name and tier of the SKU. 538 Sku *Sku `json:"sku,omitempty"` 539 // InstancePoolProperties - Resource properties. 540 *InstancePoolProperties `json:"properties,omitempty"` 541 // Location - Resource location. 542 Location *string `json:"location,omitempty"` 543 // Tags - Resource tags. 544 Tags map[string]*string `json:"tags"` 545 // ID - READ-ONLY; Resource ID. 546 ID *string `json:"id,omitempty"` 547 // Name - READ-ONLY; Resource name. 548 Name *string `json:"name,omitempty"` 549 // Type - READ-ONLY; Resource type. 550 Type *string `json:"type,omitempty"` 551} 552 553// MarshalJSON is the custom marshaler for InstancePool. 554func (IP InstancePool) MarshalJSON() ([]byte, error) { 555 objectMap := make(map[string]interface{}) 556 if IP.Sku != nil { 557 objectMap["sku"] = IP.Sku 558 } 559 if IP.InstancePoolProperties != nil { 560 objectMap["properties"] = IP.InstancePoolProperties 561 } 562 if IP.Location != nil { 563 objectMap["location"] = IP.Location 564 } 565 if IP.Tags != nil { 566 objectMap["tags"] = IP.Tags 567 } 568 return json.Marshal(objectMap) 569} 570 571// UnmarshalJSON is the custom unmarshaler for InstancePool struct. 572func (IP *InstancePool) UnmarshalJSON(body []byte) error { 573 var m map[string]*json.RawMessage 574 err := json.Unmarshal(body, &m) 575 if err != nil { 576 return err 577 } 578 for k, v := range m { 579 switch k { 580 case "sku": 581 if v != nil { 582 var sku Sku 583 err = json.Unmarshal(*v, &sku) 584 if err != nil { 585 return err 586 } 587 IP.Sku = &sku 588 } 589 case "properties": 590 if v != nil { 591 var instancePoolProperties InstancePoolProperties 592 err = json.Unmarshal(*v, &instancePoolProperties) 593 if err != nil { 594 return err 595 } 596 IP.InstancePoolProperties = &instancePoolProperties 597 } 598 case "location": 599 if v != nil { 600 var location string 601 err = json.Unmarshal(*v, &location) 602 if err != nil { 603 return err 604 } 605 IP.Location = &location 606 } 607 case "tags": 608 if v != nil { 609 var tags map[string]*string 610 err = json.Unmarshal(*v, &tags) 611 if err != nil { 612 return err 613 } 614 IP.Tags = tags 615 } 616 case "id": 617 if v != nil { 618 var ID string 619 err = json.Unmarshal(*v, &ID) 620 if err != nil { 621 return err 622 } 623 IP.ID = &ID 624 } 625 case "name": 626 if v != nil { 627 var name string 628 err = json.Unmarshal(*v, &name) 629 if err != nil { 630 return err 631 } 632 IP.Name = &name 633 } 634 case "type": 635 if v != nil { 636 var typeVar string 637 err = json.Unmarshal(*v, &typeVar) 638 if err != nil { 639 return err 640 } 641 IP.Type = &typeVar 642 } 643 } 644 } 645 646 return nil 647} 648 649// InstancePoolListResult a list of Azure SQL instance pools. 650type InstancePoolListResult struct { 651 autorest.Response `json:"-"` 652 // Value - READ-ONLY; Array of results. 653 Value *[]InstancePool `json:"value,omitempty"` 654 // NextLink - READ-ONLY; Link to retrieve next page of results. 655 NextLink *string `json:"nextLink,omitempty"` 656} 657 658// MarshalJSON is the custom marshaler for InstancePoolListResult. 659func (iplr InstancePoolListResult) MarshalJSON() ([]byte, error) { 660 objectMap := make(map[string]interface{}) 661 return json.Marshal(objectMap) 662} 663 664// InstancePoolListResultIterator provides access to a complete listing of InstancePool values. 665type InstancePoolListResultIterator struct { 666 i int 667 page InstancePoolListResultPage 668} 669 670// NextWithContext advances to the next value. If there was an error making 671// the request the iterator does not advance and the error is returned. 672func (iter *InstancePoolListResultIterator) NextWithContext(ctx context.Context) (err error) { 673 if tracing.IsEnabled() { 674 ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolListResultIterator.NextWithContext") 675 defer func() { 676 sc := -1 677 if iter.Response().Response.Response != nil { 678 sc = iter.Response().Response.Response.StatusCode 679 } 680 tracing.EndSpan(ctx, sc, err) 681 }() 682 } 683 iter.i++ 684 if iter.i < len(iter.page.Values()) { 685 return nil 686 } 687 err = iter.page.NextWithContext(ctx) 688 if err != nil { 689 iter.i-- 690 return err 691 } 692 iter.i = 0 693 return nil 694} 695 696// Next advances to the next value. If there was an error making 697// the request the iterator does not advance and the error is returned. 698// Deprecated: Use NextWithContext() instead. 699func (iter *InstancePoolListResultIterator) Next() error { 700 return iter.NextWithContext(context.Background()) 701} 702 703// NotDone returns true if the enumeration should be started or is not yet complete. 704func (iter InstancePoolListResultIterator) NotDone() bool { 705 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 706} 707 708// Response returns the raw server response from the last page request. 709func (iter InstancePoolListResultIterator) Response() InstancePoolListResult { 710 return iter.page.Response() 711} 712 713// Value returns the current value or a zero-initialized value if the 714// iterator has advanced beyond the end of the collection. 715func (iter InstancePoolListResultIterator) Value() InstancePool { 716 if !iter.page.NotDone() { 717 return InstancePool{} 718 } 719 return iter.page.Values()[iter.i] 720} 721 722// Creates a new instance of the InstancePoolListResultIterator type. 723func NewInstancePoolListResultIterator(page InstancePoolListResultPage) InstancePoolListResultIterator { 724 return InstancePoolListResultIterator{page: page} 725} 726 727// IsEmpty returns true if the ListResult contains no values. 728func (iplr InstancePoolListResult) IsEmpty() bool { 729 return iplr.Value == nil || len(*iplr.Value) == 0 730} 731 732// hasNextLink returns true if the NextLink is not empty. 733func (iplr InstancePoolListResult) hasNextLink() bool { 734 return iplr.NextLink != nil && len(*iplr.NextLink) != 0 735} 736 737// instancePoolListResultPreparer prepares a request to retrieve the next set of results. 738// It returns nil if no more results exist. 739func (iplr InstancePoolListResult) instancePoolListResultPreparer(ctx context.Context) (*http.Request, error) { 740 if !iplr.hasNextLink() { 741 return nil, nil 742 } 743 return autorest.Prepare((&http.Request{}).WithContext(ctx), 744 autorest.AsJSON(), 745 autorest.AsGet(), 746 autorest.WithBaseURL(to.String(iplr.NextLink))) 747} 748 749// InstancePoolListResultPage contains a page of InstancePool values. 750type InstancePoolListResultPage struct { 751 fn func(context.Context, InstancePoolListResult) (InstancePoolListResult, error) 752 iplr InstancePoolListResult 753} 754 755// NextWithContext advances to the next page of values. If there was an error making 756// the request the page does not advance and the error is returned. 757func (page *InstancePoolListResultPage) NextWithContext(ctx context.Context) (err error) { 758 if tracing.IsEnabled() { 759 ctx = tracing.StartSpan(ctx, fqdn+"/InstancePoolListResultPage.NextWithContext") 760 defer func() { 761 sc := -1 762 if page.Response().Response.Response != nil { 763 sc = page.Response().Response.Response.StatusCode 764 } 765 tracing.EndSpan(ctx, sc, err) 766 }() 767 } 768 for { 769 next, err := page.fn(ctx, page.iplr) 770 if err != nil { 771 return err 772 } 773 page.iplr = next 774 if !next.hasNextLink() || !next.IsEmpty() { 775 break 776 } 777 } 778 return nil 779} 780 781// Next advances to the next page of values. If there was an error making 782// the request the page does not advance and the error is returned. 783// Deprecated: Use NextWithContext() instead. 784func (page *InstancePoolListResultPage) Next() error { 785 return page.NextWithContext(context.Background()) 786} 787 788// NotDone returns true if the page enumeration should be started or is not yet complete. 789func (page InstancePoolListResultPage) NotDone() bool { 790 return !page.iplr.IsEmpty() 791} 792 793// Response returns the raw server response from the last page request. 794func (page InstancePoolListResultPage) Response() InstancePoolListResult { 795 return page.iplr 796} 797 798// Values returns the slice of values for the current page or nil if there are no values. 799func (page InstancePoolListResultPage) Values() []InstancePool { 800 if page.iplr.IsEmpty() { 801 return nil 802 } 803 return *page.iplr.Value 804} 805 806// Creates a new instance of the InstancePoolListResultPage type. 807func NewInstancePoolListResultPage(cur InstancePoolListResult, getNextPage func(context.Context, InstancePoolListResult) (InstancePoolListResult, error)) InstancePoolListResultPage { 808 return InstancePoolListResultPage{ 809 fn: getNextPage, 810 iplr: cur, 811 } 812} 813 814// InstancePoolProperties properties of an instance pool. 815type InstancePoolProperties struct { 816 // SubnetID - Resource ID of the subnet to place this instance pool in. 817 SubnetID *string `json:"subnetId,omitempty"` 818 // VCores - Count of vCores belonging to this instance pool. 819 VCores *int32 `json:"vCores,omitempty"` 820 // LicenseType - The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). Possible values include: 'LicenseIncluded', 'BasePrice' 821 LicenseType InstancePoolLicenseType `json:"licenseType,omitempty"` 822} 823 824// InstancePoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 825// long-running operation. 826type InstancePoolsCreateOrUpdateFuture struct { 827 azure.FutureAPI 828 // Result returns the result of the asynchronous operation. 829 // If the operation has not completed it will return an error. 830 Result func(InstancePoolsClient) (InstancePool, error) 831} 832 833// UnmarshalJSON is the custom unmarshaller for CreateFuture. 834func (future *InstancePoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 835 var azFuture azure.Future 836 if err := json.Unmarshal(body, &azFuture); err != nil { 837 return err 838 } 839 future.FutureAPI = &azFuture 840 future.Result = future.result 841 return nil 842} 843 844// result is the default implementation for InstancePoolsCreateOrUpdateFuture.Result. 845func (future *InstancePoolsCreateOrUpdateFuture) result(client InstancePoolsClient) (IP InstancePool, err error) { 846 var done bool 847 done, err = future.DoneWithContext(context.Background(), client) 848 if err != nil { 849 err = autorest.NewErrorWithError(err, "sql.InstancePoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 850 return 851 } 852 if !done { 853 IP.Response.Response = future.Response() 854 err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsCreateOrUpdateFuture") 855 return 856 } 857 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 858 if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { 859 IP, err = client.CreateOrUpdateResponder(IP.Response.Response) 860 if err != nil { 861 err = autorest.NewErrorWithError(err, "sql.InstancePoolsCreateOrUpdateFuture", "Result", IP.Response.Response, "Failure responding to request") 862 } 863 } 864 return 865} 866 867// InstancePoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 868// operation. 869type InstancePoolsDeleteFuture struct { 870 azure.FutureAPI 871 // Result returns the result of the asynchronous operation. 872 // If the operation has not completed it will return an error. 873 Result func(InstancePoolsClient) (autorest.Response, error) 874} 875 876// UnmarshalJSON is the custom unmarshaller for CreateFuture. 877func (future *InstancePoolsDeleteFuture) UnmarshalJSON(body []byte) error { 878 var azFuture azure.Future 879 if err := json.Unmarshal(body, &azFuture); err != nil { 880 return err 881 } 882 future.FutureAPI = &azFuture 883 future.Result = future.result 884 return nil 885} 886 887// result is the default implementation for InstancePoolsDeleteFuture.Result. 888func (future *InstancePoolsDeleteFuture) result(client InstancePoolsClient) (ar autorest.Response, err error) { 889 var done bool 890 done, err = future.DoneWithContext(context.Background(), client) 891 if err != nil { 892 err = autorest.NewErrorWithError(err, "sql.InstancePoolsDeleteFuture", "Result", future.Response(), "Polling failure") 893 return 894 } 895 if !done { 896 ar.Response = future.Response() 897 err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsDeleteFuture") 898 return 899 } 900 ar.Response = future.Response() 901 return 902} 903 904// InstancePoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 905// operation. 906type InstancePoolsUpdateFuture struct { 907 azure.FutureAPI 908 // Result returns the result of the asynchronous operation. 909 // If the operation has not completed it will return an error. 910 Result func(InstancePoolsClient) (InstancePool, error) 911} 912 913// UnmarshalJSON is the custom unmarshaller for CreateFuture. 914func (future *InstancePoolsUpdateFuture) UnmarshalJSON(body []byte) error { 915 var azFuture azure.Future 916 if err := json.Unmarshal(body, &azFuture); err != nil { 917 return err 918 } 919 future.FutureAPI = &azFuture 920 future.Result = future.result 921 return nil 922} 923 924// result is the default implementation for InstancePoolsUpdateFuture.Result. 925func (future *InstancePoolsUpdateFuture) result(client InstancePoolsClient) (IP InstancePool, err error) { 926 var done bool 927 done, err = future.DoneWithContext(context.Background(), client) 928 if err != nil { 929 err = autorest.NewErrorWithError(err, "sql.InstancePoolsUpdateFuture", "Result", future.Response(), "Polling failure") 930 return 931 } 932 if !done { 933 IP.Response.Response = future.Response() 934 err = azure.NewAsyncOpIncompleteError("sql.InstancePoolsUpdateFuture") 935 return 936 } 937 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 938 if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { 939 IP, err = client.UpdateResponder(IP.Response.Response) 940 if err != nil { 941 err = autorest.NewErrorWithError(err, "sql.InstancePoolsUpdateFuture", "Result", IP.Response.Response, "Failure responding to request") 942 } 943 } 944 return 945} 946 947// InstancePoolUpdate an update to an Instance pool. 948type InstancePoolUpdate struct { 949 // Tags - Resource tags. 950 Tags map[string]*string `json:"tags"` 951} 952 953// MarshalJSON is the custom marshaler for InstancePoolUpdate. 954func (ipu InstancePoolUpdate) MarshalJSON() ([]byte, error) { 955 objectMap := make(map[string]interface{}) 956 if ipu.Tags != nil { 957 objectMap["tags"] = ipu.Tags 958 } 959 return json.Marshal(objectMap) 960} 961 962// LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture an abstraction for monitoring and 963// retrieving the results of a long-running operation. 964type LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture struct { 965 azure.FutureAPI 966 // Result returns the result of the asynchronous operation. 967 // If the operation has not completed it will return an error. 968 Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) 969} 970 971// UnmarshalJSON is the custom unmarshaller for CreateFuture. 972func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) UnmarshalJSON(body []byte) error { 973 var azFuture azure.Future 974 if err := json.Unmarshal(body, &azFuture); err != nil { 975 return err 976 } 977 future.FutureAPI = &azFuture 978 future.Result = future.result 979 return nil 980} 981 982// result is the default implementation for LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture.Result. 983func (future *LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { 984 var done bool 985 done, err = future.DoneWithContext(context.Background(), client) 986 if err != nil { 987 err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture", "Result", future.Response(), "Polling failure") 988 return 989 } 990 if !done { 991 ar.Response = future.Response() 992 err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupFuture") 993 return 994 } 995 ar.Response = future.Response() 996 return 997} 998 999// LongTermRetentionManagedInstanceBackupsDeleteFuture an abstraction for monitoring and retrieving the 1000// results of a long-running operation. 1001type LongTermRetentionManagedInstanceBackupsDeleteFuture struct { 1002 azure.FutureAPI 1003 // Result returns the result of the asynchronous operation. 1004 // If the operation has not completed it will return an error. 1005 Result func(LongTermRetentionManagedInstanceBackupsClient) (autorest.Response, error) 1006} 1007 1008// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1009func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) UnmarshalJSON(body []byte) error { 1010 var azFuture azure.Future 1011 if err := json.Unmarshal(body, &azFuture); err != nil { 1012 return err 1013 } 1014 future.FutureAPI = &azFuture 1015 future.Result = future.result 1016 return nil 1017} 1018 1019// result is the default implementation for LongTermRetentionManagedInstanceBackupsDeleteFuture.Result. 1020func (future *LongTermRetentionManagedInstanceBackupsDeleteFuture) result(client LongTermRetentionManagedInstanceBackupsClient) (ar autorest.Response, err error) { 1021 var done bool 1022 done, err = future.DoneWithContext(context.Background(), client) 1023 if err != nil { 1024 err = autorest.NewErrorWithError(err, "sql.LongTermRetentionManagedInstanceBackupsDeleteFuture", "Result", future.Response(), "Polling failure") 1025 return 1026 } 1027 if !done { 1028 ar.Response = future.Response() 1029 err = azure.NewAsyncOpIncompleteError("sql.LongTermRetentionManagedInstanceBackupsDeleteFuture") 1030 return 1031 } 1032 ar.Response = future.Response() 1033 return 1034} 1035 1036// ManagedDatabase a managed database resource. 1037type ManagedDatabase struct { 1038 autorest.Response `json:"-"` 1039 // ManagedDatabaseProperties - Resource properties. 1040 *ManagedDatabaseProperties `json:"properties,omitempty"` 1041 // Location - Resource location. 1042 Location *string `json:"location,omitempty"` 1043 // Tags - Resource tags. 1044 Tags map[string]*string `json:"tags"` 1045 // ID - READ-ONLY; Resource ID. 1046 ID *string `json:"id,omitempty"` 1047 // Name - READ-ONLY; Resource name. 1048 Name *string `json:"name,omitempty"` 1049 // Type - READ-ONLY; Resource type. 1050 Type *string `json:"type,omitempty"` 1051} 1052 1053// MarshalJSON is the custom marshaler for ManagedDatabase. 1054func (md ManagedDatabase) MarshalJSON() ([]byte, error) { 1055 objectMap := make(map[string]interface{}) 1056 if md.ManagedDatabaseProperties != nil { 1057 objectMap["properties"] = md.ManagedDatabaseProperties 1058 } 1059 if md.Location != nil { 1060 objectMap["location"] = md.Location 1061 } 1062 if md.Tags != nil { 1063 objectMap["tags"] = md.Tags 1064 } 1065 return json.Marshal(objectMap) 1066} 1067 1068// UnmarshalJSON is the custom unmarshaler for ManagedDatabase struct. 1069func (md *ManagedDatabase) UnmarshalJSON(body []byte) error { 1070 var m map[string]*json.RawMessage 1071 err := json.Unmarshal(body, &m) 1072 if err != nil { 1073 return err 1074 } 1075 for k, v := range m { 1076 switch k { 1077 case "properties": 1078 if v != nil { 1079 var managedDatabaseProperties ManagedDatabaseProperties 1080 err = json.Unmarshal(*v, &managedDatabaseProperties) 1081 if err != nil { 1082 return err 1083 } 1084 md.ManagedDatabaseProperties = &managedDatabaseProperties 1085 } 1086 case "location": 1087 if v != nil { 1088 var location string 1089 err = json.Unmarshal(*v, &location) 1090 if err != nil { 1091 return err 1092 } 1093 md.Location = &location 1094 } 1095 case "tags": 1096 if v != nil { 1097 var tags map[string]*string 1098 err = json.Unmarshal(*v, &tags) 1099 if err != nil { 1100 return err 1101 } 1102 md.Tags = tags 1103 } 1104 case "id": 1105 if v != nil { 1106 var ID string 1107 err = json.Unmarshal(*v, &ID) 1108 if err != nil { 1109 return err 1110 } 1111 md.ID = &ID 1112 } 1113 case "name": 1114 if v != nil { 1115 var name string 1116 err = json.Unmarshal(*v, &name) 1117 if err != nil { 1118 return err 1119 } 1120 md.Name = &name 1121 } 1122 case "type": 1123 if v != nil { 1124 var typeVar string 1125 err = json.Unmarshal(*v, &typeVar) 1126 if err != nil { 1127 return err 1128 } 1129 md.Type = &typeVar 1130 } 1131 } 1132 } 1133 1134 return nil 1135} 1136 1137// ManagedDatabaseListResult a list of managed databases. 1138type ManagedDatabaseListResult struct { 1139 autorest.Response `json:"-"` 1140 // Value - READ-ONLY; Array of results. 1141 Value *[]ManagedDatabase `json:"value,omitempty"` 1142 // NextLink - READ-ONLY; Link to retrieve next page of results. 1143 NextLink *string `json:"nextLink,omitempty"` 1144} 1145 1146// MarshalJSON is the custom marshaler for ManagedDatabaseListResult. 1147func (mdlr ManagedDatabaseListResult) MarshalJSON() ([]byte, error) { 1148 objectMap := make(map[string]interface{}) 1149 return json.Marshal(objectMap) 1150} 1151 1152// ManagedDatabaseListResultIterator provides access to a complete listing of ManagedDatabase values. 1153type ManagedDatabaseListResultIterator struct { 1154 i int 1155 page ManagedDatabaseListResultPage 1156} 1157 1158// NextWithContext advances to the next value. If there was an error making 1159// the request the iterator does not advance and the error is returned. 1160func (iter *ManagedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { 1161 if tracing.IsEnabled() { 1162 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultIterator.NextWithContext") 1163 defer func() { 1164 sc := -1 1165 if iter.Response().Response.Response != nil { 1166 sc = iter.Response().Response.Response.StatusCode 1167 } 1168 tracing.EndSpan(ctx, sc, err) 1169 }() 1170 } 1171 iter.i++ 1172 if iter.i < len(iter.page.Values()) { 1173 return nil 1174 } 1175 err = iter.page.NextWithContext(ctx) 1176 if err != nil { 1177 iter.i-- 1178 return err 1179 } 1180 iter.i = 0 1181 return nil 1182} 1183 1184// Next advances to the next value. If there was an error making 1185// the request the iterator does not advance and the error is returned. 1186// Deprecated: Use NextWithContext() instead. 1187func (iter *ManagedDatabaseListResultIterator) Next() error { 1188 return iter.NextWithContext(context.Background()) 1189} 1190 1191// NotDone returns true if the enumeration should be started or is not yet complete. 1192func (iter ManagedDatabaseListResultIterator) NotDone() bool { 1193 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1194} 1195 1196// Response returns the raw server response from the last page request. 1197func (iter ManagedDatabaseListResultIterator) Response() ManagedDatabaseListResult { 1198 return iter.page.Response() 1199} 1200 1201// Value returns the current value or a zero-initialized value if the 1202// iterator has advanced beyond the end of the collection. 1203func (iter ManagedDatabaseListResultIterator) Value() ManagedDatabase { 1204 if !iter.page.NotDone() { 1205 return ManagedDatabase{} 1206 } 1207 return iter.page.Values()[iter.i] 1208} 1209 1210// Creates a new instance of the ManagedDatabaseListResultIterator type. 1211func NewManagedDatabaseListResultIterator(page ManagedDatabaseListResultPage) ManagedDatabaseListResultIterator { 1212 return ManagedDatabaseListResultIterator{page: page} 1213} 1214 1215// IsEmpty returns true if the ListResult contains no values. 1216func (mdlr ManagedDatabaseListResult) IsEmpty() bool { 1217 return mdlr.Value == nil || len(*mdlr.Value) == 0 1218} 1219 1220// hasNextLink returns true if the NextLink is not empty. 1221func (mdlr ManagedDatabaseListResult) hasNextLink() bool { 1222 return mdlr.NextLink != nil && len(*mdlr.NextLink) != 0 1223} 1224 1225// managedDatabaseListResultPreparer prepares a request to retrieve the next set of results. 1226// It returns nil if no more results exist. 1227func (mdlr ManagedDatabaseListResult) managedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { 1228 if !mdlr.hasNextLink() { 1229 return nil, nil 1230 } 1231 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1232 autorest.AsJSON(), 1233 autorest.AsGet(), 1234 autorest.WithBaseURL(to.String(mdlr.NextLink))) 1235} 1236 1237// ManagedDatabaseListResultPage contains a page of ManagedDatabase values. 1238type ManagedDatabaseListResultPage struct { 1239 fn func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error) 1240 mdlr ManagedDatabaseListResult 1241} 1242 1243// NextWithContext advances to the next page of values. If there was an error making 1244// the request the page does not advance and the error is returned. 1245func (page *ManagedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { 1246 if tracing.IsEnabled() { 1247 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultPage.NextWithContext") 1248 defer func() { 1249 sc := -1 1250 if page.Response().Response.Response != nil { 1251 sc = page.Response().Response.Response.StatusCode 1252 } 1253 tracing.EndSpan(ctx, sc, err) 1254 }() 1255 } 1256 for { 1257 next, err := page.fn(ctx, page.mdlr) 1258 if err != nil { 1259 return err 1260 } 1261 page.mdlr = next 1262 if !next.hasNextLink() || !next.IsEmpty() { 1263 break 1264 } 1265 } 1266 return nil 1267} 1268 1269// Next advances to the next page of values. If there was an error making 1270// the request the page does not advance and the error is returned. 1271// Deprecated: Use NextWithContext() instead. 1272func (page *ManagedDatabaseListResultPage) Next() error { 1273 return page.NextWithContext(context.Background()) 1274} 1275 1276// NotDone returns true if the page enumeration should be started or is not yet complete. 1277func (page ManagedDatabaseListResultPage) NotDone() bool { 1278 return !page.mdlr.IsEmpty() 1279} 1280 1281// Response returns the raw server response from the last page request. 1282func (page ManagedDatabaseListResultPage) Response() ManagedDatabaseListResult { 1283 return page.mdlr 1284} 1285 1286// Values returns the slice of values for the current page or nil if there are no values. 1287func (page ManagedDatabaseListResultPage) Values() []ManagedDatabase { 1288 if page.mdlr.IsEmpty() { 1289 return nil 1290 } 1291 return *page.mdlr.Value 1292} 1293 1294// Creates a new instance of the ManagedDatabaseListResultPage type. 1295func NewManagedDatabaseListResultPage(cur ManagedDatabaseListResult, getNextPage func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error)) ManagedDatabaseListResultPage { 1296 return ManagedDatabaseListResultPage{ 1297 fn: getNextPage, 1298 mdlr: cur, 1299 } 1300} 1301 1302// ManagedDatabaseProperties the managed database's properties. 1303type ManagedDatabaseProperties struct { 1304 // Collation - Collation of the managed database. 1305 Collation *string `json:"collation,omitempty"` 1306 // Status - READ-ONLY; Status of the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating' 1307 Status ManagedDatabaseStatus `json:"status,omitempty"` 1308 // CreationDate - READ-ONLY; Creation date of the database. 1309 CreationDate *date.Time `json:"creationDate,omitempty"` 1310 // EarliestRestorePoint - READ-ONLY; Earliest restore point in time for point in time restore. 1311 EarliestRestorePoint *date.Time `json:"earliestRestorePoint,omitempty"` 1312 // RestorePointInTime - Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. 1313 RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` 1314 // DefaultSecondaryLocation - READ-ONLY; Geo paired region. 1315 DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` 1316 // CatalogCollation - Collation of the metadata catalog. Possible values include: 'DATABASEDEFAULT', 'SQLLatin1GeneralCP1CIAS' 1317 CatalogCollation CatalogCollationType `json:"catalogCollation,omitempty"` 1318 // CreateMode - Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore', 'Recovery', 'RestoreLongTermRetentionBackup' 1319 CreateMode ManagedDatabaseCreateMode `json:"createMode,omitempty"` 1320 // StorageContainerURI - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored. 1321 StorageContainerURI *string `json:"storageContainerUri,omitempty"` 1322 // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. 1323 SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` 1324 // RestorableDroppedDatabaseID - The restorable dropped database resource id to restore when creating this database. 1325 RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` 1326 // StorageContainerSasToken - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. 1327 StorageContainerSasToken *string `json:"storageContainerSasToken,omitempty"` 1328 // FailoverGroupID - READ-ONLY; Instance Failover Group resource identifier that this managed database belongs to. 1329 FailoverGroupID *string `json:"failoverGroupId,omitempty"` 1330 // RecoverableDatabaseID - The resource identifier of the recoverable database associated with create operation of this database. 1331 RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` 1332 // LongTermRetentionBackupResourceID - The name of the Long Term Retention backup to be used for restore of this managed database. 1333 LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` 1334} 1335 1336// MarshalJSON is the custom marshaler for ManagedDatabaseProperties. 1337func (mdp ManagedDatabaseProperties) MarshalJSON() ([]byte, error) { 1338 objectMap := make(map[string]interface{}) 1339 if mdp.Collation != nil { 1340 objectMap["collation"] = mdp.Collation 1341 } 1342 if mdp.RestorePointInTime != nil { 1343 objectMap["restorePointInTime"] = mdp.RestorePointInTime 1344 } 1345 if mdp.CatalogCollation != "" { 1346 objectMap["catalogCollation"] = mdp.CatalogCollation 1347 } 1348 if mdp.CreateMode != "" { 1349 objectMap["createMode"] = mdp.CreateMode 1350 } 1351 if mdp.StorageContainerURI != nil { 1352 objectMap["storageContainerUri"] = mdp.StorageContainerURI 1353 } 1354 if mdp.SourceDatabaseID != nil { 1355 objectMap["sourceDatabaseId"] = mdp.SourceDatabaseID 1356 } 1357 if mdp.RestorableDroppedDatabaseID != nil { 1358 objectMap["restorableDroppedDatabaseId"] = mdp.RestorableDroppedDatabaseID 1359 } 1360 if mdp.StorageContainerSasToken != nil { 1361 objectMap["storageContainerSasToken"] = mdp.StorageContainerSasToken 1362 } 1363 if mdp.RecoverableDatabaseID != nil { 1364 objectMap["recoverableDatabaseId"] = mdp.RecoverableDatabaseID 1365 } 1366 if mdp.LongTermRetentionBackupResourceID != nil { 1367 objectMap["longTermRetentionBackupResourceId"] = mdp.LongTermRetentionBackupResourceID 1368 } 1369 return json.Marshal(objectMap) 1370} 1371 1372// ManagedDatabaseRestoreDetailsProperties the managed database's restore details properties. 1373type ManagedDatabaseRestoreDetailsProperties struct { 1374 // Status - READ-ONLY; Restore status. 1375 Status *string `json:"status,omitempty"` 1376 // CurrentRestoringFileName - READ-ONLY; Current restoring file name. 1377 CurrentRestoringFileName *string `json:"currentRestoringFileName,omitempty"` 1378 // LastRestoredFileName - READ-ONLY; Last restored file name. 1379 LastRestoredFileName *string `json:"lastRestoredFileName,omitempty"` 1380 // LastRestoredFileTime - READ-ONLY; Last restored file time. 1381 LastRestoredFileTime *date.Time `json:"lastRestoredFileTime,omitempty"` 1382 // PercentCompleted - READ-ONLY; Percent completed. 1383 PercentCompleted *float64 `json:"percentCompleted,omitempty"` 1384 // UnrestorableFiles - READ-ONLY; List of unrestorable files. 1385 UnrestorableFiles *[]string `json:"unrestorableFiles,omitempty"` 1386 // NumberOfFilesDetected - READ-ONLY; Number of files detected. 1387 NumberOfFilesDetected *int64 `json:"numberOfFilesDetected,omitempty"` 1388 // LastUploadedFileName - READ-ONLY; Last uploaded file name. 1389 LastUploadedFileName *string `json:"lastUploadedFileName,omitempty"` 1390 // LastUploadedFileTime - READ-ONLY; Last uploaded file time. 1391 LastUploadedFileTime *date.Time `json:"lastUploadedFileTime,omitempty"` 1392 // BlockReason - READ-ONLY; The reason why restore is in Blocked state. 1393 BlockReason *string `json:"blockReason,omitempty"` 1394} 1395 1396// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsProperties. 1397func (mdrdp ManagedDatabaseRestoreDetailsProperties) MarshalJSON() ([]byte, error) { 1398 objectMap := make(map[string]interface{}) 1399 return json.Marshal(objectMap) 1400} 1401 1402// ManagedDatabaseRestoreDetailsResult a managed database restore details. 1403type ManagedDatabaseRestoreDetailsResult struct { 1404 autorest.Response `json:"-"` 1405 // ManagedDatabaseRestoreDetailsProperties - Resource properties. 1406 *ManagedDatabaseRestoreDetailsProperties `json:"properties,omitempty"` 1407 // ID - READ-ONLY; Resource ID. 1408 ID *string `json:"id,omitempty"` 1409 // Name - READ-ONLY; Resource name. 1410 Name *string `json:"name,omitempty"` 1411 // Type - READ-ONLY; Resource type. 1412 Type *string `json:"type,omitempty"` 1413} 1414 1415// MarshalJSON is the custom marshaler for ManagedDatabaseRestoreDetailsResult. 1416func (mdrdr ManagedDatabaseRestoreDetailsResult) MarshalJSON() ([]byte, error) { 1417 objectMap := make(map[string]interface{}) 1418 if mdrdr.ManagedDatabaseRestoreDetailsProperties != nil { 1419 objectMap["properties"] = mdrdr.ManagedDatabaseRestoreDetailsProperties 1420 } 1421 return json.Marshal(objectMap) 1422} 1423 1424// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseRestoreDetailsResult struct. 1425func (mdrdr *ManagedDatabaseRestoreDetailsResult) UnmarshalJSON(body []byte) error { 1426 var m map[string]*json.RawMessage 1427 err := json.Unmarshal(body, &m) 1428 if err != nil { 1429 return err 1430 } 1431 for k, v := range m { 1432 switch k { 1433 case "properties": 1434 if v != nil { 1435 var managedDatabaseRestoreDetailsProperties ManagedDatabaseRestoreDetailsProperties 1436 err = json.Unmarshal(*v, &managedDatabaseRestoreDetailsProperties) 1437 if err != nil { 1438 return err 1439 } 1440 mdrdr.ManagedDatabaseRestoreDetailsProperties = &managedDatabaseRestoreDetailsProperties 1441 } 1442 case "id": 1443 if v != nil { 1444 var ID string 1445 err = json.Unmarshal(*v, &ID) 1446 if err != nil { 1447 return err 1448 } 1449 mdrdr.ID = &ID 1450 } 1451 case "name": 1452 if v != nil { 1453 var name string 1454 err = json.Unmarshal(*v, &name) 1455 if err != nil { 1456 return err 1457 } 1458 mdrdr.Name = &name 1459 } 1460 case "type": 1461 if v != nil { 1462 var typeVar string 1463 err = json.Unmarshal(*v, &typeVar) 1464 if err != nil { 1465 return err 1466 } 1467 mdrdr.Type = &typeVar 1468 } 1469 } 1470 } 1471 1472 return nil 1473} 1474 1475// ManagedDatabasesCompleteRestoreFuture an abstraction for monitoring and retrieving the results of a 1476// long-running operation. 1477type ManagedDatabasesCompleteRestoreFuture struct { 1478 azure.FutureAPI 1479 // Result returns the result of the asynchronous operation. 1480 // If the operation has not completed it will return an error. 1481 Result func(ManagedDatabasesClient) (autorest.Response, error) 1482} 1483 1484// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1485func (future *ManagedDatabasesCompleteRestoreFuture) UnmarshalJSON(body []byte) error { 1486 var azFuture azure.Future 1487 if err := json.Unmarshal(body, &azFuture); err != nil { 1488 return err 1489 } 1490 future.FutureAPI = &azFuture 1491 future.Result = future.result 1492 return nil 1493} 1494 1495// result is the default implementation for ManagedDatabasesCompleteRestoreFuture.Result. 1496func (future *ManagedDatabasesCompleteRestoreFuture) result(client ManagedDatabasesClient) (ar autorest.Response, err error) { 1497 var done bool 1498 done, err = future.DoneWithContext(context.Background(), client) 1499 if err != nil { 1500 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCompleteRestoreFuture", "Result", future.Response(), "Polling failure") 1501 return 1502 } 1503 if !done { 1504 ar.Response = future.Response() 1505 err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCompleteRestoreFuture") 1506 return 1507 } 1508 ar.Response = future.Response() 1509 return 1510} 1511 1512// ManagedDatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1513// long-running operation. 1514type ManagedDatabasesCreateOrUpdateFuture struct { 1515 azure.FutureAPI 1516 // Result returns the result of the asynchronous operation. 1517 // If the operation has not completed it will return an error. 1518 Result func(ManagedDatabasesClient) (ManagedDatabase, error) 1519} 1520 1521// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1522func (future *ManagedDatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1523 var azFuture azure.Future 1524 if err := json.Unmarshal(body, &azFuture); err != nil { 1525 return err 1526 } 1527 future.FutureAPI = &azFuture 1528 future.Result = future.result 1529 return nil 1530} 1531 1532// result is the default implementation for ManagedDatabasesCreateOrUpdateFuture.Result. 1533func (future *ManagedDatabasesCreateOrUpdateFuture) result(client ManagedDatabasesClient) (md ManagedDatabase, err error) { 1534 var done bool 1535 done, err = future.DoneWithContext(context.Background(), client) 1536 if err != nil { 1537 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1538 return 1539 } 1540 if !done { 1541 md.Response.Response = future.Response() 1542 err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCreateOrUpdateFuture") 1543 return 1544 } 1545 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1546 if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent { 1547 md, err = client.CreateOrUpdateResponder(md.Response.Response) 1548 if err != nil { 1549 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", md.Response.Response, "Failure responding to request") 1550 } 1551 } 1552 return 1553} 1554 1555// ManagedDatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1556// operation. 1557type ManagedDatabasesDeleteFuture struct { 1558 azure.FutureAPI 1559 // Result returns the result of the asynchronous operation. 1560 // If the operation has not completed it will return an error. 1561 Result func(ManagedDatabasesClient) (autorest.Response, error) 1562} 1563 1564// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1565func (future *ManagedDatabasesDeleteFuture) UnmarshalJSON(body []byte) error { 1566 var azFuture azure.Future 1567 if err := json.Unmarshal(body, &azFuture); err != nil { 1568 return err 1569 } 1570 future.FutureAPI = &azFuture 1571 future.Result = future.result 1572 return nil 1573} 1574 1575// result is the default implementation for ManagedDatabasesDeleteFuture.Result. 1576func (future *ManagedDatabasesDeleteFuture) result(client ManagedDatabasesClient) (ar autorest.Response, err error) { 1577 var done bool 1578 done, err = future.DoneWithContext(context.Background(), client) 1579 if err != nil { 1580 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesDeleteFuture", "Result", future.Response(), "Polling failure") 1581 return 1582 } 1583 if !done { 1584 ar.Response = future.Response() 1585 err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesDeleteFuture") 1586 return 1587 } 1588 ar.Response = future.Response() 1589 return 1590} 1591 1592// ManagedDatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1593// operation. 1594type ManagedDatabasesUpdateFuture struct { 1595 azure.FutureAPI 1596 // Result returns the result of the asynchronous operation. 1597 // If the operation has not completed it will return an error. 1598 Result func(ManagedDatabasesClient) (ManagedDatabase, error) 1599} 1600 1601// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1602func (future *ManagedDatabasesUpdateFuture) UnmarshalJSON(body []byte) error { 1603 var azFuture azure.Future 1604 if err := json.Unmarshal(body, &azFuture); err != nil { 1605 return err 1606 } 1607 future.FutureAPI = &azFuture 1608 future.Result = future.result 1609 return nil 1610} 1611 1612// result is the default implementation for ManagedDatabasesUpdateFuture.Result. 1613func (future *ManagedDatabasesUpdateFuture) result(client ManagedDatabasesClient) (md ManagedDatabase, err error) { 1614 var done bool 1615 done, err = future.DoneWithContext(context.Background(), client) 1616 if err != nil { 1617 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", future.Response(), "Polling failure") 1618 return 1619 } 1620 if !done { 1621 md.Response.Response = future.Response() 1622 err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesUpdateFuture") 1623 return 1624 } 1625 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1626 if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent { 1627 md, err = client.UpdateResponder(md.Response.Response) 1628 if err != nil { 1629 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", md.Response.Response, "Failure responding to request") 1630 } 1631 } 1632 return 1633} 1634 1635// ManagedDatabaseUpdate an managed database update. 1636type ManagedDatabaseUpdate struct { 1637 // ManagedDatabaseProperties - Resource properties. 1638 *ManagedDatabaseProperties `json:"properties,omitempty"` 1639 // Tags - Resource tags. 1640 Tags map[string]*string `json:"tags"` 1641} 1642 1643// MarshalJSON is the custom marshaler for ManagedDatabaseUpdate. 1644func (mdu ManagedDatabaseUpdate) MarshalJSON() ([]byte, error) { 1645 objectMap := make(map[string]interface{}) 1646 if mdu.ManagedDatabaseProperties != nil { 1647 objectMap["properties"] = mdu.ManagedDatabaseProperties 1648 } 1649 if mdu.Tags != nil { 1650 objectMap["tags"] = mdu.Tags 1651 } 1652 return json.Marshal(objectMap) 1653} 1654 1655// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseUpdate struct. 1656func (mdu *ManagedDatabaseUpdate) UnmarshalJSON(body []byte) error { 1657 var m map[string]*json.RawMessage 1658 err := json.Unmarshal(body, &m) 1659 if err != nil { 1660 return err 1661 } 1662 for k, v := range m { 1663 switch k { 1664 case "properties": 1665 if v != nil { 1666 var managedDatabaseProperties ManagedDatabaseProperties 1667 err = json.Unmarshal(*v, &managedDatabaseProperties) 1668 if err != nil { 1669 return err 1670 } 1671 mdu.ManagedDatabaseProperties = &managedDatabaseProperties 1672 } 1673 case "tags": 1674 if v != nil { 1675 var tags map[string]*string 1676 err = json.Unmarshal(*v, &tags) 1677 if err != nil { 1678 return err 1679 } 1680 mdu.Tags = tags 1681 } 1682 } 1683 } 1684 1685 return nil 1686} 1687 1688// ManagedInstance an Azure SQL managed instance. 1689type ManagedInstance struct { 1690 autorest.Response `json:"-"` 1691 // Identity - The Azure Active Directory identity of the managed instance. 1692 Identity *ResourceIdentity `json:"identity,omitempty"` 1693 // Sku - Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5 1694 Sku *Sku `json:"sku,omitempty"` 1695 // ManagedInstanceProperties - Resource properties. 1696 *ManagedInstanceProperties `json:"properties,omitempty"` 1697 // Location - Resource location. 1698 Location *string `json:"location,omitempty"` 1699 // Tags - Resource tags. 1700 Tags map[string]*string `json:"tags"` 1701 // ID - READ-ONLY; Resource ID. 1702 ID *string `json:"id,omitempty"` 1703 // Name - READ-ONLY; Resource name. 1704 Name *string `json:"name,omitempty"` 1705 // Type - READ-ONLY; Resource type. 1706 Type *string `json:"type,omitempty"` 1707} 1708 1709// MarshalJSON is the custom marshaler for ManagedInstance. 1710func (mi ManagedInstance) MarshalJSON() ([]byte, error) { 1711 objectMap := make(map[string]interface{}) 1712 if mi.Identity != nil { 1713 objectMap["identity"] = mi.Identity 1714 } 1715 if mi.Sku != nil { 1716 objectMap["sku"] = mi.Sku 1717 } 1718 if mi.ManagedInstanceProperties != nil { 1719 objectMap["properties"] = mi.ManagedInstanceProperties 1720 } 1721 if mi.Location != nil { 1722 objectMap["location"] = mi.Location 1723 } 1724 if mi.Tags != nil { 1725 objectMap["tags"] = mi.Tags 1726 } 1727 return json.Marshal(objectMap) 1728} 1729 1730// UnmarshalJSON is the custom unmarshaler for ManagedInstance struct. 1731func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { 1732 var m map[string]*json.RawMessage 1733 err := json.Unmarshal(body, &m) 1734 if err != nil { 1735 return err 1736 } 1737 for k, v := range m { 1738 switch k { 1739 case "identity": 1740 if v != nil { 1741 var identity ResourceIdentity 1742 err = json.Unmarshal(*v, &identity) 1743 if err != nil { 1744 return err 1745 } 1746 mi.Identity = &identity 1747 } 1748 case "sku": 1749 if v != nil { 1750 var sku Sku 1751 err = json.Unmarshal(*v, &sku) 1752 if err != nil { 1753 return err 1754 } 1755 mi.Sku = &sku 1756 } 1757 case "properties": 1758 if v != nil { 1759 var managedInstanceProperties ManagedInstanceProperties 1760 err = json.Unmarshal(*v, &managedInstanceProperties) 1761 if err != nil { 1762 return err 1763 } 1764 mi.ManagedInstanceProperties = &managedInstanceProperties 1765 } 1766 case "location": 1767 if v != nil { 1768 var location string 1769 err = json.Unmarshal(*v, &location) 1770 if err != nil { 1771 return err 1772 } 1773 mi.Location = &location 1774 } 1775 case "tags": 1776 if v != nil { 1777 var tags map[string]*string 1778 err = json.Unmarshal(*v, &tags) 1779 if err != nil { 1780 return err 1781 } 1782 mi.Tags = tags 1783 } 1784 case "id": 1785 if v != nil { 1786 var ID string 1787 err = json.Unmarshal(*v, &ID) 1788 if err != nil { 1789 return err 1790 } 1791 mi.ID = &ID 1792 } 1793 case "name": 1794 if v != nil { 1795 var name string 1796 err = json.Unmarshal(*v, &name) 1797 if err != nil { 1798 return err 1799 } 1800 mi.Name = &name 1801 } 1802 case "type": 1803 if v != nil { 1804 var typeVar string 1805 err = json.Unmarshal(*v, &typeVar) 1806 if err != nil { 1807 return err 1808 } 1809 mi.Type = &typeVar 1810 } 1811 } 1812 } 1813 1814 return nil 1815} 1816 1817// ManagedInstanceListResult a list of managed instances. 1818type ManagedInstanceListResult struct { 1819 autorest.Response `json:"-"` 1820 // Value - READ-ONLY; Array of results. 1821 Value *[]ManagedInstance `json:"value,omitempty"` 1822 // NextLink - READ-ONLY; Link to retrieve next page of results. 1823 NextLink *string `json:"nextLink,omitempty"` 1824} 1825 1826// MarshalJSON is the custom marshaler for ManagedInstanceListResult. 1827func (milr ManagedInstanceListResult) MarshalJSON() ([]byte, error) { 1828 objectMap := make(map[string]interface{}) 1829 return json.Marshal(objectMap) 1830} 1831 1832// ManagedInstanceListResultIterator provides access to a complete listing of ManagedInstance values. 1833type ManagedInstanceListResultIterator struct { 1834 i int 1835 page ManagedInstanceListResultPage 1836} 1837 1838// NextWithContext advances to the next value. If there was an error making 1839// the request the iterator does not advance and the error is returned. 1840func (iter *ManagedInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { 1841 if tracing.IsEnabled() { 1842 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultIterator.NextWithContext") 1843 defer func() { 1844 sc := -1 1845 if iter.Response().Response.Response != nil { 1846 sc = iter.Response().Response.Response.StatusCode 1847 } 1848 tracing.EndSpan(ctx, sc, err) 1849 }() 1850 } 1851 iter.i++ 1852 if iter.i < len(iter.page.Values()) { 1853 return nil 1854 } 1855 err = iter.page.NextWithContext(ctx) 1856 if err != nil { 1857 iter.i-- 1858 return err 1859 } 1860 iter.i = 0 1861 return nil 1862} 1863 1864// Next advances to the next value. If there was an error making 1865// the request the iterator does not advance and the error is returned. 1866// Deprecated: Use NextWithContext() instead. 1867func (iter *ManagedInstanceListResultIterator) Next() error { 1868 return iter.NextWithContext(context.Background()) 1869} 1870 1871// NotDone returns true if the enumeration should be started or is not yet complete. 1872func (iter ManagedInstanceListResultIterator) NotDone() bool { 1873 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1874} 1875 1876// Response returns the raw server response from the last page request. 1877func (iter ManagedInstanceListResultIterator) Response() ManagedInstanceListResult { 1878 return iter.page.Response() 1879} 1880 1881// Value returns the current value or a zero-initialized value if the 1882// iterator has advanced beyond the end of the collection. 1883func (iter ManagedInstanceListResultIterator) Value() ManagedInstance { 1884 if !iter.page.NotDone() { 1885 return ManagedInstance{} 1886 } 1887 return iter.page.Values()[iter.i] 1888} 1889 1890// Creates a new instance of the ManagedInstanceListResultIterator type. 1891func NewManagedInstanceListResultIterator(page ManagedInstanceListResultPage) ManagedInstanceListResultIterator { 1892 return ManagedInstanceListResultIterator{page: page} 1893} 1894 1895// IsEmpty returns true if the ListResult contains no values. 1896func (milr ManagedInstanceListResult) IsEmpty() bool { 1897 return milr.Value == nil || len(*milr.Value) == 0 1898} 1899 1900// hasNextLink returns true if the NextLink is not empty. 1901func (milr ManagedInstanceListResult) hasNextLink() bool { 1902 return milr.NextLink != nil && len(*milr.NextLink) != 0 1903} 1904 1905// managedInstanceListResultPreparer prepares a request to retrieve the next set of results. 1906// It returns nil if no more results exist. 1907func (milr ManagedInstanceListResult) managedInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { 1908 if !milr.hasNextLink() { 1909 return nil, nil 1910 } 1911 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1912 autorest.AsJSON(), 1913 autorest.AsGet(), 1914 autorest.WithBaseURL(to.String(milr.NextLink))) 1915} 1916 1917// ManagedInstanceListResultPage contains a page of ManagedInstance values. 1918type ManagedInstanceListResultPage struct { 1919 fn func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error) 1920 milr ManagedInstanceListResult 1921} 1922 1923// NextWithContext advances to the next page of values. If there was an error making 1924// the request the page does not advance and the error is returned. 1925func (page *ManagedInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { 1926 if tracing.IsEnabled() { 1927 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultPage.NextWithContext") 1928 defer func() { 1929 sc := -1 1930 if page.Response().Response.Response != nil { 1931 sc = page.Response().Response.Response.StatusCode 1932 } 1933 tracing.EndSpan(ctx, sc, err) 1934 }() 1935 } 1936 for { 1937 next, err := page.fn(ctx, page.milr) 1938 if err != nil { 1939 return err 1940 } 1941 page.milr = next 1942 if !next.hasNextLink() || !next.IsEmpty() { 1943 break 1944 } 1945 } 1946 return nil 1947} 1948 1949// Next advances to the next page of values. If there was an error making 1950// the request the page does not advance and the error is returned. 1951// Deprecated: Use NextWithContext() instead. 1952func (page *ManagedInstanceListResultPage) Next() error { 1953 return page.NextWithContext(context.Background()) 1954} 1955 1956// NotDone returns true if the page enumeration should be started or is not yet complete. 1957func (page ManagedInstanceListResultPage) NotDone() bool { 1958 return !page.milr.IsEmpty() 1959} 1960 1961// Response returns the raw server response from the last page request. 1962func (page ManagedInstanceListResultPage) Response() ManagedInstanceListResult { 1963 return page.milr 1964} 1965 1966// Values returns the slice of values for the current page or nil if there are no values. 1967func (page ManagedInstanceListResultPage) Values() []ManagedInstance { 1968 if page.milr.IsEmpty() { 1969 return nil 1970 } 1971 return *page.milr.Value 1972} 1973 1974// Creates a new instance of the ManagedInstanceListResultPage type. 1975func NewManagedInstanceListResultPage(cur ManagedInstanceListResult, getNextPage func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error)) ManagedInstanceListResultPage { 1976 return ManagedInstanceListResultPage{ 1977 fn: getNextPage, 1978 milr: cur, 1979 } 1980} 1981 1982// ManagedInstanceLongTermRetentionBackup a long term retention backup for a managed database. 1983type ManagedInstanceLongTermRetentionBackup struct { 1984 autorest.Response `json:"-"` 1985 // ManagedInstanceLongTermRetentionBackupProperties - Resource properties. 1986 *ManagedInstanceLongTermRetentionBackupProperties `json:"properties,omitempty"` 1987 // ID - READ-ONLY; Resource ID. 1988 ID *string `json:"id,omitempty"` 1989 // Name - READ-ONLY; Resource name. 1990 Name *string `json:"name,omitempty"` 1991 // Type - READ-ONLY; Resource type. 1992 Type *string `json:"type,omitempty"` 1993} 1994 1995// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackup. 1996func (miltrb ManagedInstanceLongTermRetentionBackup) MarshalJSON() ([]byte, error) { 1997 objectMap := make(map[string]interface{}) 1998 if miltrb.ManagedInstanceLongTermRetentionBackupProperties != nil { 1999 objectMap["properties"] = miltrb.ManagedInstanceLongTermRetentionBackupProperties 2000 } 2001 return json.Marshal(objectMap) 2002} 2003 2004// UnmarshalJSON is the custom unmarshaler for ManagedInstanceLongTermRetentionBackup struct. 2005func (miltrb *ManagedInstanceLongTermRetentionBackup) UnmarshalJSON(body []byte) error { 2006 var m map[string]*json.RawMessage 2007 err := json.Unmarshal(body, &m) 2008 if err != nil { 2009 return err 2010 } 2011 for k, v := range m { 2012 switch k { 2013 case "properties": 2014 if v != nil { 2015 var managedInstanceLongTermRetentionBackupProperties ManagedInstanceLongTermRetentionBackupProperties 2016 err = json.Unmarshal(*v, &managedInstanceLongTermRetentionBackupProperties) 2017 if err != nil { 2018 return err 2019 } 2020 miltrb.ManagedInstanceLongTermRetentionBackupProperties = &managedInstanceLongTermRetentionBackupProperties 2021 } 2022 case "id": 2023 if v != nil { 2024 var ID string 2025 err = json.Unmarshal(*v, &ID) 2026 if err != nil { 2027 return err 2028 } 2029 miltrb.ID = &ID 2030 } 2031 case "name": 2032 if v != nil { 2033 var name string 2034 err = json.Unmarshal(*v, &name) 2035 if err != nil { 2036 return err 2037 } 2038 miltrb.Name = &name 2039 } 2040 case "type": 2041 if v != nil { 2042 var typeVar string 2043 err = json.Unmarshal(*v, &typeVar) 2044 if err != nil { 2045 return err 2046 } 2047 miltrb.Type = &typeVar 2048 } 2049 } 2050 } 2051 2052 return nil 2053} 2054 2055// ManagedInstanceLongTermRetentionBackupListResult a list of long term retention backups for managed 2056// database(s). 2057type ManagedInstanceLongTermRetentionBackupListResult struct { 2058 autorest.Response `json:"-"` 2059 // Value - READ-ONLY; Array of results. 2060 Value *[]ManagedInstanceLongTermRetentionBackup `json:"value,omitempty"` 2061 // NextLink - READ-ONLY; Link to retrieve next page of results. 2062 NextLink *string `json:"nextLink,omitempty"` 2063} 2064 2065// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackupListResult. 2066func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) MarshalJSON() ([]byte, error) { 2067 objectMap := make(map[string]interface{}) 2068 return json.Marshal(objectMap) 2069} 2070 2071// ManagedInstanceLongTermRetentionBackupListResultIterator provides access to a complete listing of 2072// ManagedInstanceLongTermRetentionBackup values. 2073type ManagedInstanceLongTermRetentionBackupListResultIterator struct { 2074 i int 2075 page ManagedInstanceLongTermRetentionBackupListResultPage 2076} 2077 2078// NextWithContext advances to the next value. If there was an error making 2079// the request the iterator does not advance and the error is returned. 2080func (iter *ManagedInstanceLongTermRetentionBackupListResultIterator) NextWithContext(ctx context.Context) (err error) { 2081 if tracing.IsEnabled() { 2082 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionBackupListResultIterator.NextWithContext") 2083 defer func() { 2084 sc := -1 2085 if iter.Response().Response.Response != nil { 2086 sc = iter.Response().Response.Response.StatusCode 2087 } 2088 tracing.EndSpan(ctx, sc, err) 2089 }() 2090 } 2091 iter.i++ 2092 if iter.i < len(iter.page.Values()) { 2093 return nil 2094 } 2095 err = iter.page.NextWithContext(ctx) 2096 if err != nil { 2097 iter.i-- 2098 return err 2099 } 2100 iter.i = 0 2101 return nil 2102} 2103 2104// Next advances to the next value. If there was an error making 2105// the request the iterator does not advance and the error is returned. 2106// Deprecated: Use NextWithContext() instead. 2107func (iter *ManagedInstanceLongTermRetentionBackupListResultIterator) Next() error { 2108 return iter.NextWithContext(context.Background()) 2109} 2110 2111// NotDone returns true if the enumeration should be started or is not yet complete. 2112func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) NotDone() bool { 2113 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2114} 2115 2116// Response returns the raw server response from the last page request. 2117func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) Response() ManagedInstanceLongTermRetentionBackupListResult { 2118 return iter.page.Response() 2119} 2120 2121// Value returns the current value or a zero-initialized value if the 2122// iterator has advanced beyond the end of the collection. 2123func (iter ManagedInstanceLongTermRetentionBackupListResultIterator) Value() ManagedInstanceLongTermRetentionBackup { 2124 if !iter.page.NotDone() { 2125 return ManagedInstanceLongTermRetentionBackup{} 2126 } 2127 return iter.page.Values()[iter.i] 2128} 2129 2130// Creates a new instance of the ManagedInstanceLongTermRetentionBackupListResultIterator type. 2131func NewManagedInstanceLongTermRetentionBackupListResultIterator(page ManagedInstanceLongTermRetentionBackupListResultPage) ManagedInstanceLongTermRetentionBackupListResultIterator { 2132 return ManagedInstanceLongTermRetentionBackupListResultIterator{page: page} 2133} 2134 2135// IsEmpty returns true if the ListResult contains no values. 2136func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) IsEmpty() bool { 2137 return miltrblr.Value == nil || len(*miltrblr.Value) == 0 2138} 2139 2140// hasNextLink returns true if the NextLink is not empty. 2141func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) hasNextLink() bool { 2142 return miltrblr.NextLink != nil && len(*miltrblr.NextLink) != 0 2143} 2144 2145// managedInstanceLongTermRetentionBackupListResultPreparer prepares a request to retrieve the next set of results. 2146// It returns nil if no more results exist. 2147func (miltrblr ManagedInstanceLongTermRetentionBackupListResult) managedInstanceLongTermRetentionBackupListResultPreparer(ctx context.Context) (*http.Request, error) { 2148 if !miltrblr.hasNextLink() { 2149 return nil, nil 2150 } 2151 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2152 autorest.AsJSON(), 2153 autorest.AsGet(), 2154 autorest.WithBaseURL(to.String(miltrblr.NextLink))) 2155} 2156 2157// ManagedInstanceLongTermRetentionBackupListResultPage contains a page of 2158// ManagedInstanceLongTermRetentionBackup values. 2159type ManagedInstanceLongTermRetentionBackupListResultPage struct { 2160 fn func(context.Context, ManagedInstanceLongTermRetentionBackupListResult) (ManagedInstanceLongTermRetentionBackupListResult, error) 2161 miltrblr ManagedInstanceLongTermRetentionBackupListResult 2162} 2163 2164// NextWithContext advances to the next page of values. If there was an error making 2165// the request the page does not advance and the error is returned. 2166func (page *ManagedInstanceLongTermRetentionBackupListResultPage) NextWithContext(ctx context.Context) (err error) { 2167 if tracing.IsEnabled() { 2168 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionBackupListResultPage.NextWithContext") 2169 defer func() { 2170 sc := -1 2171 if page.Response().Response.Response != nil { 2172 sc = page.Response().Response.Response.StatusCode 2173 } 2174 tracing.EndSpan(ctx, sc, err) 2175 }() 2176 } 2177 for { 2178 next, err := page.fn(ctx, page.miltrblr) 2179 if err != nil { 2180 return err 2181 } 2182 page.miltrblr = next 2183 if !next.hasNextLink() || !next.IsEmpty() { 2184 break 2185 } 2186 } 2187 return nil 2188} 2189 2190// Next advances to the next page of values. If there was an error making 2191// the request the page does not advance and the error is returned. 2192// Deprecated: Use NextWithContext() instead. 2193func (page *ManagedInstanceLongTermRetentionBackupListResultPage) Next() error { 2194 return page.NextWithContext(context.Background()) 2195} 2196 2197// NotDone returns true if the page enumeration should be started or is not yet complete. 2198func (page ManagedInstanceLongTermRetentionBackupListResultPage) NotDone() bool { 2199 return !page.miltrblr.IsEmpty() 2200} 2201 2202// Response returns the raw server response from the last page request. 2203func (page ManagedInstanceLongTermRetentionBackupListResultPage) Response() ManagedInstanceLongTermRetentionBackupListResult { 2204 return page.miltrblr 2205} 2206 2207// Values returns the slice of values for the current page or nil if there are no values. 2208func (page ManagedInstanceLongTermRetentionBackupListResultPage) Values() []ManagedInstanceLongTermRetentionBackup { 2209 if page.miltrblr.IsEmpty() { 2210 return nil 2211 } 2212 return *page.miltrblr.Value 2213} 2214 2215// Creates a new instance of the ManagedInstanceLongTermRetentionBackupListResultPage type. 2216func NewManagedInstanceLongTermRetentionBackupListResultPage(cur ManagedInstanceLongTermRetentionBackupListResult, getNextPage func(context.Context, ManagedInstanceLongTermRetentionBackupListResult) (ManagedInstanceLongTermRetentionBackupListResult, error)) ManagedInstanceLongTermRetentionBackupListResultPage { 2217 return ManagedInstanceLongTermRetentionBackupListResultPage{ 2218 fn: getNextPage, 2219 miltrblr: cur, 2220 } 2221} 2222 2223// ManagedInstanceLongTermRetentionBackupProperties properties of a long term retention backup 2224type ManagedInstanceLongTermRetentionBackupProperties struct { 2225 // ManagedInstanceName - READ-ONLY; The managed instance that the backup database belongs to. 2226 ManagedInstanceName *string `json:"managedInstanceName,omitempty"` 2227 // ManagedInstanceCreateTime - READ-ONLY; The create time of the instance. 2228 ManagedInstanceCreateTime *date.Time `json:"managedInstanceCreateTime,omitempty"` 2229 // DatabaseName - READ-ONLY; The name of the database the backup belong to 2230 DatabaseName *string `json:"databaseName,omitempty"` 2231 // DatabaseDeletionTime - READ-ONLY; The delete time of the database 2232 DatabaseDeletionTime *date.Time `json:"databaseDeletionTime,omitempty"` 2233 // BackupTime - READ-ONLY; The time the backup was taken 2234 BackupTime *date.Time `json:"backupTime,omitempty"` 2235 // BackupExpirationTime - READ-ONLY; The time the long term retention backup will expire. 2236 BackupExpirationTime *date.Time `json:"backupExpirationTime,omitempty"` 2237} 2238 2239// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionBackupProperties. 2240func (miltrbp ManagedInstanceLongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { 2241 objectMap := make(map[string]interface{}) 2242 return json.Marshal(objectMap) 2243} 2244 2245// ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and 2246// retrieving the results of a long-running operation. 2247type ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture struct { 2248 azure.FutureAPI 2249 // Result returns the result of the asynchronous operation. 2250 // If the operation has not completed it will return an error. 2251 Result func(ManagedInstanceLongTermRetentionPoliciesClient) (ManagedInstanceLongTermRetentionPolicy, error) 2252} 2253 2254// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2255func (future *ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 2256 var azFuture azure.Future 2257 if err := json.Unmarshal(body, &azFuture); err != nil { 2258 return err 2259 } 2260 future.FutureAPI = &azFuture 2261 future.Result = future.result 2262 return nil 2263} 2264 2265// result is the default implementation for ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture.Result. 2266func (future *ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedInstanceLongTermRetentionPoliciesClient) (miltrp ManagedInstanceLongTermRetentionPolicy, err error) { 2267 var done bool 2268 done, err = future.DoneWithContext(context.Background(), client) 2269 if err != nil { 2270 err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 2271 return 2272 } 2273 if !done { 2274 miltrp.Response.Response = future.Response() 2275 err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture") 2276 return 2277 } 2278 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2279 if miltrp.Response.Response, err = future.GetResult(sender); err == nil && miltrp.Response.Response.StatusCode != http.StatusNoContent { 2280 miltrp, err = client.CreateOrUpdateResponder(miltrp.Response.Response) 2281 if err != nil { 2282 err = autorest.NewErrorWithError(err, "sql.ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateFuture", "Result", miltrp.Response.Response, "Failure responding to request") 2283 } 2284 } 2285 return 2286} 2287 2288// ManagedInstanceLongTermRetentionPolicy a long term retention policy. 2289type ManagedInstanceLongTermRetentionPolicy struct { 2290 autorest.Response `json:"-"` 2291 // BaseLongTermRetentionPolicyProperties - Resource properties. 2292 *BaseLongTermRetentionPolicyProperties `json:"properties,omitempty"` 2293 // ID - READ-ONLY; Resource ID. 2294 ID *string `json:"id,omitempty"` 2295 // Name - READ-ONLY; Resource name. 2296 Name *string `json:"name,omitempty"` 2297 // Type - READ-ONLY; Resource type. 2298 Type *string `json:"type,omitempty"` 2299} 2300 2301// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionPolicy. 2302func (miltrp ManagedInstanceLongTermRetentionPolicy) MarshalJSON() ([]byte, error) { 2303 objectMap := make(map[string]interface{}) 2304 if miltrp.BaseLongTermRetentionPolicyProperties != nil { 2305 objectMap["properties"] = miltrp.BaseLongTermRetentionPolicyProperties 2306 } 2307 return json.Marshal(objectMap) 2308} 2309 2310// UnmarshalJSON is the custom unmarshaler for ManagedInstanceLongTermRetentionPolicy struct. 2311func (miltrp *ManagedInstanceLongTermRetentionPolicy) UnmarshalJSON(body []byte) error { 2312 var m map[string]*json.RawMessage 2313 err := json.Unmarshal(body, &m) 2314 if err != nil { 2315 return err 2316 } 2317 for k, v := range m { 2318 switch k { 2319 case "properties": 2320 if v != nil { 2321 var baseLongTermRetentionPolicyProperties BaseLongTermRetentionPolicyProperties 2322 err = json.Unmarshal(*v, &baseLongTermRetentionPolicyProperties) 2323 if err != nil { 2324 return err 2325 } 2326 miltrp.BaseLongTermRetentionPolicyProperties = &baseLongTermRetentionPolicyProperties 2327 } 2328 case "id": 2329 if v != nil { 2330 var ID string 2331 err = json.Unmarshal(*v, &ID) 2332 if err != nil { 2333 return err 2334 } 2335 miltrp.ID = &ID 2336 } 2337 case "name": 2338 if v != nil { 2339 var name string 2340 err = json.Unmarshal(*v, &name) 2341 if err != nil { 2342 return err 2343 } 2344 miltrp.Name = &name 2345 } 2346 case "type": 2347 if v != nil { 2348 var typeVar string 2349 err = json.Unmarshal(*v, &typeVar) 2350 if err != nil { 2351 return err 2352 } 2353 miltrp.Type = &typeVar 2354 } 2355 } 2356 } 2357 2358 return nil 2359} 2360 2361// ManagedInstanceLongTermRetentionPolicyListResult a list of long term retention policies. 2362type ManagedInstanceLongTermRetentionPolicyListResult struct { 2363 autorest.Response `json:"-"` 2364 // Value - READ-ONLY; Array of results. 2365 Value *[]ManagedInstanceLongTermRetentionPolicy `json:"value,omitempty"` 2366 // NextLink - READ-ONLY; Link to retrieve next page of results. 2367 NextLink *string `json:"nextLink,omitempty"` 2368} 2369 2370// MarshalJSON is the custom marshaler for ManagedInstanceLongTermRetentionPolicyListResult. 2371func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { 2372 objectMap := make(map[string]interface{}) 2373 return json.Marshal(objectMap) 2374} 2375 2376// ManagedInstanceLongTermRetentionPolicyListResultIterator provides access to a complete listing of 2377// ManagedInstanceLongTermRetentionPolicy values. 2378type ManagedInstanceLongTermRetentionPolicyListResultIterator struct { 2379 i int 2380 page ManagedInstanceLongTermRetentionPolicyListResultPage 2381} 2382 2383// NextWithContext advances to the next value. If there was an error making 2384// the request the iterator does not advance and the error is returned. 2385func (iter *ManagedInstanceLongTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { 2386 if tracing.IsEnabled() { 2387 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPolicyListResultIterator.NextWithContext") 2388 defer func() { 2389 sc := -1 2390 if iter.Response().Response.Response != nil { 2391 sc = iter.Response().Response.Response.StatusCode 2392 } 2393 tracing.EndSpan(ctx, sc, err) 2394 }() 2395 } 2396 iter.i++ 2397 if iter.i < len(iter.page.Values()) { 2398 return nil 2399 } 2400 err = iter.page.NextWithContext(ctx) 2401 if err != nil { 2402 iter.i-- 2403 return err 2404 } 2405 iter.i = 0 2406 return nil 2407} 2408 2409// Next advances to the next value. If there was an error making 2410// the request the iterator does not advance and the error is returned. 2411// Deprecated: Use NextWithContext() instead. 2412func (iter *ManagedInstanceLongTermRetentionPolicyListResultIterator) Next() error { 2413 return iter.NextWithContext(context.Background()) 2414} 2415 2416// NotDone returns true if the enumeration should be started or is not yet complete. 2417func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) NotDone() bool { 2418 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2419} 2420 2421// Response returns the raw server response from the last page request. 2422func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) Response() ManagedInstanceLongTermRetentionPolicyListResult { 2423 return iter.page.Response() 2424} 2425 2426// Value returns the current value or a zero-initialized value if the 2427// iterator has advanced beyond the end of the collection. 2428func (iter ManagedInstanceLongTermRetentionPolicyListResultIterator) Value() ManagedInstanceLongTermRetentionPolicy { 2429 if !iter.page.NotDone() { 2430 return ManagedInstanceLongTermRetentionPolicy{} 2431 } 2432 return iter.page.Values()[iter.i] 2433} 2434 2435// Creates a new instance of the ManagedInstanceLongTermRetentionPolicyListResultIterator type. 2436func NewManagedInstanceLongTermRetentionPolicyListResultIterator(page ManagedInstanceLongTermRetentionPolicyListResultPage) ManagedInstanceLongTermRetentionPolicyListResultIterator { 2437 return ManagedInstanceLongTermRetentionPolicyListResultIterator{page: page} 2438} 2439 2440// IsEmpty returns true if the ListResult contains no values. 2441func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) IsEmpty() bool { 2442 return miltrplr.Value == nil || len(*miltrplr.Value) == 0 2443} 2444 2445// hasNextLink returns true if the NextLink is not empty. 2446func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) hasNextLink() bool { 2447 return miltrplr.NextLink != nil && len(*miltrplr.NextLink) != 0 2448} 2449 2450// managedInstanceLongTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. 2451// It returns nil if no more results exist. 2452func (miltrplr ManagedInstanceLongTermRetentionPolicyListResult) managedInstanceLongTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { 2453 if !miltrplr.hasNextLink() { 2454 return nil, nil 2455 } 2456 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2457 autorest.AsJSON(), 2458 autorest.AsGet(), 2459 autorest.WithBaseURL(to.String(miltrplr.NextLink))) 2460} 2461 2462// ManagedInstanceLongTermRetentionPolicyListResultPage contains a page of 2463// ManagedInstanceLongTermRetentionPolicy values. 2464type ManagedInstanceLongTermRetentionPolicyListResultPage struct { 2465 fn func(context.Context, ManagedInstanceLongTermRetentionPolicyListResult) (ManagedInstanceLongTermRetentionPolicyListResult, error) 2466 miltrplr ManagedInstanceLongTermRetentionPolicyListResult 2467} 2468 2469// NextWithContext advances to the next page of values. If there was an error making 2470// the request the page does not advance and the error is returned. 2471func (page *ManagedInstanceLongTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { 2472 if tracing.IsEnabled() { 2473 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceLongTermRetentionPolicyListResultPage.NextWithContext") 2474 defer func() { 2475 sc := -1 2476 if page.Response().Response.Response != nil { 2477 sc = page.Response().Response.Response.StatusCode 2478 } 2479 tracing.EndSpan(ctx, sc, err) 2480 }() 2481 } 2482 for { 2483 next, err := page.fn(ctx, page.miltrplr) 2484 if err != nil { 2485 return err 2486 } 2487 page.miltrplr = next 2488 if !next.hasNextLink() || !next.IsEmpty() { 2489 break 2490 } 2491 } 2492 return nil 2493} 2494 2495// Next advances to the next page of values. If there was an error making 2496// the request the page does not advance and the error is returned. 2497// Deprecated: Use NextWithContext() instead. 2498func (page *ManagedInstanceLongTermRetentionPolicyListResultPage) Next() error { 2499 return page.NextWithContext(context.Background()) 2500} 2501 2502// NotDone returns true if the page enumeration should be started or is not yet complete. 2503func (page ManagedInstanceLongTermRetentionPolicyListResultPage) NotDone() bool { 2504 return !page.miltrplr.IsEmpty() 2505} 2506 2507// Response returns the raw server response from the last page request. 2508func (page ManagedInstanceLongTermRetentionPolicyListResultPage) Response() ManagedInstanceLongTermRetentionPolicyListResult { 2509 return page.miltrplr 2510} 2511 2512// Values returns the slice of values for the current page or nil if there are no values. 2513func (page ManagedInstanceLongTermRetentionPolicyListResultPage) Values() []ManagedInstanceLongTermRetentionPolicy { 2514 if page.miltrplr.IsEmpty() { 2515 return nil 2516 } 2517 return *page.miltrplr.Value 2518} 2519 2520// Creates a new instance of the ManagedInstanceLongTermRetentionPolicyListResultPage type. 2521func NewManagedInstanceLongTermRetentionPolicyListResultPage(cur ManagedInstanceLongTermRetentionPolicyListResult, getNextPage func(context.Context, ManagedInstanceLongTermRetentionPolicyListResult) (ManagedInstanceLongTermRetentionPolicyListResult, error)) ManagedInstanceLongTermRetentionPolicyListResultPage { 2522 return ManagedInstanceLongTermRetentionPolicyListResultPage{ 2523 fn: getNextPage, 2524 miltrplr: cur, 2525 } 2526} 2527 2528// ManagedInstanceOperation a managed instance operation. 2529type ManagedInstanceOperation struct { 2530 autorest.Response `json:"-"` 2531 // ManagedInstanceOperationProperties - Resource properties. 2532 *ManagedInstanceOperationProperties `json:"properties,omitempty"` 2533 // ID - READ-ONLY; Resource ID. 2534 ID *string `json:"id,omitempty"` 2535 // Name - READ-ONLY; Resource name. 2536 Name *string `json:"name,omitempty"` 2537 // Type - READ-ONLY; Resource type. 2538 Type *string `json:"type,omitempty"` 2539} 2540 2541// MarshalJSON is the custom marshaler for ManagedInstanceOperation. 2542func (mio ManagedInstanceOperation) MarshalJSON() ([]byte, error) { 2543 objectMap := make(map[string]interface{}) 2544 if mio.ManagedInstanceOperationProperties != nil { 2545 objectMap["properties"] = mio.ManagedInstanceOperationProperties 2546 } 2547 return json.Marshal(objectMap) 2548} 2549 2550// UnmarshalJSON is the custom unmarshaler for ManagedInstanceOperation struct. 2551func (mio *ManagedInstanceOperation) UnmarshalJSON(body []byte) error { 2552 var m map[string]*json.RawMessage 2553 err := json.Unmarshal(body, &m) 2554 if err != nil { 2555 return err 2556 } 2557 for k, v := range m { 2558 switch k { 2559 case "properties": 2560 if v != nil { 2561 var managedInstanceOperationProperties ManagedInstanceOperationProperties 2562 err = json.Unmarshal(*v, &managedInstanceOperationProperties) 2563 if err != nil { 2564 return err 2565 } 2566 mio.ManagedInstanceOperationProperties = &managedInstanceOperationProperties 2567 } 2568 case "id": 2569 if v != nil { 2570 var ID string 2571 err = json.Unmarshal(*v, &ID) 2572 if err != nil { 2573 return err 2574 } 2575 mio.ID = &ID 2576 } 2577 case "name": 2578 if v != nil { 2579 var name string 2580 err = json.Unmarshal(*v, &name) 2581 if err != nil { 2582 return err 2583 } 2584 mio.Name = &name 2585 } 2586 case "type": 2587 if v != nil { 2588 var typeVar string 2589 err = json.Unmarshal(*v, &typeVar) 2590 if err != nil { 2591 return err 2592 } 2593 mio.Type = &typeVar 2594 } 2595 } 2596 } 2597 2598 return nil 2599} 2600 2601// ManagedInstanceOperationListResult the response to a list managed instance operations request 2602type ManagedInstanceOperationListResult struct { 2603 autorest.Response `json:"-"` 2604 // Value - READ-ONLY; Array of results. 2605 Value *[]ManagedInstanceOperation `json:"value,omitempty"` 2606 // NextLink - READ-ONLY; Link to retrieve next page of results. 2607 NextLink *string `json:"nextLink,omitempty"` 2608} 2609 2610// MarshalJSON is the custom marshaler for ManagedInstanceOperationListResult. 2611func (miolr ManagedInstanceOperationListResult) MarshalJSON() ([]byte, error) { 2612 objectMap := make(map[string]interface{}) 2613 return json.Marshal(objectMap) 2614} 2615 2616// ManagedInstanceOperationListResultIterator provides access to a complete listing of 2617// ManagedInstanceOperation values. 2618type ManagedInstanceOperationListResultIterator struct { 2619 i int 2620 page ManagedInstanceOperationListResultPage 2621} 2622 2623// NextWithContext advances to the next value. If there was an error making 2624// the request the iterator does not advance and the error is returned. 2625func (iter *ManagedInstanceOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2626 if tracing.IsEnabled() { 2627 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationListResultIterator.NextWithContext") 2628 defer func() { 2629 sc := -1 2630 if iter.Response().Response.Response != nil { 2631 sc = iter.Response().Response.Response.StatusCode 2632 } 2633 tracing.EndSpan(ctx, sc, err) 2634 }() 2635 } 2636 iter.i++ 2637 if iter.i < len(iter.page.Values()) { 2638 return nil 2639 } 2640 err = iter.page.NextWithContext(ctx) 2641 if err != nil { 2642 iter.i-- 2643 return err 2644 } 2645 iter.i = 0 2646 return nil 2647} 2648 2649// Next advances to the next value. If there was an error making 2650// the request the iterator does not advance and the error is returned. 2651// Deprecated: Use NextWithContext() instead. 2652func (iter *ManagedInstanceOperationListResultIterator) Next() error { 2653 return iter.NextWithContext(context.Background()) 2654} 2655 2656// NotDone returns true if the enumeration should be started or is not yet complete. 2657func (iter ManagedInstanceOperationListResultIterator) NotDone() bool { 2658 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2659} 2660 2661// Response returns the raw server response from the last page request. 2662func (iter ManagedInstanceOperationListResultIterator) Response() ManagedInstanceOperationListResult { 2663 return iter.page.Response() 2664} 2665 2666// Value returns the current value or a zero-initialized value if the 2667// iterator has advanced beyond the end of the collection. 2668func (iter ManagedInstanceOperationListResultIterator) Value() ManagedInstanceOperation { 2669 if !iter.page.NotDone() { 2670 return ManagedInstanceOperation{} 2671 } 2672 return iter.page.Values()[iter.i] 2673} 2674 2675// Creates a new instance of the ManagedInstanceOperationListResultIterator type. 2676func NewManagedInstanceOperationListResultIterator(page ManagedInstanceOperationListResultPage) ManagedInstanceOperationListResultIterator { 2677 return ManagedInstanceOperationListResultIterator{page: page} 2678} 2679 2680// IsEmpty returns true if the ListResult contains no values. 2681func (miolr ManagedInstanceOperationListResult) IsEmpty() bool { 2682 return miolr.Value == nil || len(*miolr.Value) == 0 2683} 2684 2685// hasNextLink returns true if the NextLink is not empty. 2686func (miolr ManagedInstanceOperationListResult) hasNextLink() bool { 2687 return miolr.NextLink != nil && len(*miolr.NextLink) != 0 2688} 2689 2690// managedInstanceOperationListResultPreparer prepares a request to retrieve the next set of results. 2691// It returns nil if no more results exist. 2692func (miolr ManagedInstanceOperationListResult) managedInstanceOperationListResultPreparer(ctx context.Context) (*http.Request, error) { 2693 if !miolr.hasNextLink() { 2694 return nil, nil 2695 } 2696 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2697 autorest.AsJSON(), 2698 autorest.AsGet(), 2699 autorest.WithBaseURL(to.String(miolr.NextLink))) 2700} 2701 2702// ManagedInstanceOperationListResultPage contains a page of ManagedInstanceOperation values. 2703type ManagedInstanceOperationListResultPage struct { 2704 fn func(context.Context, ManagedInstanceOperationListResult) (ManagedInstanceOperationListResult, error) 2705 miolr ManagedInstanceOperationListResult 2706} 2707 2708// NextWithContext advances to the next page of values. If there was an error making 2709// the request the page does not advance and the error is returned. 2710func (page *ManagedInstanceOperationListResultPage) NextWithContext(ctx context.Context) (err error) { 2711 if tracing.IsEnabled() { 2712 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceOperationListResultPage.NextWithContext") 2713 defer func() { 2714 sc := -1 2715 if page.Response().Response.Response != nil { 2716 sc = page.Response().Response.Response.StatusCode 2717 } 2718 tracing.EndSpan(ctx, sc, err) 2719 }() 2720 } 2721 for { 2722 next, err := page.fn(ctx, page.miolr) 2723 if err != nil { 2724 return err 2725 } 2726 page.miolr = next 2727 if !next.hasNextLink() || !next.IsEmpty() { 2728 break 2729 } 2730 } 2731 return nil 2732} 2733 2734// Next advances to the next page of values. If there was an error making 2735// the request the page does not advance and the error is returned. 2736// Deprecated: Use NextWithContext() instead. 2737func (page *ManagedInstanceOperationListResultPage) Next() error { 2738 return page.NextWithContext(context.Background()) 2739} 2740 2741// NotDone returns true if the page enumeration should be started or is not yet complete. 2742func (page ManagedInstanceOperationListResultPage) NotDone() bool { 2743 return !page.miolr.IsEmpty() 2744} 2745 2746// Response returns the raw server response from the last page request. 2747func (page ManagedInstanceOperationListResultPage) Response() ManagedInstanceOperationListResult { 2748 return page.miolr 2749} 2750 2751// Values returns the slice of values for the current page or nil if there are no values. 2752func (page ManagedInstanceOperationListResultPage) Values() []ManagedInstanceOperation { 2753 if page.miolr.IsEmpty() { 2754 return nil 2755 } 2756 return *page.miolr.Value 2757} 2758 2759// Creates a new instance of the ManagedInstanceOperationListResultPage type. 2760func NewManagedInstanceOperationListResultPage(cur ManagedInstanceOperationListResult, getNextPage func(context.Context, ManagedInstanceOperationListResult) (ManagedInstanceOperationListResult, error)) ManagedInstanceOperationListResultPage { 2761 return ManagedInstanceOperationListResultPage{ 2762 fn: getNextPage, 2763 miolr: cur, 2764 } 2765} 2766 2767// ManagedInstanceOperationParametersPair the parameters of a managed instance operation. 2768type ManagedInstanceOperationParametersPair struct { 2769 // CurrentParameters - READ-ONLY; The current parameters. 2770 CurrentParameters *UpsertManagedServerOperationParameters `json:"currentParameters,omitempty"` 2771 // RequestedParameters - READ-ONLY; The requested parameters. 2772 RequestedParameters *UpsertManagedServerOperationParameters `json:"requestedParameters,omitempty"` 2773} 2774 2775// MarshalJSON is the custom marshaler for ManagedInstanceOperationParametersPair. 2776func (miopp ManagedInstanceOperationParametersPair) MarshalJSON() ([]byte, error) { 2777 objectMap := make(map[string]interface{}) 2778 return json.Marshal(objectMap) 2779} 2780 2781// ManagedInstanceOperationProperties the properties of a managed instance operation. 2782type ManagedInstanceOperationProperties struct { 2783 // ManagedInstanceName - READ-ONLY; The name of the managed instance the operation is being performed on. 2784 ManagedInstanceName *string `json:"managedInstanceName,omitempty"` 2785 // Operation - READ-ONLY; The name of operation. 2786 Operation *string `json:"operation,omitempty"` 2787 // OperationFriendlyName - READ-ONLY; The friendly name of operation. 2788 OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` 2789 // PercentComplete - READ-ONLY; The percentage of the operation completed. 2790 PercentComplete *int32 `json:"percentComplete,omitempty"` 2791 // StartTime - READ-ONLY; The operation start time. 2792 StartTime *date.Time `json:"startTime,omitempty"` 2793 // State - READ-ONLY; The operation state. Possible values include: 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled' 2794 State ManagementOperationState `json:"state,omitempty"` 2795 // ErrorCode - READ-ONLY; The operation error code. 2796 ErrorCode *int32 `json:"errorCode,omitempty"` 2797 // ErrorDescription - READ-ONLY; The operation error description. 2798 ErrorDescription *string `json:"errorDescription,omitempty"` 2799 // ErrorSeverity - READ-ONLY; The operation error severity. 2800 ErrorSeverity *int32 `json:"errorSeverity,omitempty"` 2801 // IsUserError - READ-ONLY; Whether or not the error is a user error. 2802 IsUserError *bool `json:"isUserError,omitempty"` 2803 // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. 2804 EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` 2805 // Description - READ-ONLY; The operation description. 2806 Description *string `json:"description,omitempty"` 2807 // IsCancellable - READ-ONLY; Whether the operation can be cancelled. 2808 IsCancellable *bool `json:"isCancellable,omitempty"` 2809 // OperationParameters - READ-ONLY; The operation parameters. 2810 OperationParameters *ManagedInstanceOperationParametersPair `json:"operationParameters,omitempty"` 2811 // OperationSteps - READ-ONLY; The operation steps. 2812 OperationSteps *ManagedInstanceOperationSteps `json:"operationSteps,omitempty"` 2813} 2814 2815// MarshalJSON is the custom marshaler for ManagedInstanceOperationProperties. 2816func (miop ManagedInstanceOperationProperties) MarshalJSON() ([]byte, error) { 2817 objectMap := make(map[string]interface{}) 2818 return json.Marshal(objectMap) 2819} 2820 2821// ManagedInstanceOperationSteps the steps of a managed instance operation. 2822type ManagedInstanceOperationSteps struct { 2823 // TotalSteps - READ-ONLY; The total number of operation steps. 2824 TotalSteps *string `json:"totalSteps,omitempty"` 2825 // CurrentStep - READ-ONLY; The number of current operation steps. 2826 CurrentStep *int32 `json:"currentStep,omitempty"` 2827 // StepsList - READ-ONLY; The operation steps list. 2828 StepsList *[]UpsertManagedServerOperationStep `json:"stepsList,omitempty"` 2829} 2830 2831// MarshalJSON is the custom marshaler for ManagedInstanceOperationSteps. 2832func (mios ManagedInstanceOperationSteps) MarshalJSON() ([]byte, error) { 2833 objectMap := make(map[string]interface{}) 2834 return json.Marshal(objectMap) 2835} 2836 2837// ManagedInstanceProperties the properties of a managed instance. 2838type ManagedInstanceProperties struct { 2839 // ManagedInstanceCreateMode - Specifies the mode of database creation. 2840 // 2841 // Default: Regular instance creation. 2842 // 2843 // Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'ManagedServerCreateModeDefault', 'ManagedServerCreateModePointInTimeRestore' 2844 ManagedInstanceCreateMode ManagedServerCreateMode `json:"managedInstanceCreateMode,omitempty"` 2845 // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the managed instance. 2846 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` 2847 // AdministratorLogin - Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). 2848 AdministratorLogin *string `json:"administratorLogin,omitempty"` 2849 // AdministratorLoginPassword - The administrator login password (required for managed instance creation). 2850 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` 2851 // SubnetID - Subnet resource ID for the managed instance. 2852 SubnetID *string `json:"subnetId,omitempty"` 2853 // State - READ-ONLY; The state of the managed instance. 2854 State *string `json:"state,omitempty"` 2855 // LicenseType - The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'ManagedInstanceLicenseTypeLicenseIncluded', 'ManagedInstanceLicenseTypeBasePrice' 2856 LicenseType ManagedInstanceLicenseType `json:"licenseType,omitempty"` 2857 // VCores - The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. 2858 VCores *int32 `json:"vCores,omitempty"` 2859 // StorageSizeInGB - Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. 2860 StorageSizeInGB *int32 `json:"storageSizeInGB,omitempty"` 2861 // Collation - Collation of the managed instance. 2862 Collation *string `json:"collation,omitempty"` 2863 // DNSZone - READ-ONLY; The Dns Zone that the managed instance is in. 2864 DNSZone *string `json:"dnsZone,omitempty"` 2865 // DNSZonePartner - The resource id of another managed instance whose DNS zone this managed instance will share after creation. 2866 DNSZonePartner *string `json:"dnsZonePartner,omitempty"` 2867 // PublicDataEndpointEnabled - Whether or not the public data endpoint is enabled. 2868 PublicDataEndpointEnabled *bool `json:"publicDataEndpointEnabled,omitempty"` 2869 // SourceManagedInstanceID - The resource identifier of the source managed instance associated with create operation of this instance. 2870 SourceManagedInstanceID *string `json:"sourceManagedInstanceId,omitempty"` 2871 // RestorePointInTime - Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. 2872 RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` 2873 // ProxyOverride - Connection type used for connecting to the instance. Possible values include: 'ManagedInstanceProxyOverrideProxy', 'ManagedInstanceProxyOverrideRedirect', 'ManagedInstanceProxyOverrideDefault' 2874 ProxyOverride ManagedInstanceProxyOverride `json:"proxyOverride,omitempty"` 2875 // TimezoneID - Id of the timezone. Allowed values are timezones supported by Windows. 2876 // Windows keeps details on supported timezones, including the id, in registry under 2877 // KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. 2878 // You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. 2879 // List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. 2880 // An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". 2881 TimezoneID *string `json:"timezoneId,omitempty"` 2882 // InstancePoolID - The Id of the instance pool this managed server belongs to. 2883 InstancePoolID *string `json:"instancePoolId,omitempty"` 2884 // MaintenanceConfigurationID - Specifies maintenance configuration id to apply to this managed instance. 2885 MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` 2886 // MinimalTLSVersion - Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' 2887 MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` 2888} 2889 2890// MarshalJSON is the custom marshaler for ManagedInstanceProperties. 2891func (mip ManagedInstanceProperties) MarshalJSON() ([]byte, error) { 2892 objectMap := make(map[string]interface{}) 2893 if mip.ManagedInstanceCreateMode != "" { 2894 objectMap["managedInstanceCreateMode"] = mip.ManagedInstanceCreateMode 2895 } 2896 if mip.AdministratorLogin != nil { 2897 objectMap["administratorLogin"] = mip.AdministratorLogin 2898 } 2899 if mip.AdministratorLoginPassword != nil { 2900 objectMap["administratorLoginPassword"] = mip.AdministratorLoginPassword 2901 } 2902 if mip.SubnetID != nil { 2903 objectMap["subnetId"] = mip.SubnetID 2904 } 2905 if mip.LicenseType != "" { 2906 objectMap["licenseType"] = mip.LicenseType 2907 } 2908 if mip.VCores != nil { 2909 objectMap["vCores"] = mip.VCores 2910 } 2911 if mip.StorageSizeInGB != nil { 2912 objectMap["storageSizeInGB"] = mip.StorageSizeInGB 2913 } 2914 if mip.Collation != nil { 2915 objectMap["collation"] = mip.Collation 2916 } 2917 if mip.DNSZonePartner != nil { 2918 objectMap["dnsZonePartner"] = mip.DNSZonePartner 2919 } 2920 if mip.PublicDataEndpointEnabled != nil { 2921 objectMap["publicDataEndpointEnabled"] = mip.PublicDataEndpointEnabled 2922 } 2923 if mip.SourceManagedInstanceID != nil { 2924 objectMap["sourceManagedInstanceId"] = mip.SourceManagedInstanceID 2925 } 2926 if mip.RestorePointInTime != nil { 2927 objectMap["restorePointInTime"] = mip.RestorePointInTime 2928 } 2929 if mip.ProxyOverride != "" { 2930 objectMap["proxyOverride"] = mip.ProxyOverride 2931 } 2932 if mip.TimezoneID != nil { 2933 objectMap["timezoneId"] = mip.TimezoneID 2934 } 2935 if mip.InstancePoolID != nil { 2936 objectMap["instancePoolId"] = mip.InstancePoolID 2937 } 2938 if mip.MaintenanceConfigurationID != nil { 2939 objectMap["maintenanceConfigurationId"] = mip.MaintenanceConfigurationID 2940 } 2941 if mip.MinimalTLSVersion != nil { 2942 objectMap["minimalTlsVersion"] = mip.MinimalTLSVersion 2943 } 2944 return json.Marshal(objectMap) 2945} 2946 2947// ManagedInstancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 2948// long-running operation. 2949type ManagedInstancesCreateOrUpdateFuture struct { 2950 azure.FutureAPI 2951 // Result returns the result of the asynchronous operation. 2952 // If the operation has not completed it will return an error. 2953 Result func(ManagedInstancesClient) (ManagedInstance, error) 2954} 2955 2956// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2957func (future *ManagedInstancesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 2958 var azFuture azure.Future 2959 if err := json.Unmarshal(body, &azFuture); err != nil { 2960 return err 2961 } 2962 future.FutureAPI = &azFuture 2963 future.Result = future.result 2964 return nil 2965} 2966 2967// result is the default implementation for ManagedInstancesCreateOrUpdateFuture.Result. 2968func (future *ManagedInstancesCreateOrUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { 2969 var done bool 2970 done, err = future.DoneWithContext(context.Background(), client) 2971 if err != nil { 2972 err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 2973 return 2974 } 2975 if !done { 2976 mi.Response.Response = future.Response() 2977 err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesCreateOrUpdateFuture") 2978 return 2979 } 2980 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2981 if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { 2982 mi, err = client.CreateOrUpdateResponder(mi.Response.Response) 2983 if err != nil { 2984 err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") 2985 } 2986 } 2987 return 2988} 2989 2990// ManagedInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2991// operation. 2992type ManagedInstancesDeleteFuture struct { 2993 azure.FutureAPI 2994 // Result returns the result of the asynchronous operation. 2995 // If the operation has not completed it will return an error. 2996 Result func(ManagedInstancesClient) (autorest.Response, error) 2997} 2998 2999// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3000func (future *ManagedInstancesDeleteFuture) UnmarshalJSON(body []byte) error { 3001 var azFuture azure.Future 3002 if err := json.Unmarshal(body, &azFuture); err != nil { 3003 return err 3004 } 3005 future.FutureAPI = &azFuture 3006 future.Result = future.result 3007 return nil 3008} 3009 3010// result is the default implementation for ManagedInstancesDeleteFuture.Result. 3011func (future *ManagedInstancesDeleteFuture) result(client ManagedInstancesClient) (ar autorest.Response, err error) { 3012 var done bool 3013 done, err = future.DoneWithContext(context.Background(), client) 3014 if err != nil { 3015 err = autorest.NewErrorWithError(err, "sql.ManagedInstancesDeleteFuture", "Result", future.Response(), "Polling failure") 3016 return 3017 } 3018 if !done { 3019 ar.Response = future.Response() 3020 err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesDeleteFuture") 3021 return 3022 } 3023 ar.Response = future.Response() 3024 return 3025} 3026 3027// ManagedInstancesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 3028// operation. 3029type ManagedInstancesUpdateFuture struct { 3030 azure.FutureAPI 3031 // Result returns the result of the asynchronous operation. 3032 // If the operation has not completed it will return an error. 3033 Result func(ManagedInstancesClient) (ManagedInstance, error) 3034} 3035 3036// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3037func (future *ManagedInstancesUpdateFuture) UnmarshalJSON(body []byte) error { 3038 var azFuture azure.Future 3039 if err := json.Unmarshal(body, &azFuture); err != nil { 3040 return err 3041 } 3042 future.FutureAPI = &azFuture 3043 future.Result = future.result 3044 return nil 3045} 3046 3047// result is the default implementation for ManagedInstancesUpdateFuture.Result. 3048func (future *ManagedInstancesUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { 3049 var done bool 3050 done, err = future.DoneWithContext(context.Background(), client) 3051 if err != nil { 3052 err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", future.Response(), "Polling failure") 3053 return 3054 } 3055 if !done { 3056 mi.Response.Response = future.Response() 3057 err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesUpdateFuture") 3058 return 3059 } 3060 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3061 if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { 3062 mi, err = client.UpdateResponder(mi.Response.Response) 3063 if err != nil { 3064 err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") 3065 } 3066 } 3067 return 3068} 3069 3070// ManagedInstanceUpdate an update request for an Azure SQL Database managed instance. 3071type ManagedInstanceUpdate struct { 3072 // Sku - Managed instance sku 3073 Sku *Sku `json:"sku,omitempty"` 3074 // ManagedInstanceProperties - Resource properties. 3075 *ManagedInstanceProperties `json:"properties,omitempty"` 3076 // Tags - Resource tags. 3077 Tags map[string]*string `json:"tags"` 3078} 3079 3080// MarshalJSON is the custom marshaler for ManagedInstanceUpdate. 3081func (miu ManagedInstanceUpdate) MarshalJSON() ([]byte, error) { 3082 objectMap := make(map[string]interface{}) 3083 if miu.Sku != nil { 3084 objectMap["sku"] = miu.Sku 3085 } 3086 if miu.ManagedInstanceProperties != nil { 3087 objectMap["properties"] = miu.ManagedInstanceProperties 3088 } 3089 if miu.Tags != nil { 3090 objectMap["tags"] = miu.Tags 3091 } 3092 return json.Marshal(objectMap) 3093} 3094 3095// UnmarshalJSON is the custom unmarshaler for ManagedInstanceUpdate struct. 3096func (miu *ManagedInstanceUpdate) UnmarshalJSON(body []byte) error { 3097 var m map[string]*json.RawMessage 3098 err := json.Unmarshal(body, &m) 3099 if err != nil { 3100 return err 3101 } 3102 for k, v := range m { 3103 switch k { 3104 case "sku": 3105 if v != nil { 3106 var sku Sku 3107 err = json.Unmarshal(*v, &sku) 3108 if err != nil { 3109 return err 3110 } 3111 miu.Sku = &sku 3112 } 3113 case "properties": 3114 if v != nil { 3115 var managedInstanceProperties ManagedInstanceProperties 3116 err = json.Unmarshal(*v, &managedInstanceProperties) 3117 if err != nil { 3118 return err 3119 } 3120 miu.ManagedInstanceProperties = &managedInstanceProperties 3121 } 3122 case "tags": 3123 if v != nil { 3124 var tags map[string]*string 3125 err = json.Unmarshal(*v, &tags) 3126 if err != nil { 3127 return err 3128 } 3129 miu.Tags = tags 3130 } 3131 } 3132 } 3133 3134 return nil 3135} 3136 3137// ManagedInstanceVulnerabilityAssessment a managed instance vulnerability assessment. 3138type ManagedInstanceVulnerabilityAssessment struct { 3139 autorest.Response `json:"-"` 3140 // ManagedInstanceVulnerabilityAssessmentProperties - Resource properties. 3141 *ManagedInstanceVulnerabilityAssessmentProperties `json:"properties,omitempty"` 3142 // ID - READ-ONLY; Resource ID. 3143 ID *string `json:"id,omitempty"` 3144 // Name - READ-ONLY; Resource name. 3145 Name *string `json:"name,omitempty"` 3146 // Type - READ-ONLY; Resource type. 3147 Type *string `json:"type,omitempty"` 3148} 3149 3150// MarshalJSON is the custom marshaler for ManagedInstanceVulnerabilityAssessment. 3151func (miva ManagedInstanceVulnerabilityAssessment) MarshalJSON() ([]byte, error) { 3152 objectMap := make(map[string]interface{}) 3153 if miva.ManagedInstanceVulnerabilityAssessmentProperties != nil { 3154 objectMap["properties"] = miva.ManagedInstanceVulnerabilityAssessmentProperties 3155 } 3156 return json.Marshal(objectMap) 3157} 3158 3159// UnmarshalJSON is the custom unmarshaler for ManagedInstanceVulnerabilityAssessment struct. 3160func (miva *ManagedInstanceVulnerabilityAssessment) UnmarshalJSON(body []byte) error { 3161 var m map[string]*json.RawMessage 3162 err := json.Unmarshal(body, &m) 3163 if err != nil { 3164 return err 3165 } 3166 for k, v := range m { 3167 switch k { 3168 case "properties": 3169 if v != nil { 3170 var managedInstanceVulnerabilityAssessmentProperties ManagedInstanceVulnerabilityAssessmentProperties 3171 err = json.Unmarshal(*v, &managedInstanceVulnerabilityAssessmentProperties) 3172 if err != nil { 3173 return err 3174 } 3175 miva.ManagedInstanceVulnerabilityAssessmentProperties = &managedInstanceVulnerabilityAssessmentProperties 3176 } 3177 case "id": 3178 if v != nil { 3179 var ID string 3180 err = json.Unmarshal(*v, &ID) 3181 if err != nil { 3182 return err 3183 } 3184 miva.ID = &ID 3185 } 3186 case "name": 3187 if v != nil { 3188 var name string 3189 err = json.Unmarshal(*v, &name) 3190 if err != nil { 3191 return err 3192 } 3193 miva.Name = &name 3194 } 3195 case "type": 3196 if v != nil { 3197 var typeVar string 3198 err = json.Unmarshal(*v, &typeVar) 3199 if err != nil { 3200 return err 3201 } 3202 miva.Type = &typeVar 3203 } 3204 } 3205 } 3206 3207 return nil 3208} 3209 3210// ManagedInstanceVulnerabilityAssessmentListResult a list of the ManagedInstance's vulnerability 3211// assessments. 3212type ManagedInstanceVulnerabilityAssessmentListResult struct { 3213 autorest.Response `json:"-"` 3214 // Value - READ-ONLY; Array of results. 3215 Value *[]ManagedInstanceVulnerabilityAssessment `json:"value,omitempty"` 3216 // NextLink - READ-ONLY; Link to retrieve next page of results. 3217 NextLink *string `json:"nextLink,omitempty"` 3218} 3219 3220// MarshalJSON is the custom marshaler for ManagedInstanceVulnerabilityAssessmentListResult. 3221func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { 3222 objectMap := make(map[string]interface{}) 3223 return json.Marshal(objectMap) 3224} 3225 3226// ManagedInstanceVulnerabilityAssessmentListResultIterator provides access to a complete listing of 3227// ManagedInstanceVulnerabilityAssessment values. 3228type ManagedInstanceVulnerabilityAssessmentListResultIterator struct { 3229 i int 3230 page ManagedInstanceVulnerabilityAssessmentListResultPage 3231} 3232 3233// NextWithContext advances to the next value. If there was an error making 3234// the request the iterator does not advance and the error is returned. 3235func (iter *ManagedInstanceVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { 3236 if tracing.IsEnabled() { 3237 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentListResultIterator.NextWithContext") 3238 defer func() { 3239 sc := -1 3240 if iter.Response().Response.Response != nil { 3241 sc = iter.Response().Response.Response.StatusCode 3242 } 3243 tracing.EndSpan(ctx, sc, err) 3244 }() 3245 } 3246 iter.i++ 3247 if iter.i < len(iter.page.Values()) { 3248 return nil 3249 } 3250 err = iter.page.NextWithContext(ctx) 3251 if err != nil { 3252 iter.i-- 3253 return err 3254 } 3255 iter.i = 0 3256 return nil 3257} 3258 3259// Next advances to the next value. If there was an error making 3260// the request the iterator does not advance and the error is returned. 3261// Deprecated: Use NextWithContext() instead. 3262func (iter *ManagedInstanceVulnerabilityAssessmentListResultIterator) Next() error { 3263 return iter.NextWithContext(context.Background()) 3264} 3265 3266// NotDone returns true if the enumeration should be started or is not yet complete. 3267func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) NotDone() bool { 3268 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3269} 3270 3271// Response returns the raw server response from the last page request. 3272func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) Response() ManagedInstanceVulnerabilityAssessmentListResult { 3273 return iter.page.Response() 3274} 3275 3276// Value returns the current value or a zero-initialized value if the 3277// iterator has advanced beyond the end of the collection. 3278func (iter ManagedInstanceVulnerabilityAssessmentListResultIterator) Value() ManagedInstanceVulnerabilityAssessment { 3279 if !iter.page.NotDone() { 3280 return ManagedInstanceVulnerabilityAssessment{} 3281 } 3282 return iter.page.Values()[iter.i] 3283} 3284 3285// Creates a new instance of the ManagedInstanceVulnerabilityAssessmentListResultIterator type. 3286func NewManagedInstanceVulnerabilityAssessmentListResultIterator(page ManagedInstanceVulnerabilityAssessmentListResultPage) ManagedInstanceVulnerabilityAssessmentListResultIterator { 3287 return ManagedInstanceVulnerabilityAssessmentListResultIterator{page: page} 3288} 3289 3290// IsEmpty returns true if the ListResult contains no values. 3291func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) IsEmpty() bool { 3292 return mivalr.Value == nil || len(*mivalr.Value) == 0 3293} 3294 3295// hasNextLink returns true if the NextLink is not empty. 3296func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) hasNextLink() bool { 3297 return mivalr.NextLink != nil && len(*mivalr.NextLink) != 0 3298} 3299 3300// managedInstanceVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. 3301// It returns nil if no more results exist. 3302func (mivalr ManagedInstanceVulnerabilityAssessmentListResult) managedInstanceVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { 3303 if !mivalr.hasNextLink() { 3304 return nil, nil 3305 } 3306 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3307 autorest.AsJSON(), 3308 autorest.AsGet(), 3309 autorest.WithBaseURL(to.String(mivalr.NextLink))) 3310} 3311 3312// ManagedInstanceVulnerabilityAssessmentListResultPage contains a page of 3313// ManagedInstanceVulnerabilityAssessment values. 3314type ManagedInstanceVulnerabilityAssessmentListResultPage struct { 3315 fn func(context.Context, ManagedInstanceVulnerabilityAssessmentListResult) (ManagedInstanceVulnerabilityAssessmentListResult, error) 3316 mivalr ManagedInstanceVulnerabilityAssessmentListResult 3317} 3318 3319// NextWithContext advances to the next page of values. If there was an error making 3320// the request the page does not advance and the error is returned. 3321func (page *ManagedInstanceVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { 3322 if tracing.IsEnabled() { 3323 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceVulnerabilityAssessmentListResultPage.NextWithContext") 3324 defer func() { 3325 sc := -1 3326 if page.Response().Response.Response != nil { 3327 sc = page.Response().Response.Response.StatusCode 3328 } 3329 tracing.EndSpan(ctx, sc, err) 3330 }() 3331 } 3332 for { 3333 next, err := page.fn(ctx, page.mivalr) 3334 if err != nil { 3335 return err 3336 } 3337 page.mivalr = next 3338 if !next.hasNextLink() || !next.IsEmpty() { 3339 break 3340 } 3341 } 3342 return nil 3343} 3344 3345// Next advances to the next page of values. If there was an error making 3346// the request the page does not advance and the error is returned. 3347// Deprecated: Use NextWithContext() instead. 3348func (page *ManagedInstanceVulnerabilityAssessmentListResultPage) Next() error { 3349 return page.NextWithContext(context.Background()) 3350} 3351 3352// NotDone returns true if the page enumeration should be started or is not yet complete. 3353func (page ManagedInstanceVulnerabilityAssessmentListResultPage) NotDone() bool { 3354 return !page.mivalr.IsEmpty() 3355} 3356 3357// Response returns the raw server response from the last page request. 3358func (page ManagedInstanceVulnerabilityAssessmentListResultPage) Response() ManagedInstanceVulnerabilityAssessmentListResult { 3359 return page.mivalr 3360} 3361 3362// Values returns the slice of values for the current page or nil if there are no values. 3363func (page ManagedInstanceVulnerabilityAssessmentListResultPage) Values() []ManagedInstanceVulnerabilityAssessment { 3364 if page.mivalr.IsEmpty() { 3365 return nil 3366 } 3367 return *page.mivalr.Value 3368} 3369 3370// Creates a new instance of the ManagedInstanceVulnerabilityAssessmentListResultPage type. 3371func NewManagedInstanceVulnerabilityAssessmentListResultPage(cur ManagedInstanceVulnerabilityAssessmentListResult, getNextPage func(context.Context, ManagedInstanceVulnerabilityAssessmentListResult) (ManagedInstanceVulnerabilityAssessmentListResult, error)) ManagedInstanceVulnerabilityAssessmentListResultPage { 3372 return ManagedInstanceVulnerabilityAssessmentListResultPage{ 3373 fn: getNextPage, 3374 mivalr: cur, 3375 } 3376} 3377 3378// ManagedInstanceVulnerabilityAssessmentProperties properties of a managed instance vulnerability 3379// assessment. 3380type ManagedInstanceVulnerabilityAssessmentProperties struct { 3381 // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). 3382 StorageContainerPath *string `json:"storageContainerPath,omitempty"` 3383 // StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. 3384 StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` 3385 // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. 3386 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 3387 // RecurringScans - The recurring scans settings 3388 RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` 3389} 3390 3391// Name ARM Usage Name 3392type Name struct { 3393 // Value - Usage name value 3394 Value *string `json:"value,omitempty"` 3395 // LocalizedValue - Usage name localized value. 3396 LocalizedValue *string `json:"localizedValue,omitempty"` 3397} 3398 3399// PrivateEndpointConnection a private endpoint connection 3400type PrivateEndpointConnection struct { 3401 autorest.Response `json:"-"` 3402 // PrivateEndpointConnectionProperties - Resource properties. 3403 *PrivateEndpointConnectionProperties `json:"properties,omitempty"` 3404 // ID - READ-ONLY; Resource ID. 3405 ID *string `json:"id,omitempty"` 3406 // Name - READ-ONLY; Resource name. 3407 Name *string `json:"name,omitempty"` 3408 // Type - READ-ONLY; Resource type. 3409 Type *string `json:"type,omitempty"` 3410} 3411 3412// MarshalJSON is the custom marshaler for PrivateEndpointConnection. 3413func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { 3414 objectMap := make(map[string]interface{}) 3415 if pec.PrivateEndpointConnectionProperties != nil { 3416 objectMap["properties"] = pec.PrivateEndpointConnectionProperties 3417 } 3418 return json.Marshal(objectMap) 3419} 3420 3421// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. 3422func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { 3423 var m map[string]*json.RawMessage 3424 err := json.Unmarshal(body, &m) 3425 if err != nil { 3426 return err 3427 } 3428 for k, v := range m { 3429 switch k { 3430 case "properties": 3431 if v != nil { 3432 var privateEndpointConnectionProperties PrivateEndpointConnectionProperties 3433 err = json.Unmarshal(*v, &privateEndpointConnectionProperties) 3434 if err != nil { 3435 return err 3436 } 3437 pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties 3438 } 3439 case "id": 3440 if v != nil { 3441 var ID string 3442 err = json.Unmarshal(*v, &ID) 3443 if err != nil { 3444 return err 3445 } 3446 pec.ID = &ID 3447 } 3448 case "name": 3449 if v != nil { 3450 var name string 3451 err = json.Unmarshal(*v, &name) 3452 if err != nil { 3453 return err 3454 } 3455 pec.Name = &name 3456 } 3457 case "type": 3458 if v != nil { 3459 var typeVar string 3460 err = json.Unmarshal(*v, &typeVar) 3461 if err != nil { 3462 return err 3463 } 3464 pec.Type = &typeVar 3465 } 3466 } 3467 } 3468 3469 return nil 3470} 3471 3472// PrivateEndpointConnectionListResult a list of private endpoint connections. 3473type PrivateEndpointConnectionListResult struct { 3474 autorest.Response `json:"-"` 3475 // Value - READ-ONLY; Array of results. 3476 Value *[]PrivateEndpointConnection `json:"value,omitempty"` 3477 // NextLink - READ-ONLY; Link to retrieve next page of results. 3478 NextLink *string `json:"nextLink,omitempty"` 3479} 3480 3481// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. 3482func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { 3483 objectMap := make(map[string]interface{}) 3484 return json.Marshal(objectMap) 3485} 3486 3487// PrivateEndpointConnectionListResultIterator provides access to a complete listing of 3488// PrivateEndpointConnection values. 3489type PrivateEndpointConnectionListResultIterator struct { 3490 i int 3491 page PrivateEndpointConnectionListResultPage 3492} 3493 3494// NextWithContext advances to the next value. If there was an error making 3495// the request the iterator does not advance and the error is returned. 3496func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { 3497 if tracing.IsEnabled() { 3498 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") 3499 defer func() { 3500 sc := -1 3501 if iter.Response().Response.Response != nil { 3502 sc = iter.Response().Response.Response.StatusCode 3503 } 3504 tracing.EndSpan(ctx, sc, err) 3505 }() 3506 } 3507 iter.i++ 3508 if iter.i < len(iter.page.Values()) { 3509 return nil 3510 } 3511 err = iter.page.NextWithContext(ctx) 3512 if err != nil { 3513 iter.i-- 3514 return err 3515 } 3516 iter.i = 0 3517 return nil 3518} 3519 3520// Next advances to the next value. If there was an error making 3521// the request the iterator does not advance and the error is returned. 3522// Deprecated: Use NextWithContext() instead. 3523func (iter *PrivateEndpointConnectionListResultIterator) Next() error { 3524 return iter.NextWithContext(context.Background()) 3525} 3526 3527// NotDone returns true if the enumeration should be started or is not yet complete. 3528func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { 3529 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3530} 3531 3532// Response returns the raw server response from the last page request. 3533func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { 3534 return iter.page.Response() 3535} 3536 3537// Value returns the current value or a zero-initialized value if the 3538// iterator has advanced beyond the end of the collection. 3539func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { 3540 if !iter.page.NotDone() { 3541 return PrivateEndpointConnection{} 3542 } 3543 return iter.page.Values()[iter.i] 3544} 3545 3546// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. 3547func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { 3548 return PrivateEndpointConnectionListResultIterator{page: page} 3549} 3550 3551// IsEmpty returns true if the ListResult contains no values. 3552func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { 3553 return peclr.Value == nil || len(*peclr.Value) == 0 3554} 3555 3556// hasNextLink returns true if the NextLink is not empty. 3557func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { 3558 return peclr.NextLink != nil && len(*peclr.NextLink) != 0 3559} 3560 3561// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. 3562// It returns nil if no more results exist. 3563func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { 3564 if !peclr.hasNextLink() { 3565 return nil, nil 3566 } 3567 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3568 autorest.AsJSON(), 3569 autorest.AsGet(), 3570 autorest.WithBaseURL(to.String(peclr.NextLink))) 3571} 3572 3573// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. 3574type PrivateEndpointConnectionListResultPage struct { 3575 fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) 3576 peclr PrivateEndpointConnectionListResult 3577} 3578 3579// NextWithContext advances to the next page of values. If there was an error making 3580// the request the page does not advance and the error is returned. 3581func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { 3582 if tracing.IsEnabled() { 3583 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") 3584 defer func() { 3585 sc := -1 3586 if page.Response().Response.Response != nil { 3587 sc = page.Response().Response.Response.StatusCode 3588 } 3589 tracing.EndSpan(ctx, sc, err) 3590 }() 3591 } 3592 for { 3593 next, err := page.fn(ctx, page.peclr) 3594 if err != nil { 3595 return err 3596 } 3597 page.peclr = next 3598 if !next.hasNextLink() || !next.IsEmpty() { 3599 break 3600 } 3601 } 3602 return nil 3603} 3604 3605// Next advances to the next page of values. If there was an error making 3606// the request the page does not advance and the error is returned. 3607// Deprecated: Use NextWithContext() instead. 3608func (page *PrivateEndpointConnectionListResultPage) Next() error { 3609 return page.NextWithContext(context.Background()) 3610} 3611 3612// NotDone returns true if the page enumeration should be started or is not yet complete. 3613func (page PrivateEndpointConnectionListResultPage) NotDone() bool { 3614 return !page.peclr.IsEmpty() 3615} 3616 3617// Response returns the raw server response from the last page request. 3618func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { 3619 return page.peclr 3620} 3621 3622// Values returns the slice of values for the current page or nil if there are no values. 3623func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { 3624 if page.peclr.IsEmpty() { 3625 return nil 3626 } 3627 return *page.peclr.Value 3628} 3629 3630// Creates a new instance of the PrivateEndpointConnectionListResultPage type. 3631func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { 3632 return PrivateEndpointConnectionListResultPage{ 3633 fn: getNextPage, 3634 peclr: cur, 3635 } 3636} 3637 3638// PrivateEndpointConnectionProperties properties of a private endpoint connection. 3639type PrivateEndpointConnectionProperties struct { 3640 // PrivateEndpoint - Private endpoint which the connection belongs to. 3641 PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` 3642 // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. 3643 PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` 3644 // ProvisioningState - READ-ONLY; State of the private endpoint connection. 3645 ProvisioningState *string `json:"provisioningState,omitempty"` 3646} 3647 3648// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. 3649func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { 3650 objectMap := make(map[string]interface{}) 3651 if pecp.PrivateEndpoint != nil { 3652 objectMap["privateEndpoint"] = pecp.PrivateEndpoint 3653 } 3654 if pecp.PrivateLinkServiceConnectionState != nil { 3655 objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState 3656 } 3657 return json.Marshal(objectMap) 3658} 3659 3660// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 3661// of a long-running operation. 3662type PrivateEndpointConnectionsCreateOrUpdateFuture struct { 3663 azure.FutureAPI 3664 // Result returns the result of the asynchronous operation. 3665 // If the operation has not completed it will return an error. 3666 Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) 3667} 3668 3669// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3670func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 3671 var azFuture azure.Future 3672 if err := json.Unmarshal(body, &azFuture); err != nil { 3673 return err 3674 } 3675 future.FutureAPI = &azFuture 3676 future.Result = future.result 3677 return nil 3678} 3679 3680// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. 3681func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { 3682 var done bool 3683 done, err = future.DoneWithContext(context.Background(), client) 3684 if err != nil { 3685 err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 3686 return 3687 } 3688 if !done { 3689 pec.Response.Response = future.Response() 3690 err = azure.NewAsyncOpIncompleteError("sql.PrivateEndpointConnectionsCreateOrUpdateFuture") 3691 return 3692 } 3693 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3694 if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { 3695 pec, err = client.CreateOrUpdateResponder(pec.Response.Response) 3696 if err != nil { 3697 err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") 3698 } 3699 } 3700 return 3701} 3702 3703// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a 3704// long-running operation. 3705type PrivateEndpointConnectionsDeleteFuture struct { 3706 azure.FutureAPI 3707 // Result returns the result of the asynchronous operation. 3708 // If the operation has not completed it will return an error. 3709 Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) 3710} 3711 3712// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3713func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { 3714 var azFuture azure.Future 3715 if err := json.Unmarshal(body, &azFuture); err != nil { 3716 return err 3717 } 3718 future.FutureAPI = &azFuture 3719 future.Result = future.result 3720 return nil 3721} 3722 3723// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. 3724func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { 3725 var done bool 3726 done, err = future.DoneWithContext(context.Background(), client) 3727 if err != nil { 3728 err = autorest.NewErrorWithError(err, "sql.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") 3729 return 3730 } 3731 if !done { 3732 ar.Response = future.Response() 3733 err = azure.NewAsyncOpIncompleteError("sql.PrivateEndpointConnectionsDeleteFuture") 3734 return 3735 } 3736 ar.Response = future.Response() 3737 return 3738} 3739 3740// PrivateEndpointProperty ... 3741type PrivateEndpointProperty struct { 3742 // ID - Resource id of the private endpoint. 3743 ID *string `json:"id,omitempty"` 3744} 3745 3746// PrivateLinkServiceConnectionStateProperty ... 3747type PrivateLinkServiceConnectionStateProperty struct { 3748 // Status - The private link service connection status. 3749 Status *string `json:"status,omitempty"` 3750 // Description - The private link service connection description. 3751 Description *string `json:"description,omitempty"` 3752 // ActionsRequired - READ-ONLY; The actions required for private link service connection. 3753 ActionsRequired *string `json:"actionsRequired,omitempty"` 3754} 3755 3756// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. 3757func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { 3758 objectMap := make(map[string]interface{}) 3759 if plscsp.Status != nil { 3760 objectMap["status"] = plscsp.Status 3761 } 3762 if plscsp.Description != nil { 3763 objectMap["description"] = plscsp.Description 3764 } 3765 return json.Marshal(objectMap) 3766} 3767 3768// ProxyResource ARM proxy resource. 3769type ProxyResource struct { 3770 // ID - READ-ONLY; Resource ID. 3771 ID *string `json:"id,omitempty"` 3772 // Name - READ-ONLY; Resource name. 3773 Name *string `json:"name,omitempty"` 3774 // Type - READ-ONLY; Resource type. 3775 Type *string `json:"type,omitempty"` 3776} 3777 3778// MarshalJSON is the custom marshaler for ProxyResource. 3779func (pr ProxyResource) MarshalJSON() ([]byte, error) { 3780 objectMap := make(map[string]interface{}) 3781 return json.Marshal(objectMap) 3782} 3783 3784// Resource ARM resource. 3785type Resource struct { 3786 // ID - READ-ONLY; Resource ID. 3787 ID *string `json:"id,omitempty"` 3788 // Name - READ-ONLY; Resource name. 3789 Name *string `json:"name,omitempty"` 3790 // Type - READ-ONLY; Resource type. 3791 Type *string `json:"type,omitempty"` 3792} 3793 3794// MarshalJSON is the custom marshaler for Resource. 3795func (r Resource) MarshalJSON() ([]byte, error) { 3796 objectMap := make(map[string]interface{}) 3797 return json.Marshal(objectMap) 3798} 3799 3800// ResourceIdentity azure Active Directory identity configuration for a resource. 3801type ResourceIdentity struct { 3802 // PrincipalID - READ-ONLY; The Azure Active Directory principal id. 3803 PrincipalID *uuid.UUID `json:"principalId,omitempty"` 3804 // Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned' 3805 Type IdentityType `json:"type,omitempty"` 3806 // TenantID - READ-ONLY; The Azure Active Directory tenant id. 3807 TenantID *uuid.UUID `json:"tenantId,omitempty"` 3808} 3809 3810// MarshalJSON is the custom marshaler for ResourceIdentity. 3811func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { 3812 objectMap := make(map[string]interface{}) 3813 if ri.Type != "" { 3814 objectMap["type"] = ri.Type 3815 } 3816 return json.Marshal(objectMap) 3817} 3818 3819// SecurityAlertPolicyProperties properties of a security alert policy. 3820type SecurityAlertPolicyProperties struct { 3821 // State - Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' 3822 State SecurityAlertPolicyState `json:"state,omitempty"` 3823 // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action 3824 DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` 3825 // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. 3826 EmailAddresses *[]string `json:"emailAddresses,omitempty"` 3827 // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. 3828 EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` 3829 // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. 3830 StorageEndpoint *string `json:"storageEndpoint,omitempty"` 3831 // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. 3832 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 3833 // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. 3834 RetentionDays *int32 `json:"retentionDays,omitempty"` 3835 // CreationTime - READ-ONLY; Specifies the UTC creation time of the policy. 3836 CreationTime *date.Time `json:"creationTime,omitempty"` 3837} 3838 3839// MarshalJSON is the custom marshaler for SecurityAlertPolicyProperties. 3840func (sapp SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { 3841 objectMap := make(map[string]interface{}) 3842 if sapp.State != "" { 3843 objectMap["state"] = sapp.State 3844 } 3845 if sapp.DisabledAlerts != nil { 3846 objectMap["disabledAlerts"] = sapp.DisabledAlerts 3847 } 3848 if sapp.EmailAddresses != nil { 3849 objectMap["emailAddresses"] = sapp.EmailAddresses 3850 } 3851 if sapp.EmailAccountAdmins != nil { 3852 objectMap["emailAccountAdmins"] = sapp.EmailAccountAdmins 3853 } 3854 if sapp.StorageEndpoint != nil { 3855 objectMap["storageEndpoint"] = sapp.StorageEndpoint 3856 } 3857 if sapp.StorageAccountAccessKey != nil { 3858 objectMap["storageAccountAccessKey"] = sapp.StorageAccountAccessKey 3859 } 3860 if sapp.RetentionDays != nil { 3861 objectMap["retentionDays"] = sapp.RetentionDays 3862 } 3863 return json.Marshal(objectMap) 3864} 3865 3866// SensitivityLabel a sensitivity label. 3867type SensitivityLabel struct { 3868 autorest.Response `json:"-"` 3869 // SensitivityLabelProperties - Resource properties. 3870 *SensitivityLabelProperties `json:"properties,omitempty"` 3871 // ID - READ-ONLY; Resource ID. 3872 ID *string `json:"id,omitempty"` 3873 // Name - READ-ONLY; Resource name. 3874 Name *string `json:"name,omitempty"` 3875 // Type - READ-ONLY; Resource type. 3876 Type *string `json:"type,omitempty"` 3877} 3878 3879// MarshalJSON is the custom marshaler for SensitivityLabel. 3880func (sl SensitivityLabel) MarshalJSON() ([]byte, error) { 3881 objectMap := make(map[string]interface{}) 3882 if sl.SensitivityLabelProperties != nil { 3883 objectMap["properties"] = sl.SensitivityLabelProperties 3884 } 3885 return json.Marshal(objectMap) 3886} 3887 3888// UnmarshalJSON is the custom unmarshaler for SensitivityLabel struct. 3889func (sl *SensitivityLabel) UnmarshalJSON(body []byte) error { 3890 var m map[string]*json.RawMessage 3891 err := json.Unmarshal(body, &m) 3892 if err != nil { 3893 return err 3894 } 3895 for k, v := range m { 3896 switch k { 3897 case "properties": 3898 if v != nil { 3899 var sensitivityLabelProperties SensitivityLabelProperties 3900 err = json.Unmarshal(*v, &sensitivityLabelProperties) 3901 if err != nil { 3902 return err 3903 } 3904 sl.SensitivityLabelProperties = &sensitivityLabelProperties 3905 } 3906 case "id": 3907 if v != nil { 3908 var ID string 3909 err = json.Unmarshal(*v, &ID) 3910 if err != nil { 3911 return err 3912 } 3913 sl.ID = &ID 3914 } 3915 case "name": 3916 if v != nil { 3917 var name string 3918 err = json.Unmarshal(*v, &name) 3919 if err != nil { 3920 return err 3921 } 3922 sl.Name = &name 3923 } 3924 case "type": 3925 if v != nil { 3926 var typeVar string 3927 err = json.Unmarshal(*v, &typeVar) 3928 if err != nil { 3929 return err 3930 } 3931 sl.Type = &typeVar 3932 } 3933 } 3934 } 3935 3936 return nil 3937} 3938 3939// SensitivityLabelListResult a list of sensitivity labels. 3940type SensitivityLabelListResult struct { 3941 autorest.Response `json:"-"` 3942 // Value - READ-ONLY; Array of results. 3943 Value *[]SensitivityLabel `json:"value,omitempty"` 3944 // NextLink - READ-ONLY; Link to retrieve next page of results. 3945 NextLink *string `json:"nextLink,omitempty"` 3946} 3947 3948// MarshalJSON is the custom marshaler for SensitivityLabelListResult. 3949func (sllr SensitivityLabelListResult) MarshalJSON() ([]byte, error) { 3950 objectMap := make(map[string]interface{}) 3951 return json.Marshal(objectMap) 3952} 3953 3954// SensitivityLabelListResultIterator provides access to a complete listing of SensitivityLabel values. 3955type SensitivityLabelListResultIterator struct { 3956 i int 3957 page SensitivityLabelListResultPage 3958} 3959 3960// NextWithContext advances to the next value. If there was an error making 3961// the request the iterator does not advance and the error is returned. 3962func (iter *SensitivityLabelListResultIterator) NextWithContext(ctx context.Context) (err error) { 3963 if tracing.IsEnabled() { 3964 ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultIterator.NextWithContext") 3965 defer func() { 3966 sc := -1 3967 if iter.Response().Response.Response != nil { 3968 sc = iter.Response().Response.Response.StatusCode 3969 } 3970 tracing.EndSpan(ctx, sc, err) 3971 }() 3972 } 3973 iter.i++ 3974 if iter.i < len(iter.page.Values()) { 3975 return nil 3976 } 3977 err = iter.page.NextWithContext(ctx) 3978 if err != nil { 3979 iter.i-- 3980 return err 3981 } 3982 iter.i = 0 3983 return nil 3984} 3985 3986// Next advances to the next value. If there was an error making 3987// the request the iterator does not advance and the error is returned. 3988// Deprecated: Use NextWithContext() instead. 3989func (iter *SensitivityLabelListResultIterator) Next() error { 3990 return iter.NextWithContext(context.Background()) 3991} 3992 3993// NotDone returns true if the enumeration should be started or is not yet complete. 3994func (iter SensitivityLabelListResultIterator) NotDone() bool { 3995 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3996} 3997 3998// Response returns the raw server response from the last page request. 3999func (iter SensitivityLabelListResultIterator) Response() SensitivityLabelListResult { 4000 return iter.page.Response() 4001} 4002 4003// Value returns the current value or a zero-initialized value if the 4004// iterator has advanced beyond the end of the collection. 4005func (iter SensitivityLabelListResultIterator) Value() SensitivityLabel { 4006 if !iter.page.NotDone() { 4007 return SensitivityLabel{} 4008 } 4009 return iter.page.Values()[iter.i] 4010} 4011 4012// Creates a new instance of the SensitivityLabelListResultIterator type. 4013func NewSensitivityLabelListResultIterator(page SensitivityLabelListResultPage) SensitivityLabelListResultIterator { 4014 return SensitivityLabelListResultIterator{page: page} 4015} 4016 4017// IsEmpty returns true if the ListResult contains no values. 4018func (sllr SensitivityLabelListResult) IsEmpty() bool { 4019 return sllr.Value == nil || len(*sllr.Value) == 0 4020} 4021 4022// hasNextLink returns true if the NextLink is not empty. 4023func (sllr SensitivityLabelListResult) hasNextLink() bool { 4024 return sllr.NextLink != nil && len(*sllr.NextLink) != 0 4025} 4026 4027// sensitivityLabelListResultPreparer prepares a request to retrieve the next set of results. 4028// It returns nil if no more results exist. 4029func (sllr SensitivityLabelListResult) sensitivityLabelListResultPreparer(ctx context.Context) (*http.Request, error) { 4030 if !sllr.hasNextLink() { 4031 return nil, nil 4032 } 4033 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4034 autorest.AsJSON(), 4035 autorest.AsGet(), 4036 autorest.WithBaseURL(to.String(sllr.NextLink))) 4037} 4038 4039// SensitivityLabelListResultPage contains a page of SensitivityLabel values. 4040type SensitivityLabelListResultPage struct { 4041 fn func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error) 4042 sllr SensitivityLabelListResult 4043} 4044 4045// NextWithContext advances to the next page of values. If there was an error making 4046// the request the page does not advance and the error is returned. 4047func (page *SensitivityLabelListResultPage) NextWithContext(ctx context.Context) (err error) { 4048 if tracing.IsEnabled() { 4049 ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultPage.NextWithContext") 4050 defer func() { 4051 sc := -1 4052 if page.Response().Response.Response != nil { 4053 sc = page.Response().Response.Response.StatusCode 4054 } 4055 tracing.EndSpan(ctx, sc, err) 4056 }() 4057 } 4058 for { 4059 next, err := page.fn(ctx, page.sllr) 4060 if err != nil { 4061 return err 4062 } 4063 page.sllr = next 4064 if !next.hasNextLink() || !next.IsEmpty() { 4065 break 4066 } 4067 } 4068 return nil 4069} 4070 4071// Next advances to the next page of values. If there was an error making 4072// the request the page does not advance and the error is returned. 4073// Deprecated: Use NextWithContext() instead. 4074func (page *SensitivityLabelListResultPage) Next() error { 4075 return page.NextWithContext(context.Background()) 4076} 4077 4078// NotDone returns true if the page enumeration should be started or is not yet complete. 4079func (page SensitivityLabelListResultPage) NotDone() bool { 4080 return !page.sllr.IsEmpty() 4081} 4082 4083// Response returns the raw server response from the last page request. 4084func (page SensitivityLabelListResultPage) Response() SensitivityLabelListResult { 4085 return page.sllr 4086} 4087 4088// Values returns the slice of values for the current page or nil if there are no values. 4089func (page SensitivityLabelListResultPage) Values() []SensitivityLabel { 4090 if page.sllr.IsEmpty() { 4091 return nil 4092 } 4093 return *page.sllr.Value 4094} 4095 4096// Creates a new instance of the SensitivityLabelListResultPage type. 4097func NewSensitivityLabelListResultPage(cur SensitivityLabelListResult, getNextPage func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error)) SensitivityLabelListResultPage { 4098 return SensitivityLabelListResultPage{ 4099 fn: getNextPage, 4100 sllr: cur, 4101 } 4102} 4103 4104// SensitivityLabelProperties properties of a sensitivity label. 4105type SensitivityLabelProperties struct { 4106 // LabelName - The label name. 4107 LabelName *string `json:"labelName,omitempty"` 4108 // LabelID - The label ID. 4109 LabelID *string `json:"labelId,omitempty"` 4110 // InformationType - The information type. 4111 InformationType *string `json:"informationType,omitempty"` 4112 // InformationTypeID - The information type ID. 4113 InformationTypeID *string `json:"informationTypeId,omitempty"` 4114 // IsDisabled - READ-ONLY; Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. 4115 IsDisabled *bool `json:"isDisabled,omitempty"` 4116 // Rank - Possible values include: 'None', 'Low', 'Medium', 'High', 'Critical' 4117 Rank SensitivityLabelRank `json:"rank,omitempty"` 4118} 4119 4120// MarshalJSON is the custom marshaler for SensitivityLabelProperties. 4121func (slp SensitivityLabelProperties) MarshalJSON() ([]byte, error) { 4122 objectMap := make(map[string]interface{}) 4123 if slp.LabelName != nil { 4124 objectMap["labelName"] = slp.LabelName 4125 } 4126 if slp.LabelID != nil { 4127 objectMap["labelId"] = slp.LabelID 4128 } 4129 if slp.InformationType != nil { 4130 objectMap["informationType"] = slp.InformationType 4131 } 4132 if slp.InformationTypeID != nil { 4133 objectMap["informationTypeId"] = slp.InformationTypeID 4134 } 4135 if slp.Rank != "" { 4136 objectMap["rank"] = slp.Rank 4137 } 4138 return json.Marshal(objectMap) 4139} 4140 4141// ServerAzureADAdministrator azure Active Directory administrator. 4142type ServerAzureADAdministrator struct { 4143 autorest.Response `json:"-"` 4144 // AdministratorProperties - Resource properties. 4145 *AdministratorProperties `json:"properties,omitempty"` 4146 // ID - READ-ONLY; Resource ID. 4147 ID *string `json:"id,omitempty"` 4148 // Name - READ-ONLY; Resource name. 4149 Name *string `json:"name,omitempty"` 4150 // Type - READ-ONLY; Resource type. 4151 Type *string `json:"type,omitempty"` 4152} 4153 4154// MarshalJSON is the custom marshaler for ServerAzureADAdministrator. 4155func (saaa ServerAzureADAdministrator) MarshalJSON() ([]byte, error) { 4156 objectMap := make(map[string]interface{}) 4157 if saaa.AdministratorProperties != nil { 4158 objectMap["properties"] = saaa.AdministratorProperties 4159 } 4160 return json.Marshal(objectMap) 4161} 4162 4163// UnmarshalJSON is the custom unmarshaler for ServerAzureADAdministrator struct. 4164func (saaa *ServerAzureADAdministrator) UnmarshalJSON(body []byte) error { 4165 var m map[string]*json.RawMessage 4166 err := json.Unmarshal(body, &m) 4167 if err != nil { 4168 return err 4169 } 4170 for k, v := range m { 4171 switch k { 4172 case "properties": 4173 if v != nil { 4174 var administratorProperties AdministratorProperties 4175 err = json.Unmarshal(*v, &administratorProperties) 4176 if err != nil { 4177 return err 4178 } 4179 saaa.AdministratorProperties = &administratorProperties 4180 } 4181 case "id": 4182 if v != nil { 4183 var ID string 4184 err = json.Unmarshal(*v, &ID) 4185 if err != nil { 4186 return err 4187 } 4188 saaa.ID = &ID 4189 } 4190 case "name": 4191 if v != nil { 4192 var name string 4193 err = json.Unmarshal(*v, &name) 4194 if err != nil { 4195 return err 4196 } 4197 saaa.Name = &name 4198 } 4199 case "type": 4200 if v != nil { 4201 var typeVar string 4202 err = json.Unmarshal(*v, &typeVar) 4203 if err != nil { 4204 return err 4205 } 4206 saaa.Type = &typeVar 4207 } 4208 } 4209 } 4210 4211 return nil 4212} 4213 4214// ServerAzureADAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 4215// of a long-running operation. 4216type ServerAzureADAdministratorsCreateOrUpdateFuture struct { 4217 azure.FutureAPI 4218 // Result returns the result of the asynchronous operation. 4219 // If the operation has not completed it will return an error. 4220 Result func(ServerAzureADAdministratorsClient) (ServerAzureADAdministrator, error) 4221} 4222 4223// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4224func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 4225 var azFuture azure.Future 4226 if err := json.Unmarshal(body, &azFuture); err != nil { 4227 return err 4228 } 4229 future.FutureAPI = &azFuture 4230 future.Result = future.result 4231 return nil 4232} 4233 4234// result is the default implementation for ServerAzureADAdministratorsCreateOrUpdateFuture.Result. 4235func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { 4236 var done bool 4237 done, err = future.DoneWithContext(context.Background(), client) 4238 if err != nil { 4239 err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 4240 return 4241 } 4242 if !done { 4243 saaa.Response.Response = future.Response() 4244 err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsCreateOrUpdateFuture") 4245 return 4246 } 4247 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4248 if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent { 4249 saaa, err = client.CreateOrUpdateResponder(saaa.Response.Response) 4250 if err != nil { 4251 err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", saaa.Response.Response, "Failure responding to request") 4252 } 4253 } 4254 return 4255} 4256 4257// ServerAzureADAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a 4258// long-running operation. 4259type ServerAzureADAdministratorsDeleteFuture struct { 4260 azure.FutureAPI 4261 // Result returns the result of the asynchronous operation. 4262 // If the operation has not completed it will return an error. 4263 Result func(ServerAzureADAdministratorsClient) (autorest.Response, error) 4264} 4265 4266// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4267func (future *ServerAzureADAdministratorsDeleteFuture) UnmarshalJSON(body []byte) error { 4268 var azFuture azure.Future 4269 if err := json.Unmarshal(body, &azFuture); err != nil { 4270 return err 4271 } 4272 future.FutureAPI = &azFuture 4273 future.Result = future.result 4274 return nil 4275} 4276 4277// result is the default implementation for ServerAzureADAdministratorsDeleteFuture.Result. 4278func (future *ServerAzureADAdministratorsDeleteFuture) result(client ServerAzureADAdministratorsClient) (ar autorest.Response, err error) { 4279 var done bool 4280 done, err = future.DoneWithContext(context.Background(), client) 4281 if err != nil { 4282 err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") 4283 return 4284 } 4285 if !done { 4286 ar.Response = future.Response() 4287 err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsDeleteFuture") 4288 return 4289 } 4290 ar.Response = future.Response() 4291 return 4292} 4293 4294// ServerVulnerabilityAssessment a server vulnerability assessment. 4295type ServerVulnerabilityAssessment struct { 4296 autorest.Response `json:"-"` 4297 // ServerVulnerabilityAssessmentProperties - Resource properties. 4298 *ServerVulnerabilityAssessmentProperties `json:"properties,omitempty"` 4299 // ID - READ-ONLY; Resource ID. 4300 ID *string `json:"id,omitempty"` 4301 // Name - READ-ONLY; Resource name. 4302 Name *string `json:"name,omitempty"` 4303 // Type - READ-ONLY; Resource type. 4304 Type *string `json:"type,omitempty"` 4305} 4306 4307// MarshalJSON is the custom marshaler for ServerVulnerabilityAssessment. 4308func (sva ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { 4309 objectMap := make(map[string]interface{}) 4310 if sva.ServerVulnerabilityAssessmentProperties != nil { 4311 objectMap["properties"] = sva.ServerVulnerabilityAssessmentProperties 4312 } 4313 return json.Marshal(objectMap) 4314} 4315 4316// UnmarshalJSON is the custom unmarshaler for ServerVulnerabilityAssessment struct. 4317func (sva *ServerVulnerabilityAssessment) UnmarshalJSON(body []byte) error { 4318 var m map[string]*json.RawMessage 4319 err := json.Unmarshal(body, &m) 4320 if err != nil { 4321 return err 4322 } 4323 for k, v := range m { 4324 switch k { 4325 case "properties": 4326 if v != nil { 4327 var serverVulnerabilityAssessmentProperties ServerVulnerabilityAssessmentProperties 4328 err = json.Unmarshal(*v, &serverVulnerabilityAssessmentProperties) 4329 if err != nil { 4330 return err 4331 } 4332 sva.ServerVulnerabilityAssessmentProperties = &serverVulnerabilityAssessmentProperties 4333 } 4334 case "id": 4335 if v != nil { 4336 var ID string 4337 err = json.Unmarshal(*v, &ID) 4338 if err != nil { 4339 return err 4340 } 4341 sva.ID = &ID 4342 } 4343 case "name": 4344 if v != nil { 4345 var name string 4346 err = json.Unmarshal(*v, &name) 4347 if err != nil { 4348 return err 4349 } 4350 sva.Name = &name 4351 } 4352 case "type": 4353 if v != nil { 4354 var typeVar string 4355 err = json.Unmarshal(*v, &typeVar) 4356 if err != nil { 4357 return err 4358 } 4359 sva.Type = &typeVar 4360 } 4361 } 4362 } 4363 4364 return nil 4365} 4366 4367// ServerVulnerabilityAssessmentListResult a list of the server's vulnerability assessments. 4368type ServerVulnerabilityAssessmentListResult struct { 4369 autorest.Response `json:"-"` 4370 // Value - READ-ONLY; Array of results. 4371 Value *[]ServerVulnerabilityAssessment `json:"value,omitempty"` 4372 // NextLink - READ-ONLY; Link to retrieve next page of results. 4373 NextLink *string `json:"nextLink,omitempty"` 4374} 4375 4376// MarshalJSON is the custom marshaler for ServerVulnerabilityAssessmentListResult. 4377func (svalr ServerVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { 4378 objectMap := make(map[string]interface{}) 4379 return json.Marshal(objectMap) 4380} 4381 4382// ServerVulnerabilityAssessmentListResultIterator provides access to a complete listing of 4383// ServerVulnerabilityAssessment values. 4384type ServerVulnerabilityAssessmentListResultIterator struct { 4385 i int 4386 page ServerVulnerabilityAssessmentListResultPage 4387} 4388 4389// NextWithContext advances to the next value. If there was an error making 4390// the request the iterator does not advance and the error is returned. 4391func (iter *ServerVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { 4392 if tracing.IsEnabled() { 4393 ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentListResultIterator.NextWithContext") 4394 defer func() { 4395 sc := -1 4396 if iter.Response().Response.Response != nil { 4397 sc = iter.Response().Response.Response.StatusCode 4398 } 4399 tracing.EndSpan(ctx, sc, err) 4400 }() 4401 } 4402 iter.i++ 4403 if iter.i < len(iter.page.Values()) { 4404 return nil 4405 } 4406 err = iter.page.NextWithContext(ctx) 4407 if err != nil { 4408 iter.i-- 4409 return err 4410 } 4411 iter.i = 0 4412 return nil 4413} 4414 4415// Next advances to the next value. If there was an error making 4416// the request the iterator does not advance and the error is returned. 4417// Deprecated: Use NextWithContext() instead. 4418func (iter *ServerVulnerabilityAssessmentListResultIterator) Next() error { 4419 return iter.NextWithContext(context.Background()) 4420} 4421 4422// NotDone returns true if the enumeration should be started or is not yet complete. 4423func (iter ServerVulnerabilityAssessmentListResultIterator) NotDone() bool { 4424 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4425} 4426 4427// Response returns the raw server response from the last page request. 4428func (iter ServerVulnerabilityAssessmentListResultIterator) Response() ServerVulnerabilityAssessmentListResult { 4429 return iter.page.Response() 4430} 4431 4432// Value returns the current value or a zero-initialized value if the 4433// iterator has advanced beyond the end of the collection. 4434func (iter ServerVulnerabilityAssessmentListResultIterator) Value() ServerVulnerabilityAssessment { 4435 if !iter.page.NotDone() { 4436 return ServerVulnerabilityAssessment{} 4437 } 4438 return iter.page.Values()[iter.i] 4439} 4440 4441// Creates a new instance of the ServerVulnerabilityAssessmentListResultIterator type. 4442func NewServerVulnerabilityAssessmentListResultIterator(page ServerVulnerabilityAssessmentListResultPage) ServerVulnerabilityAssessmentListResultIterator { 4443 return ServerVulnerabilityAssessmentListResultIterator{page: page} 4444} 4445 4446// IsEmpty returns true if the ListResult contains no values. 4447func (svalr ServerVulnerabilityAssessmentListResult) IsEmpty() bool { 4448 return svalr.Value == nil || len(*svalr.Value) == 0 4449} 4450 4451// hasNextLink returns true if the NextLink is not empty. 4452func (svalr ServerVulnerabilityAssessmentListResult) hasNextLink() bool { 4453 return svalr.NextLink != nil && len(*svalr.NextLink) != 0 4454} 4455 4456// serverVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. 4457// It returns nil if no more results exist. 4458func (svalr ServerVulnerabilityAssessmentListResult) serverVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { 4459 if !svalr.hasNextLink() { 4460 return nil, nil 4461 } 4462 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4463 autorest.AsJSON(), 4464 autorest.AsGet(), 4465 autorest.WithBaseURL(to.String(svalr.NextLink))) 4466} 4467 4468// ServerVulnerabilityAssessmentListResultPage contains a page of ServerVulnerabilityAssessment values. 4469type ServerVulnerabilityAssessmentListResultPage struct { 4470 fn func(context.Context, ServerVulnerabilityAssessmentListResult) (ServerVulnerabilityAssessmentListResult, error) 4471 svalr ServerVulnerabilityAssessmentListResult 4472} 4473 4474// NextWithContext advances to the next page of values. If there was an error making 4475// the request the page does not advance and the error is returned. 4476func (page *ServerVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { 4477 if tracing.IsEnabled() { 4478 ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentListResultPage.NextWithContext") 4479 defer func() { 4480 sc := -1 4481 if page.Response().Response.Response != nil { 4482 sc = page.Response().Response.Response.StatusCode 4483 } 4484 tracing.EndSpan(ctx, sc, err) 4485 }() 4486 } 4487 for { 4488 next, err := page.fn(ctx, page.svalr) 4489 if err != nil { 4490 return err 4491 } 4492 page.svalr = next 4493 if !next.hasNextLink() || !next.IsEmpty() { 4494 break 4495 } 4496 } 4497 return nil 4498} 4499 4500// Next advances to the next page of values. If there was an error making 4501// the request the page does not advance and the error is returned. 4502// Deprecated: Use NextWithContext() instead. 4503func (page *ServerVulnerabilityAssessmentListResultPage) Next() error { 4504 return page.NextWithContext(context.Background()) 4505} 4506 4507// NotDone returns true if the page enumeration should be started or is not yet complete. 4508func (page ServerVulnerabilityAssessmentListResultPage) NotDone() bool { 4509 return !page.svalr.IsEmpty() 4510} 4511 4512// Response returns the raw server response from the last page request. 4513func (page ServerVulnerabilityAssessmentListResultPage) Response() ServerVulnerabilityAssessmentListResult { 4514 return page.svalr 4515} 4516 4517// Values returns the slice of values for the current page or nil if there are no values. 4518func (page ServerVulnerabilityAssessmentListResultPage) Values() []ServerVulnerabilityAssessment { 4519 if page.svalr.IsEmpty() { 4520 return nil 4521 } 4522 return *page.svalr.Value 4523} 4524 4525// Creates a new instance of the ServerVulnerabilityAssessmentListResultPage type. 4526func NewServerVulnerabilityAssessmentListResultPage(cur ServerVulnerabilityAssessmentListResult, getNextPage func(context.Context, ServerVulnerabilityAssessmentListResult) (ServerVulnerabilityAssessmentListResult, error)) ServerVulnerabilityAssessmentListResultPage { 4527 return ServerVulnerabilityAssessmentListResultPage{ 4528 fn: getNextPage, 4529 svalr: cur, 4530 } 4531} 4532 4533// ServerVulnerabilityAssessmentProperties properties of a server Vulnerability Assessment. 4534type ServerVulnerabilityAssessmentProperties struct { 4535 // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). 4536 StorageContainerPath *string `json:"storageContainerPath,omitempty"` 4537 // StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. 4538 StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` 4539 // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. 4540 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 4541 // RecurringScans - The recurring scans settings 4542 RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` 4543} 4544 4545// Sku an ARM Resource SKU. 4546type Sku struct { 4547 // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. 4548 Name *string `json:"name,omitempty"` 4549 // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. 4550 Tier *string `json:"tier,omitempty"` 4551 // Size - Size of the particular SKU 4552 Size *string `json:"size,omitempty"` 4553 // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. 4554 Family *string `json:"family,omitempty"` 4555 // Capacity - Capacity of the particular SKU. 4556 Capacity *int32 `json:"capacity,omitempty"` 4557} 4558 4559// TrackedResource ARM tracked top level resource. 4560type TrackedResource struct { 4561 // Location - Resource location. 4562 Location *string `json:"location,omitempty"` 4563 // Tags - Resource tags. 4564 Tags map[string]*string `json:"tags"` 4565 // ID - READ-ONLY; Resource ID. 4566 ID *string `json:"id,omitempty"` 4567 // Name - READ-ONLY; Resource name. 4568 Name *string `json:"name,omitempty"` 4569 // Type - READ-ONLY; Resource type. 4570 Type *string `json:"type,omitempty"` 4571} 4572 4573// MarshalJSON is the custom marshaler for TrackedResource. 4574func (tr TrackedResource) MarshalJSON() ([]byte, error) { 4575 objectMap := make(map[string]interface{}) 4576 if tr.Location != nil { 4577 objectMap["location"] = tr.Location 4578 } 4579 if tr.Tags != nil { 4580 objectMap["tags"] = tr.Tags 4581 } 4582 return json.Marshal(objectMap) 4583} 4584 4585// UpsertManagedServerOperationParameters ... 4586type UpsertManagedServerOperationParameters struct { 4587 Family *string `json:"family,omitempty"` 4588 Tier *string `json:"tier,omitempty"` 4589 VCores *int32 `json:"vCores,omitempty"` 4590 StorageSizeInGB *int32 `json:"storageSizeInGB,omitempty"` 4591} 4592 4593// UpsertManagedServerOperationStep ... 4594type UpsertManagedServerOperationStep struct { 4595 Order *int32 `json:"order,omitempty"` 4596 Name *string `json:"name,omitempty"` 4597 // Status - Possible values include: 'StatusNotStarted', 'StatusInProgress', 'StatusSlowedDown', 'StatusCompleted', 'StatusFailed', 'StatusCanceled' 4598 Status Status `json:"status,omitempty"` 4599} 4600 4601// Usage ARM usage. 4602type Usage struct { 4603 // ID - READ-ONLY; Resource ID. 4604 ID *string `json:"id,omitempty"` 4605 // Name - READ-ONLY; Resource name. 4606 Name *Name `json:"name,omitempty"` 4607 // Type - READ-ONLY; Resource type. 4608 Type *string `json:"type,omitempty"` 4609 // Unit - READ-ONLY; Usage unit. 4610 Unit *string `json:"unit,omitempty"` 4611 // CurrentValue - READ-ONLY; Usage current value. 4612 CurrentValue *int32 `json:"currentValue,omitempty"` 4613 // Limit - READ-ONLY; Usage limit. 4614 Limit *int32 `json:"limit,omitempty"` 4615 // RequestedLimit - READ-ONLY; Usage requested limit. 4616 RequestedLimit *int32 `json:"requestedLimit,omitempty"` 4617} 4618 4619// MarshalJSON is the custom marshaler for Usage. 4620func (u Usage) MarshalJSON() ([]byte, error) { 4621 objectMap := make(map[string]interface{}) 4622 return json.Marshal(objectMap) 4623} 4624 4625// UsageListResult a list of usages. 4626type UsageListResult struct { 4627 autorest.Response `json:"-"` 4628 // Value - READ-ONLY; Array of results. 4629 Value *[]Usage `json:"value,omitempty"` 4630 // NextLink - READ-ONLY; Link to retrieve next page of results. 4631 NextLink *string `json:"nextLink,omitempty"` 4632} 4633 4634// MarshalJSON is the custom marshaler for UsageListResult. 4635func (ulr UsageListResult) MarshalJSON() ([]byte, error) { 4636 objectMap := make(map[string]interface{}) 4637 return json.Marshal(objectMap) 4638} 4639 4640// UsageListResultIterator provides access to a complete listing of Usage values. 4641type UsageListResultIterator struct { 4642 i int 4643 page UsageListResultPage 4644} 4645 4646// NextWithContext advances to the next value. If there was an error making 4647// the request the iterator does not advance and the error is returned. 4648func (iter *UsageListResultIterator) NextWithContext(ctx context.Context) (err error) { 4649 if tracing.IsEnabled() { 4650 ctx = tracing.StartSpan(ctx, fqdn+"/UsageListResultIterator.NextWithContext") 4651 defer func() { 4652 sc := -1 4653 if iter.Response().Response.Response != nil { 4654 sc = iter.Response().Response.Response.StatusCode 4655 } 4656 tracing.EndSpan(ctx, sc, err) 4657 }() 4658 } 4659 iter.i++ 4660 if iter.i < len(iter.page.Values()) { 4661 return nil 4662 } 4663 err = iter.page.NextWithContext(ctx) 4664 if err != nil { 4665 iter.i-- 4666 return err 4667 } 4668 iter.i = 0 4669 return nil 4670} 4671 4672// Next advances to the next value. If there was an error making 4673// the request the iterator does not advance and the error is returned. 4674// Deprecated: Use NextWithContext() instead. 4675func (iter *UsageListResultIterator) Next() error { 4676 return iter.NextWithContext(context.Background()) 4677} 4678 4679// NotDone returns true if the enumeration should be started or is not yet complete. 4680func (iter UsageListResultIterator) NotDone() bool { 4681 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4682} 4683 4684// Response returns the raw server response from the last page request. 4685func (iter UsageListResultIterator) Response() UsageListResult { 4686 return iter.page.Response() 4687} 4688 4689// Value returns the current value or a zero-initialized value if the 4690// iterator has advanced beyond the end of the collection. 4691func (iter UsageListResultIterator) Value() Usage { 4692 if !iter.page.NotDone() { 4693 return Usage{} 4694 } 4695 return iter.page.Values()[iter.i] 4696} 4697 4698// Creates a new instance of the UsageListResultIterator type. 4699func NewUsageListResultIterator(page UsageListResultPage) UsageListResultIterator { 4700 return UsageListResultIterator{page: page} 4701} 4702 4703// IsEmpty returns true if the ListResult contains no values. 4704func (ulr UsageListResult) IsEmpty() bool { 4705 return ulr.Value == nil || len(*ulr.Value) == 0 4706} 4707 4708// hasNextLink returns true if the NextLink is not empty. 4709func (ulr UsageListResult) hasNextLink() bool { 4710 return ulr.NextLink != nil && len(*ulr.NextLink) != 0 4711} 4712 4713// usageListResultPreparer prepares a request to retrieve the next set of results. 4714// It returns nil if no more results exist. 4715func (ulr UsageListResult) usageListResultPreparer(ctx context.Context) (*http.Request, error) { 4716 if !ulr.hasNextLink() { 4717 return nil, nil 4718 } 4719 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4720 autorest.AsJSON(), 4721 autorest.AsGet(), 4722 autorest.WithBaseURL(to.String(ulr.NextLink))) 4723} 4724 4725// UsageListResultPage contains a page of Usage values. 4726type UsageListResultPage struct { 4727 fn func(context.Context, UsageListResult) (UsageListResult, error) 4728 ulr UsageListResult 4729} 4730 4731// NextWithContext 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. 4733func (page *UsageListResultPage) NextWithContext(ctx context.Context) (err error) { 4734 if tracing.IsEnabled() { 4735 ctx = tracing.StartSpan(ctx, fqdn+"/UsageListResultPage.NextWithContext") 4736 defer func() { 4737 sc := -1 4738 if page.Response().Response.Response != nil { 4739 sc = page.Response().Response.Response.StatusCode 4740 } 4741 tracing.EndSpan(ctx, sc, err) 4742 }() 4743 } 4744 for { 4745 next, err := page.fn(ctx, page.ulr) 4746 if err != nil { 4747 return err 4748 } 4749 page.ulr = next 4750 if !next.hasNextLink() || !next.IsEmpty() { 4751 break 4752 } 4753 } 4754 return nil 4755} 4756 4757// Next advances to the next page of values. If there was an error making 4758// the request the page does not advance and the error is returned. 4759// Deprecated: Use NextWithContext() instead. 4760func (page *UsageListResultPage) Next() error { 4761 return page.NextWithContext(context.Background()) 4762} 4763 4764// NotDone returns true if the page enumeration should be started or is not yet complete. 4765func (page UsageListResultPage) NotDone() bool { 4766 return !page.ulr.IsEmpty() 4767} 4768 4769// Response returns the raw server response from the last page request. 4770func (page UsageListResultPage) Response() UsageListResult { 4771 return page.ulr 4772} 4773 4774// Values returns the slice of values for the current page or nil if there are no values. 4775func (page UsageListResultPage) Values() []Usage { 4776 if page.ulr.IsEmpty() { 4777 return nil 4778 } 4779 return *page.ulr.Value 4780} 4781 4782// Creates a new instance of the UsageListResultPage type. 4783func NewUsageListResultPage(cur UsageListResult, getNextPage func(context.Context, UsageListResult) (UsageListResult, error)) UsageListResultPage { 4784 return UsageListResultPage{ 4785 fn: getNextPage, 4786 ulr: cur, 4787 } 4788} 4789 4790// VulnerabilityAssessmentRecurringScansProperties properties of a Vulnerability Assessment recurring 4791// scans. 4792type VulnerabilityAssessmentRecurringScansProperties struct { 4793 // IsEnabled - Recurring scans state. 4794 IsEnabled *bool `json:"isEnabled,omitempty"` 4795 // EmailSubscriptionAdmins - Specifies that the schedule scan notification will be is sent to the subscription administrators. 4796 EmailSubscriptionAdmins *bool `json:"emailSubscriptionAdmins,omitempty"` 4797 // Emails - Specifies an array of e-mail addresses to which the scan notification is sent. 4798 Emails *[]string `json:"emails,omitempty"` 4799} 4800