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