1package mysqlflexibleservers 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "net/http" 18) 19 20// The package's fully qualified name. 21const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/mysql/mgmt/2020-07-01-preview/mysqlflexibleservers" 22 23// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. 24type AzureEntityResource struct { 25 // Etag - READ-ONLY; Resource Etag. 26 Etag *string `json:"etag,omitempty"` 27 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 28 ID *string `json:"id,omitempty"` 29 // Name - READ-ONLY; The name of the resource 30 Name *string `json:"name,omitempty"` 31 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 32 Type *string `json:"type,omitempty"` 33} 34 35// MarshalJSON is the custom marshaler for AzureEntityResource. 36func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { 37 objectMap := make(map[string]interface{}) 38 return json.Marshal(objectMap) 39} 40 41// CapabilitiesListResult location capability 42type CapabilitiesListResult struct { 43 autorest.Response `json:"-"` 44 // Value - READ-ONLY; A list of supported capabilities. 45 Value *[]CapabilityProperties `json:"value,omitempty"` 46 // NextLink - READ-ONLY; Link to retrieve next page of results. 47 NextLink *string `json:"nextLink,omitempty"` 48} 49 50// MarshalJSON is the custom marshaler for CapabilitiesListResult. 51func (clr CapabilitiesListResult) MarshalJSON() ([]byte, error) { 52 objectMap := make(map[string]interface{}) 53 return json.Marshal(objectMap) 54} 55 56// CapabilitiesListResultIterator provides access to a complete listing of CapabilityProperties values. 57type CapabilitiesListResultIterator struct { 58 i int 59 page CapabilitiesListResultPage 60} 61 62// NextWithContext advances to the next value. If there was an error making 63// the request the iterator does not advance and the error is returned. 64func (iter *CapabilitiesListResultIterator) NextWithContext(ctx context.Context) (err error) { 65 if tracing.IsEnabled() { 66 ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultIterator.NextWithContext") 67 defer func() { 68 sc := -1 69 if iter.Response().Response.Response != nil { 70 sc = iter.Response().Response.Response.StatusCode 71 } 72 tracing.EndSpan(ctx, sc, err) 73 }() 74 } 75 iter.i++ 76 if iter.i < len(iter.page.Values()) { 77 return nil 78 } 79 err = iter.page.NextWithContext(ctx) 80 if err != nil { 81 iter.i-- 82 return err 83 } 84 iter.i = 0 85 return nil 86} 87 88// Next advances to the next value. If there was an error making 89// the request the iterator does not advance and the error is returned. 90// Deprecated: Use NextWithContext() instead. 91func (iter *CapabilitiesListResultIterator) Next() error { 92 return iter.NextWithContext(context.Background()) 93} 94 95// NotDone returns true if the enumeration should be started or is not yet complete. 96func (iter CapabilitiesListResultIterator) NotDone() bool { 97 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 98} 99 100// Response returns the raw server response from the last page request. 101func (iter CapabilitiesListResultIterator) Response() CapabilitiesListResult { 102 return iter.page.Response() 103} 104 105// Value returns the current value or a zero-initialized value if the 106// iterator has advanced beyond the end of the collection. 107func (iter CapabilitiesListResultIterator) Value() CapabilityProperties { 108 if !iter.page.NotDone() { 109 return CapabilityProperties{} 110 } 111 return iter.page.Values()[iter.i] 112} 113 114// Creates a new instance of the CapabilitiesListResultIterator type. 115func NewCapabilitiesListResultIterator(page CapabilitiesListResultPage) CapabilitiesListResultIterator { 116 return CapabilitiesListResultIterator{page: page} 117} 118 119// IsEmpty returns true if the ListResult contains no values. 120func (clr CapabilitiesListResult) IsEmpty() bool { 121 return clr.Value == nil || len(*clr.Value) == 0 122} 123 124// hasNextLink returns true if the NextLink is not empty. 125func (clr CapabilitiesListResult) hasNextLink() bool { 126 return clr.NextLink != nil && len(*clr.NextLink) != 0 127} 128 129// capabilitiesListResultPreparer prepares a request to retrieve the next set of results. 130// It returns nil if no more results exist. 131func (clr CapabilitiesListResult) capabilitiesListResultPreparer(ctx context.Context) (*http.Request, error) { 132 if !clr.hasNextLink() { 133 return nil, nil 134 } 135 return autorest.Prepare((&http.Request{}).WithContext(ctx), 136 autorest.AsJSON(), 137 autorest.AsGet(), 138 autorest.WithBaseURL(to.String(clr.NextLink))) 139} 140 141// CapabilitiesListResultPage contains a page of CapabilityProperties values. 142type CapabilitiesListResultPage struct { 143 fn func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error) 144 clr CapabilitiesListResult 145} 146 147// NextWithContext advances to the next page of values. If there was an error making 148// the request the page does not advance and the error is returned. 149func (page *CapabilitiesListResultPage) NextWithContext(ctx context.Context) (err error) { 150 if tracing.IsEnabled() { 151 ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultPage.NextWithContext") 152 defer func() { 153 sc := -1 154 if page.Response().Response.Response != nil { 155 sc = page.Response().Response.Response.StatusCode 156 } 157 tracing.EndSpan(ctx, sc, err) 158 }() 159 } 160 for { 161 next, err := page.fn(ctx, page.clr) 162 if err != nil { 163 return err 164 } 165 page.clr = next 166 if !next.hasNextLink() || !next.IsEmpty() { 167 break 168 } 169 } 170 return nil 171} 172 173// Next advances to the next page of values. If there was an error making 174// the request the page does not advance and the error is returned. 175// Deprecated: Use NextWithContext() instead. 176func (page *CapabilitiesListResultPage) Next() error { 177 return page.NextWithContext(context.Background()) 178} 179 180// NotDone returns true if the page enumeration should be started or is not yet complete. 181func (page CapabilitiesListResultPage) NotDone() bool { 182 return !page.clr.IsEmpty() 183} 184 185// Response returns the raw server response from the last page request. 186func (page CapabilitiesListResultPage) Response() CapabilitiesListResult { 187 return page.clr 188} 189 190// Values returns the slice of values for the current page or nil if there are no values. 191func (page CapabilitiesListResultPage) Values() []CapabilityProperties { 192 if page.clr.IsEmpty() { 193 return nil 194 } 195 return *page.clr.Value 196} 197 198// Creates a new instance of the CapabilitiesListResultPage type. 199func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)) CapabilitiesListResultPage { 200 return CapabilitiesListResultPage{ 201 fn: getNextPage, 202 clr: cur, 203 } 204} 205 206// CapabilityProperties location capabilities. 207type CapabilityProperties struct { 208 // Zone - READ-ONLY; zone name 209 Zone *string `json:"zone,omitempty"` 210 // SupportedFlexibleServerEditions - READ-ONLY; A list of supported flexible server editions. 211 SupportedFlexibleServerEditions *[]ServerEditionCapability `json:"supportedFlexibleServerEditions,omitempty"` 212} 213 214// MarshalJSON is the custom marshaler for CapabilityProperties. 215func (cp CapabilityProperties) MarshalJSON() ([]byte, error) { 216 objectMap := make(map[string]interface{}) 217 return json.Marshal(objectMap) 218} 219 220// CloudError an error response from the Batch service. 221type CloudError struct { 222 // Error - The resource management error response. 223 Error *ErrorResponse `json:"error,omitempty"` 224} 225 226// Configuration represents a Configuration. 227type Configuration struct { 228 autorest.Response `json:"-"` 229 // ConfigurationProperties - The properties of a configuration. 230 *ConfigurationProperties `json:"properties,omitempty"` 231 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 232 ID *string `json:"id,omitempty"` 233 // Name - READ-ONLY; The name of the resource 234 Name *string `json:"name,omitempty"` 235 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 236 Type *string `json:"type,omitempty"` 237} 238 239// MarshalJSON is the custom marshaler for Configuration. 240func (c Configuration) MarshalJSON() ([]byte, error) { 241 objectMap := make(map[string]interface{}) 242 if c.ConfigurationProperties != nil { 243 objectMap["properties"] = c.ConfigurationProperties 244 } 245 return json.Marshal(objectMap) 246} 247 248// UnmarshalJSON is the custom unmarshaler for Configuration struct. 249func (c *Configuration) UnmarshalJSON(body []byte) error { 250 var m map[string]*json.RawMessage 251 err := json.Unmarshal(body, &m) 252 if err != nil { 253 return err 254 } 255 for k, v := range m { 256 switch k { 257 case "properties": 258 if v != nil { 259 var configurationProperties ConfigurationProperties 260 err = json.Unmarshal(*v, &configurationProperties) 261 if err != nil { 262 return err 263 } 264 c.ConfigurationProperties = &configurationProperties 265 } 266 case "id": 267 if v != nil { 268 var ID string 269 err = json.Unmarshal(*v, &ID) 270 if err != nil { 271 return err 272 } 273 c.ID = &ID 274 } 275 case "name": 276 if v != nil { 277 var name string 278 err = json.Unmarshal(*v, &name) 279 if err != nil { 280 return err 281 } 282 c.Name = &name 283 } 284 case "type": 285 if v != nil { 286 var typeVar string 287 err = json.Unmarshal(*v, &typeVar) 288 if err != nil { 289 return err 290 } 291 c.Type = &typeVar 292 } 293 } 294 } 295 296 return nil 297} 298 299// ConfigurationListResult a list of server configurations. 300type ConfigurationListResult struct { 301 autorest.Response `json:"-"` 302 // Value - The list of server configurations. 303 Value *[]Configuration `json:"value,omitempty"` 304 // NextLink - The link used to get the next page of operations. 305 NextLink *string `json:"nextLink,omitempty"` 306} 307 308// ConfigurationListResultIterator provides access to a complete listing of Configuration values. 309type ConfigurationListResultIterator struct { 310 i int 311 page ConfigurationListResultPage 312} 313 314// NextWithContext advances to the next value. If there was an error making 315// the request the iterator does not advance and the error is returned. 316func (iter *ConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { 317 if tracing.IsEnabled() { 318 ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultIterator.NextWithContext") 319 defer func() { 320 sc := -1 321 if iter.Response().Response.Response != nil { 322 sc = iter.Response().Response.Response.StatusCode 323 } 324 tracing.EndSpan(ctx, sc, err) 325 }() 326 } 327 iter.i++ 328 if iter.i < len(iter.page.Values()) { 329 return nil 330 } 331 err = iter.page.NextWithContext(ctx) 332 if err != nil { 333 iter.i-- 334 return err 335 } 336 iter.i = 0 337 return nil 338} 339 340// Next advances to the next value. If there was an error making 341// the request the iterator does not advance and the error is returned. 342// Deprecated: Use NextWithContext() instead. 343func (iter *ConfigurationListResultIterator) Next() error { 344 return iter.NextWithContext(context.Background()) 345} 346 347// NotDone returns true if the enumeration should be started or is not yet complete. 348func (iter ConfigurationListResultIterator) NotDone() bool { 349 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 350} 351 352// Response returns the raw server response from the last page request. 353func (iter ConfigurationListResultIterator) Response() ConfigurationListResult { 354 return iter.page.Response() 355} 356 357// Value returns the current value or a zero-initialized value if the 358// iterator has advanced beyond the end of the collection. 359func (iter ConfigurationListResultIterator) Value() Configuration { 360 if !iter.page.NotDone() { 361 return Configuration{} 362 } 363 return iter.page.Values()[iter.i] 364} 365 366// Creates a new instance of the ConfigurationListResultIterator type. 367func NewConfigurationListResultIterator(page ConfigurationListResultPage) ConfigurationListResultIterator { 368 return ConfigurationListResultIterator{page: page} 369} 370 371// IsEmpty returns true if the ListResult contains no values. 372func (clr ConfigurationListResult) IsEmpty() bool { 373 return clr.Value == nil || len(*clr.Value) == 0 374} 375 376// hasNextLink returns true if the NextLink is not empty. 377func (clr ConfigurationListResult) hasNextLink() bool { 378 return clr.NextLink != nil && len(*clr.NextLink) != 0 379} 380 381// configurationListResultPreparer prepares a request to retrieve the next set of results. 382// It returns nil if no more results exist. 383func (clr ConfigurationListResult) configurationListResultPreparer(ctx context.Context) (*http.Request, error) { 384 if !clr.hasNextLink() { 385 return nil, nil 386 } 387 return autorest.Prepare((&http.Request{}).WithContext(ctx), 388 autorest.AsJSON(), 389 autorest.AsGet(), 390 autorest.WithBaseURL(to.String(clr.NextLink))) 391} 392 393// ConfigurationListResultPage contains a page of Configuration values. 394type ConfigurationListResultPage struct { 395 fn func(context.Context, ConfigurationListResult) (ConfigurationListResult, error) 396 clr ConfigurationListResult 397} 398 399// NextWithContext advances to the next page of values. If there was an error making 400// the request the page does not advance and the error is returned. 401func (page *ConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { 402 if tracing.IsEnabled() { 403 ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultPage.NextWithContext") 404 defer func() { 405 sc := -1 406 if page.Response().Response.Response != nil { 407 sc = page.Response().Response.Response.StatusCode 408 } 409 tracing.EndSpan(ctx, sc, err) 410 }() 411 } 412 for { 413 next, err := page.fn(ctx, page.clr) 414 if err != nil { 415 return err 416 } 417 page.clr = next 418 if !next.hasNextLink() || !next.IsEmpty() { 419 break 420 } 421 } 422 return nil 423} 424 425// Next advances to the next page of values. If there was an error making 426// the request the page does not advance and the error is returned. 427// Deprecated: Use NextWithContext() instead. 428func (page *ConfigurationListResultPage) Next() error { 429 return page.NextWithContext(context.Background()) 430} 431 432// NotDone returns true if the page enumeration should be started or is not yet complete. 433func (page ConfigurationListResultPage) NotDone() bool { 434 return !page.clr.IsEmpty() 435} 436 437// Response returns the raw server response from the last page request. 438func (page ConfigurationListResultPage) Response() ConfigurationListResult { 439 return page.clr 440} 441 442// Values returns the slice of values for the current page or nil if there are no values. 443func (page ConfigurationListResultPage) Values() []Configuration { 444 if page.clr.IsEmpty() { 445 return nil 446 } 447 return *page.clr.Value 448} 449 450// Creates a new instance of the ConfigurationListResultPage type. 451func NewConfigurationListResultPage(cur ConfigurationListResult, getNextPage func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)) ConfigurationListResultPage { 452 return ConfigurationListResultPage{ 453 fn: getNextPage, 454 clr: cur, 455 } 456} 457 458// ConfigurationProperties the properties of a configuration. 459type ConfigurationProperties struct { 460 // Value - Value of the configuration. 461 Value *string `json:"value,omitempty"` 462 // Description - READ-ONLY; Description of the configuration. 463 Description *string `json:"description,omitempty"` 464 // DefaultValue - READ-ONLY; Default value of the configuration. 465 DefaultValue *string `json:"defaultValue,omitempty"` 466 // DataType - READ-ONLY; Data type of the configuration. 467 DataType *string `json:"dataType,omitempty"` 468 // AllowedValues - READ-ONLY; Allowed values of the configuration. 469 AllowedValues *string `json:"allowedValues,omitempty"` 470 // Source - Source of the configuration. 471 Source *string `json:"source,omitempty"` 472 // IsReadOnly - READ-ONLY; If is the configuration read only. Possible values include: 'IsReadOnlyTrue', 'IsReadOnlyFalse' 473 IsReadOnly IsReadOnly `json:"isReadOnly,omitempty"` 474 // IsConfigPendingRestart - READ-ONLY; If is the configuration pending restart or not. Possible values include: 'True', 'False' 475 IsConfigPendingRestart IsConfigPendingRestart `json:"isConfigPendingRestart,omitempty"` 476 // IsDynamicConfig - READ-ONLY; If is the configuration dynamic. Possible values include: 'IsDynamicConfigTrue', 'IsDynamicConfigFalse' 477 IsDynamicConfig IsDynamicConfig `json:"isDynamicConfig,omitempty"` 478} 479 480// MarshalJSON is the custom marshaler for ConfigurationProperties. 481func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) { 482 objectMap := make(map[string]interface{}) 483 if cp.Value != nil { 484 objectMap["value"] = cp.Value 485 } 486 if cp.Source != nil { 487 objectMap["source"] = cp.Source 488 } 489 return json.Marshal(objectMap) 490} 491 492// ConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 493// operation. 494type ConfigurationsUpdateFuture struct { 495 azure.FutureAPI 496 // Result returns the result of the asynchronous operation. 497 // If the operation has not completed it will return an error. 498 Result func(ConfigurationsClient) (Configuration, error) 499} 500 501// UnmarshalJSON is the custom unmarshaller for CreateFuture. 502func (future *ConfigurationsUpdateFuture) UnmarshalJSON(body []byte) error { 503 var azFuture azure.Future 504 if err := json.Unmarshal(body, &azFuture); err != nil { 505 return err 506 } 507 future.FutureAPI = &azFuture 508 future.Result = future.result 509 return nil 510} 511 512// result is the default implementation for ConfigurationsUpdateFuture.Result. 513func (future *ConfigurationsUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) { 514 var done bool 515 done, err = future.DoneWithContext(context.Background(), client) 516 if err != nil { 517 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure") 518 return 519 } 520 if !done { 521 c.Response.Response = future.Response() 522 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ConfigurationsUpdateFuture") 523 return 524 } 525 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 526 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 527 c, err = client.UpdateResponder(c.Response.Response) 528 if err != nil { 529 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ConfigurationsUpdateFuture", "Result", c.Response.Response, "Failure responding to request") 530 } 531 } 532 return 533} 534 535// Database represents a Database. 536type Database struct { 537 autorest.Response `json:"-"` 538 // DatabaseProperties - The properties of a database. 539 *DatabaseProperties `json:"properties,omitempty"` 540 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 541 ID *string `json:"id,omitempty"` 542 // Name - READ-ONLY; The name of the resource 543 Name *string `json:"name,omitempty"` 544 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 545 Type *string `json:"type,omitempty"` 546} 547 548// MarshalJSON is the custom marshaler for Database. 549func (d Database) MarshalJSON() ([]byte, error) { 550 objectMap := make(map[string]interface{}) 551 if d.DatabaseProperties != nil { 552 objectMap["properties"] = d.DatabaseProperties 553 } 554 return json.Marshal(objectMap) 555} 556 557// UnmarshalJSON is the custom unmarshaler for Database struct. 558func (d *Database) UnmarshalJSON(body []byte) error { 559 var m map[string]*json.RawMessage 560 err := json.Unmarshal(body, &m) 561 if err != nil { 562 return err 563 } 564 for k, v := range m { 565 switch k { 566 case "properties": 567 if v != nil { 568 var databaseProperties DatabaseProperties 569 err = json.Unmarshal(*v, &databaseProperties) 570 if err != nil { 571 return err 572 } 573 d.DatabaseProperties = &databaseProperties 574 } 575 case "id": 576 if v != nil { 577 var ID string 578 err = json.Unmarshal(*v, &ID) 579 if err != nil { 580 return err 581 } 582 d.ID = &ID 583 } 584 case "name": 585 if v != nil { 586 var name string 587 err = json.Unmarshal(*v, &name) 588 if err != nil { 589 return err 590 } 591 d.Name = &name 592 } 593 case "type": 594 if v != nil { 595 var typeVar string 596 err = json.Unmarshal(*v, &typeVar) 597 if err != nil { 598 return err 599 } 600 d.Type = &typeVar 601 } 602 } 603 } 604 605 return nil 606} 607 608// DatabaseListResult a List of databases. 609type DatabaseListResult struct { 610 autorest.Response `json:"-"` 611 // Value - The list of databases housed in a server 612 Value *[]Database `json:"value,omitempty"` 613 // NextLink - The link used to get the next page of operations. 614 NextLink *string `json:"nextLink,omitempty"` 615} 616 617// DatabaseListResultIterator provides access to a complete listing of Database values. 618type DatabaseListResultIterator struct { 619 i int 620 page DatabaseListResultPage 621} 622 623// NextWithContext advances to the next value. If there was an error making 624// the request the iterator does not advance and the error is returned. 625func (iter *DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { 626 if tracing.IsEnabled() { 627 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultIterator.NextWithContext") 628 defer func() { 629 sc := -1 630 if iter.Response().Response.Response != nil { 631 sc = iter.Response().Response.Response.StatusCode 632 } 633 tracing.EndSpan(ctx, sc, err) 634 }() 635 } 636 iter.i++ 637 if iter.i < len(iter.page.Values()) { 638 return nil 639 } 640 err = iter.page.NextWithContext(ctx) 641 if err != nil { 642 iter.i-- 643 return err 644 } 645 iter.i = 0 646 return nil 647} 648 649// Next advances to the next value. If there was an error making 650// the request the iterator does not advance and the error is returned. 651// Deprecated: Use NextWithContext() instead. 652func (iter *DatabaseListResultIterator) Next() error { 653 return iter.NextWithContext(context.Background()) 654} 655 656// NotDone returns true if the enumeration should be started or is not yet complete. 657func (iter DatabaseListResultIterator) NotDone() bool { 658 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 659} 660 661// Response returns the raw server response from the last page request. 662func (iter DatabaseListResultIterator) Response() DatabaseListResult { 663 return iter.page.Response() 664} 665 666// Value returns the current value or a zero-initialized value if the 667// iterator has advanced beyond the end of the collection. 668func (iter DatabaseListResultIterator) Value() Database { 669 if !iter.page.NotDone() { 670 return Database{} 671 } 672 return iter.page.Values()[iter.i] 673} 674 675// Creates a new instance of the DatabaseListResultIterator type. 676func NewDatabaseListResultIterator(page DatabaseListResultPage) DatabaseListResultIterator { 677 return DatabaseListResultIterator{page: page} 678} 679 680// IsEmpty returns true if the ListResult contains no values. 681func (dlr DatabaseListResult) IsEmpty() bool { 682 return dlr.Value == nil || len(*dlr.Value) == 0 683} 684 685// hasNextLink returns true if the NextLink is not empty. 686func (dlr DatabaseListResult) hasNextLink() bool { 687 return dlr.NextLink != nil && len(*dlr.NextLink) != 0 688} 689 690// databaseListResultPreparer prepares a request to retrieve the next set of results. 691// It returns nil if no more results exist. 692func (dlr DatabaseListResult) databaseListResultPreparer(ctx context.Context) (*http.Request, error) { 693 if !dlr.hasNextLink() { 694 return nil, nil 695 } 696 return autorest.Prepare((&http.Request{}).WithContext(ctx), 697 autorest.AsJSON(), 698 autorest.AsGet(), 699 autorest.WithBaseURL(to.String(dlr.NextLink))) 700} 701 702// DatabaseListResultPage contains a page of Database values. 703type DatabaseListResultPage struct { 704 fn func(context.Context, DatabaseListResult) (DatabaseListResult, error) 705 dlr DatabaseListResult 706} 707 708// NextWithContext advances to the next page of values. If there was an error making 709// the request the page does not advance and the error is returned. 710func (page *DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { 711 if tracing.IsEnabled() { 712 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultPage.NextWithContext") 713 defer func() { 714 sc := -1 715 if page.Response().Response.Response != nil { 716 sc = page.Response().Response.Response.StatusCode 717 } 718 tracing.EndSpan(ctx, sc, err) 719 }() 720 } 721 for { 722 next, err := page.fn(ctx, page.dlr) 723 if err != nil { 724 return err 725 } 726 page.dlr = next 727 if !next.hasNextLink() || !next.IsEmpty() { 728 break 729 } 730 } 731 return nil 732} 733 734// Next advances to the next page of values. If there was an error making 735// the request the page does not advance and the error is returned. 736// Deprecated: Use NextWithContext() instead. 737func (page *DatabaseListResultPage) Next() error { 738 return page.NextWithContext(context.Background()) 739} 740 741// NotDone returns true if the page enumeration should be started or is not yet complete. 742func (page DatabaseListResultPage) NotDone() bool { 743 return !page.dlr.IsEmpty() 744} 745 746// Response returns the raw server response from the last page request. 747func (page DatabaseListResultPage) Response() DatabaseListResult { 748 return page.dlr 749} 750 751// Values returns the slice of values for the current page or nil if there are no values. 752func (page DatabaseListResultPage) Values() []Database { 753 if page.dlr.IsEmpty() { 754 return nil 755 } 756 return *page.dlr.Value 757} 758 759// Creates a new instance of the DatabaseListResultPage type. 760func NewDatabaseListResultPage(cur DatabaseListResult, getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage { 761 return DatabaseListResultPage{ 762 fn: getNextPage, 763 dlr: cur, 764 } 765} 766 767// DatabaseProperties the properties of a database. 768type DatabaseProperties struct { 769 // Charset - The charset of the database. 770 Charset *string `json:"charset,omitempty"` 771 // Collation - The collation of the database. 772 Collation *string `json:"collation,omitempty"` 773} 774 775// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 776// operation. 777type DatabasesCreateOrUpdateFuture struct { 778 azure.FutureAPI 779 // Result returns the result of the asynchronous operation. 780 // If the operation has not completed it will return an error. 781 Result func(DatabasesClient) (Database, error) 782} 783 784// UnmarshalJSON is the custom unmarshaller for CreateFuture. 785func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 786 var azFuture azure.Future 787 if err := json.Unmarshal(body, &azFuture); err != nil { 788 return err 789 } 790 future.FutureAPI = &azFuture 791 future.Result = future.result 792 return nil 793} 794 795// result is the default implementation for DatabasesCreateOrUpdateFuture.Result. 796func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) { 797 var done bool 798 done, err = future.DoneWithContext(context.Background(), client) 799 if err != nil { 800 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 801 return 802 } 803 if !done { 804 d.Response.Response = future.Response() 805 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.DatabasesCreateOrUpdateFuture") 806 return 807 } 808 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 809 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { 810 d, err = client.CreateOrUpdateResponder(d.Response.Response) 811 if err != nil { 812 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") 813 } 814 } 815 return 816} 817 818// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 819// operation. 820type DatabasesDeleteFuture struct { 821 azure.FutureAPI 822 // Result returns the result of the asynchronous operation. 823 // If the operation has not completed it will return an error. 824 Result func(DatabasesClient) (autorest.Response, error) 825} 826 827// UnmarshalJSON is the custom unmarshaller for CreateFuture. 828func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { 829 var azFuture azure.Future 830 if err := json.Unmarshal(body, &azFuture); err != nil { 831 return err 832 } 833 future.FutureAPI = &azFuture 834 future.Result = future.result 835 return nil 836} 837 838// result is the default implementation for DatabasesDeleteFuture.Result. 839func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { 840 var done bool 841 done, err = future.DoneWithContext(context.Background(), client) 842 if err != nil { 843 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") 844 return 845 } 846 if !done { 847 ar.Response = future.Response() 848 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.DatabasesDeleteFuture") 849 return 850 } 851 ar.Response = future.Response() 852 return 853} 854 855// DelegatedSubnetArguments delegated subnet arguments of a server 856type DelegatedSubnetArguments struct { 857 // SubnetArmResourceID - delegated subnet arm resource id. 858 SubnetArmResourceID *string `json:"subnetArmResourceId,omitempty"` 859} 860 861// DelegatedSubnetUsage delegated subnet usage data. 862type DelegatedSubnetUsage struct { 863 // SubnetName - READ-ONLY; name of the subnet 864 SubnetName *string `json:"subnetName,omitempty"` 865 // Usage - READ-ONLY; Number of used delegated subnets 866 Usage *int64 `json:"usage,omitempty"` 867} 868 869// MarshalJSON is the custom marshaler for DelegatedSubnetUsage. 870func (dsu DelegatedSubnetUsage) MarshalJSON() ([]byte, error) { 871 objectMap := make(map[string]interface{}) 872 return json.Marshal(objectMap) 873} 874 875// ErrorAdditionalInfo the resource management error additional info. 876type ErrorAdditionalInfo struct { 877 // Type - READ-ONLY; The additional info type. 878 Type *string `json:"type,omitempty"` 879 // Info - READ-ONLY; The additional info. 880 Info interface{} `json:"info,omitempty"` 881} 882 883// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. 884func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { 885 objectMap := make(map[string]interface{}) 886 return json.Marshal(objectMap) 887} 888 889// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for 890// failed operations. (This also follows the OData error response format.) 891type ErrorResponse struct { 892 // Code - READ-ONLY; The error code. 893 Code *string `json:"code,omitempty"` 894 // Message - READ-ONLY; The error message. 895 Message *string `json:"message,omitempty"` 896 // Target - READ-ONLY; The error target. 897 Target *string `json:"target,omitempty"` 898 // Details - READ-ONLY; The error details. 899 Details *[]ErrorResponse `json:"details,omitempty"` 900 // AdditionalInfo - READ-ONLY; The error additional info. 901 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 902} 903 904// MarshalJSON is the custom marshaler for ErrorResponse. 905func (er ErrorResponse) MarshalJSON() ([]byte, error) { 906 objectMap := make(map[string]interface{}) 907 return json.Marshal(objectMap) 908} 909 910// FirewallRule represents a server firewall rule. 911type FirewallRule struct { 912 autorest.Response `json:"-"` 913 // FirewallRuleProperties - The properties of a firewall rule. 914 *FirewallRuleProperties `json:"properties,omitempty"` 915 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 916 ID *string `json:"id,omitempty"` 917 // Name - READ-ONLY; The name of the resource 918 Name *string `json:"name,omitempty"` 919 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 920 Type *string `json:"type,omitempty"` 921} 922 923// MarshalJSON is the custom marshaler for FirewallRule. 924func (fr FirewallRule) MarshalJSON() ([]byte, error) { 925 objectMap := make(map[string]interface{}) 926 if fr.FirewallRuleProperties != nil { 927 objectMap["properties"] = fr.FirewallRuleProperties 928 } 929 return json.Marshal(objectMap) 930} 931 932// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. 933func (fr *FirewallRule) UnmarshalJSON(body []byte) error { 934 var m map[string]*json.RawMessage 935 err := json.Unmarshal(body, &m) 936 if err != nil { 937 return err 938 } 939 for k, v := range m { 940 switch k { 941 case "properties": 942 if v != nil { 943 var firewallRuleProperties FirewallRuleProperties 944 err = json.Unmarshal(*v, &firewallRuleProperties) 945 if err != nil { 946 return err 947 } 948 fr.FirewallRuleProperties = &firewallRuleProperties 949 } 950 case "id": 951 if v != nil { 952 var ID string 953 err = json.Unmarshal(*v, &ID) 954 if err != nil { 955 return err 956 } 957 fr.ID = &ID 958 } 959 case "name": 960 if v != nil { 961 var name string 962 err = json.Unmarshal(*v, &name) 963 if err != nil { 964 return err 965 } 966 fr.Name = &name 967 } 968 case "type": 969 if v != nil { 970 var typeVar string 971 err = json.Unmarshal(*v, &typeVar) 972 if err != nil { 973 return err 974 } 975 fr.Type = &typeVar 976 } 977 } 978 } 979 980 return nil 981} 982 983// FirewallRuleListResult a list of firewall rules. 984type FirewallRuleListResult struct { 985 autorest.Response `json:"-"` 986 // Value - The list of firewall rules in a server. 987 Value *[]FirewallRule `json:"value,omitempty"` 988 // NextLink - The link used to get the next page of operations. 989 NextLink *string `json:"nextLink,omitempty"` 990} 991 992// FirewallRuleListResultIterator provides access to a complete listing of FirewallRule values. 993type FirewallRuleListResultIterator struct { 994 i int 995 page FirewallRuleListResultPage 996} 997 998// NextWithContext advances to the next value. If there was an error making 999// the request the iterator does not advance and the error is returned. 1000func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { 1001 if tracing.IsEnabled() { 1002 ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext") 1003 defer func() { 1004 sc := -1 1005 if iter.Response().Response.Response != nil { 1006 sc = iter.Response().Response.Response.StatusCode 1007 } 1008 tracing.EndSpan(ctx, sc, err) 1009 }() 1010 } 1011 iter.i++ 1012 if iter.i < len(iter.page.Values()) { 1013 return nil 1014 } 1015 err = iter.page.NextWithContext(ctx) 1016 if err != nil { 1017 iter.i-- 1018 return err 1019 } 1020 iter.i = 0 1021 return nil 1022} 1023 1024// Next advances to the next value. If there was an error making 1025// the request the iterator does not advance and the error is returned. 1026// Deprecated: Use NextWithContext() instead. 1027func (iter *FirewallRuleListResultIterator) Next() error { 1028 return iter.NextWithContext(context.Background()) 1029} 1030 1031// NotDone returns true if the enumeration should be started or is not yet complete. 1032func (iter FirewallRuleListResultIterator) NotDone() bool { 1033 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1034} 1035 1036// Response returns the raw server response from the last page request. 1037func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult { 1038 return iter.page.Response() 1039} 1040 1041// Value returns the current value or a zero-initialized value if the 1042// iterator has advanced beyond the end of the collection. 1043func (iter FirewallRuleListResultIterator) Value() FirewallRule { 1044 if !iter.page.NotDone() { 1045 return FirewallRule{} 1046 } 1047 return iter.page.Values()[iter.i] 1048} 1049 1050// Creates a new instance of the FirewallRuleListResultIterator type. 1051func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator { 1052 return FirewallRuleListResultIterator{page: page} 1053} 1054 1055// IsEmpty returns true if the ListResult contains no values. 1056func (frlr FirewallRuleListResult) IsEmpty() bool { 1057 return frlr.Value == nil || len(*frlr.Value) == 0 1058} 1059 1060// hasNextLink returns true if the NextLink is not empty. 1061func (frlr FirewallRuleListResult) hasNextLink() bool { 1062 return frlr.NextLink != nil && len(*frlr.NextLink) != 0 1063} 1064 1065// firewallRuleListResultPreparer prepares a request to retrieve the next set of results. 1066// It returns nil if no more results exist. 1067func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) { 1068 if !frlr.hasNextLink() { 1069 return nil, nil 1070 } 1071 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1072 autorest.AsJSON(), 1073 autorest.AsGet(), 1074 autorest.WithBaseURL(to.String(frlr.NextLink))) 1075} 1076 1077// FirewallRuleListResultPage contains a page of FirewallRule values. 1078type FirewallRuleListResultPage struct { 1079 fn func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error) 1080 frlr FirewallRuleListResult 1081} 1082 1083// NextWithContext advances to the next page of values. If there was an error making 1084// the request the page does not advance and the error is returned. 1085func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) { 1086 if tracing.IsEnabled() { 1087 ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext") 1088 defer func() { 1089 sc := -1 1090 if page.Response().Response.Response != nil { 1091 sc = page.Response().Response.Response.StatusCode 1092 } 1093 tracing.EndSpan(ctx, sc, err) 1094 }() 1095 } 1096 for { 1097 next, err := page.fn(ctx, page.frlr) 1098 if err != nil { 1099 return err 1100 } 1101 page.frlr = next 1102 if !next.hasNextLink() || !next.IsEmpty() { 1103 break 1104 } 1105 } 1106 return nil 1107} 1108 1109// Next advances to the next page of values. If there was an error making 1110// the request the page does not advance and the error is returned. 1111// Deprecated: Use NextWithContext() instead. 1112func (page *FirewallRuleListResultPage) Next() error { 1113 return page.NextWithContext(context.Background()) 1114} 1115 1116// NotDone returns true if the page enumeration should be started or is not yet complete. 1117func (page FirewallRuleListResultPage) NotDone() bool { 1118 return !page.frlr.IsEmpty() 1119} 1120 1121// Response returns the raw server response from the last page request. 1122func (page FirewallRuleListResultPage) Response() FirewallRuleListResult { 1123 return page.frlr 1124} 1125 1126// Values returns the slice of values for the current page or nil if there are no values. 1127func (page FirewallRuleListResultPage) Values() []FirewallRule { 1128 if page.frlr.IsEmpty() { 1129 return nil 1130 } 1131 return *page.frlr.Value 1132} 1133 1134// Creates a new instance of the FirewallRuleListResultPage type. 1135func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage { 1136 return FirewallRuleListResultPage{ 1137 fn: getNextPage, 1138 frlr: cur, 1139 } 1140} 1141 1142// FirewallRuleProperties the properties of a server firewall rule. 1143type FirewallRuleProperties struct { 1144 // StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format. 1145 StartIPAddress *string `json:"startIpAddress,omitempty"` 1146 // EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format. 1147 EndIPAddress *string `json:"endIpAddress,omitempty"` 1148} 1149 1150// FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1151// long-running operation. 1152type FirewallRulesCreateOrUpdateFuture struct { 1153 azure.FutureAPI 1154 // Result returns the result of the asynchronous operation. 1155 // If the operation has not completed it will return an error. 1156 Result func(FirewallRulesClient) (FirewallRule, error) 1157} 1158 1159// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1160func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1161 var azFuture azure.Future 1162 if err := json.Unmarshal(body, &azFuture); err != nil { 1163 return err 1164 } 1165 future.FutureAPI = &azFuture 1166 future.Result = future.result 1167 return nil 1168} 1169 1170// result is the default implementation for FirewallRulesCreateOrUpdateFuture.Result. 1171func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) { 1172 var done bool 1173 done, err = future.DoneWithContext(context.Background(), client) 1174 if err != nil { 1175 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1176 return 1177 } 1178 if !done { 1179 fr.Response.Response = future.Response() 1180 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.FirewallRulesCreateOrUpdateFuture") 1181 return 1182 } 1183 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1184 if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent { 1185 fr, err = client.CreateOrUpdateResponder(fr.Response.Response) 1186 if err != nil { 1187 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request") 1188 } 1189 } 1190 return 1191} 1192 1193// FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1194// operation. 1195type FirewallRulesDeleteFuture struct { 1196 azure.FutureAPI 1197 // Result returns the result of the asynchronous operation. 1198 // If the operation has not completed it will return an error. 1199 Result func(FirewallRulesClient) (autorest.Response, error) 1200} 1201 1202// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1203func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error { 1204 var azFuture azure.Future 1205 if err := json.Unmarshal(body, &azFuture); err != nil { 1206 return err 1207 } 1208 future.FutureAPI = &azFuture 1209 future.Result = future.result 1210 return nil 1211} 1212 1213// result is the default implementation for FirewallRulesDeleteFuture.Result. 1214func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) { 1215 var done bool 1216 done, err = future.DoneWithContext(context.Background(), client) 1217 if err != nil { 1218 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure") 1219 return 1220 } 1221 if !done { 1222 ar.Response = future.Response() 1223 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.FirewallRulesDeleteFuture") 1224 return 1225 } 1226 ar.Response = future.Response() 1227 return 1228} 1229 1230// Identity identity for the resource. 1231type Identity struct { 1232 // PrincipalID - READ-ONLY; The principal ID of resource identity. 1233 PrincipalID *string `json:"principalId,omitempty"` 1234 // TenantID - READ-ONLY; The tenant ID of resource. 1235 TenantID *string `json:"tenantId,omitempty"` 1236 // Type - The identity type. Possible values include: 'SystemAssigned' 1237 Type ResourceIdentityType `json:"type,omitempty"` 1238} 1239 1240// MarshalJSON is the custom marshaler for Identity. 1241func (i Identity) MarshalJSON() ([]byte, error) { 1242 objectMap := make(map[string]interface{}) 1243 if i.Type != "" { 1244 objectMap["type"] = i.Type 1245 } 1246 return json.Marshal(objectMap) 1247} 1248 1249// MaintenanceWindow maintenance window of a server. 1250type MaintenanceWindow struct { 1251 // CustomWindow - indicates whether custom window is enabled or disabled 1252 CustomWindow *string `json:"customWindow,omitempty"` 1253 // StartHour - start hour for maintenance window 1254 StartHour *int32 `json:"startHour,omitempty"` 1255 // StartMinute - start minute for maintenance window 1256 StartMinute *int32 `json:"startMinute,omitempty"` 1257 // DayOfWeek - day of week for maintenance window 1258 DayOfWeek *int32 `json:"dayOfWeek,omitempty"` 1259} 1260 1261// NameAvailability represents a resource name availability. 1262type NameAvailability struct { 1263 autorest.Response `json:"-"` 1264 // Message - Error Message. 1265 Message *string `json:"message,omitempty"` 1266 // NameAvailable - Indicates whether the resource name is available. 1267 NameAvailable *bool `json:"nameAvailable,omitempty"` 1268 // Reason - Reason for name being unavailable. 1269 Reason *string `json:"reason,omitempty"` 1270} 1271 1272// NameAvailabilityRequest request from client to check resource name availability. 1273type NameAvailabilityRequest struct { 1274 // Name - Resource name to verify. 1275 Name *string `json:"name,omitempty"` 1276 // Type - Resource type used for verification. 1277 Type *string `json:"type,omitempty"` 1278} 1279 1280// Operation REST API operation definition. 1281type Operation struct { 1282 // Name - READ-ONLY; The name of the operation being performed on this particular object. 1283 Name *string `json:"name,omitempty"` 1284 // Display - READ-ONLY; The localized display information for this particular operation or action. 1285 Display *OperationDisplay `json:"display,omitempty"` 1286 // IsDataAction - Indicates whether the operation is a data action 1287 IsDataAction *bool `json:"isDataAction,omitempty"` 1288 // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'NotSpecified', 'User', 'System' 1289 Origin OperationOrigin `json:"origin,omitempty"` 1290 // Properties - READ-ONLY; Additional descriptions for the operation. 1291 Properties map[string]interface{} `json:"properties"` 1292} 1293 1294// MarshalJSON is the custom marshaler for Operation. 1295func (o Operation) MarshalJSON() ([]byte, error) { 1296 objectMap := make(map[string]interface{}) 1297 if o.IsDataAction != nil { 1298 objectMap["isDataAction"] = o.IsDataAction 1299 } 1300 return json.Marshal(objectMap) 1301} 1302 1303// OperationDisplay display metadata associated with the operation. 1304type OperationDisplay struct { 1305 // Provider - READ-ONLY; Operation resource provider name. 1306 Provider *string `json:"provider,omitempty"` 1307 // Resource - READ-ONLY; Resource on which the operation is performed. 1308 Resource *string `json:"resource,omitempty"` 1309 // Operation - READ-ONLY; Localized friendly name for the operation. 1310 Operation *string `json:"operation,omitempty"` 1311 // Description - READ-ONLY; Operation description. 1312 Description *string `json:"description,omitempty"` 1313} 1314 1315// MarshalJSON is the custom marshaler for OperationDisplay. 1316func (od OperationDisplay) MarshalJSON() ([]byte, error) { 1317 objectMap := make(map[string]interface{}) 1318 return json.Marshal(objectMap) 1319} 1320 1321// OperationListResult a list of resource provider operations. 1322type OperationListResult struct { 1323 autorest.Response `json:"-"` 1324 // Value - Collection of available operation details 1325 Value *[]Operation `json:"value,omitempty"` 1326 // NextLink - URL client should use to fetch the next page (per server side paging). 1327 // It's null for now, added for future use. 1328 NextLink *string `json:"nextLink,omitempty"` 1329} 1330 1331// Plan plan for the resource. 1332type Plan struct { 1333 // Name - A user defined name of the 3rd Party Artifact that is being procured. 1334 Name *string `json:"name,omitempty"` 1335 // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic 1336 Publisher *string `json:"publisher,omitempty"` 1337 // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. 1338 Product *string `json:"product,omitempty"` 1339 // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. 1340 PromotionCode *string `json:"promotionCode,omitempty"` 1341 // Version - The version of the desired product/artifact. 1342 Version *string `json:"version,omitempty"` 1343} 1344 1345// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not 1346// have tags and a location 1347type ProxyResource struct { 1348 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1349 ID *string `json:"id,omitempty"` 1350 // Name - READ-ONLY; The name of the resource 1351 Name *string `json:"name,omitempty"` 1352 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1353 Type *string `json:"type,omitempty"` 1354} 1355 1356// MarshalJSON is the custom marshaler for ProxyResource. 1357func (pr ProxyResource) MarshalJSON() ([]byte, error) { 1358 objectMap := make(map[string]interface{}) 1359 return json.Marshal(objectMap) 1360} 1361 1362// Resource common fields that are returned in the response for all Azure Resource Manager resources 1363type Resource struct { 1364 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1365 ID *string `json:"id,omitempty"` 1366 // Name - READ-ONLY; The name of the resource 1367 Name *string `json:"name,omitempty"` 1368 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1369 Type *string `json:"type,omitempty"` 1370} 1371 1372// MarshalJSON is the custom marshaler for Resource. 1373func (r Resource) MarshalJSON() ([]byte, error) { 1374 objectMap := make(map[string]interface{}) 1375 return json.Marshal(objectMap) 1376} 1377 1378// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed 1379// properties for a resource. Except properties bag, there cannot be a top level property outside of this 1380// set. 1381type ResourceModelWithAllowedPropertySet struct { 1382 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1383 ID *string `json:"id,omitempty"` 1384 // Name - READ-ONLY; The name of the resource 1385 Name *string `json:"name,omitempty"` 1386 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1387 Type *string `json:"type,omitempty"` 1388 // Location - The geo-location where the resource lives 1389 Location *string `json:"location,omitempty"` 1390 // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. 1391 ManagedBy *string `json:"managedBy,omitempty"` 1392 // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. 1393 Kind *string `json:"kind,omitempty"` 1394 // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. 1395 Etag *string `json:"etag,omitempty"` 1396 // Tags - Resource tags. 1397 Tags map[string]*string `json:"tags"` 1398 Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` 1399 Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` 1400 Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` 1401} 1402 1403// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. 1404func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { 1405 objectMap := make(map[string]interface{}) 1406 if rmwaps.Location != nil { 1407 objectMap["location"] = rmwaps.Location 1408 } 1409 if rmwaps.ManagedBy != nil { 1410 objectMap["managedBy"] = rmwaps.ManagedBy 1411 } 1412 if rmwaps.Kind != nil { 1413 objectMap["kind"] = rmwaps.Kind 1414 } 1415 if rmwaps.Tags != nil { 1416 objectMap["tags"] = rmwaps.Tags 1417 } 1418 if rmwaps.Identity != nil { 1419 objectMap["identity"] = rmwaps.Identity 1420 } 1421 if rmwaps.Sku != nil { 1422 objectMap["sku"] = rmwaps.Sku 1423 } 1424 if rmwaps.Plan != nil { 1425 objectMap["plan"] = rmwaps.Plan 1426 } 1427 return json.Marshal(objectMap) 1428} 1429 1430// ResourceModelWithAllowedPropertySetIdentity ... 1431type ResourceModelWithAllowedPropertySetIdentity struct { 1432 // PrincipalID - READ-ONLY; The principal ID of resource identity. 1433 PrincipalID *string `json:"principalId,omitempty"` 1434 // TenantID - READ-ONLY; The tenant ID of resource. 1435 TenantID *string `json:"tenantId,omitempty"` 1436 // Type - The identity type. Possible values include: 'SystemAssigned' 1437 Type ResourceIdentityType `json:"type,omitempty"` 1438} 1439 1440// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. 1441func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { 1442 objectMap := make(map[string]interface{}) 1443 if rmwaps.Type != "" { 1444 objectMap["type"] = rmwaps.Type 1445 } 1446 return json.Marshal(objectMap) 1447} 1448 1449// ResourceModelWithAllowedPropertySetPlan ... 1450type ResourceModelWithAllowedPropertySetPlan struct { 1451 // Name - A user defined name of the 3rd Party Artifact that is being procured. 1452 Name *string `json:"name,omitempty"` 1453 // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic 1454 Publisher *string `json:"publisher,omitempty"` 1455 // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. 1456 Product *string `json:"product,omitempty"` 1457 // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. 1458 PromotionCode *string `json:"promotionCode,omitempty"` 1459 // Version - The version of the desired product/artifact. 1460 Version *string `json:"version,omitempty"` 1461} 1462 1463// ResourceModelWithAllowedPropertySetSku ... 1464type ResourceModelWithAllowedPropertySetSku struct { 1465 // Name - The name of the sku, e.g. Standard_D32s_v3. 1466 Name *string `json:"name,omitempty"` 1467 // Tier - The tier of the particular SKU, e.g. GeneralPurpose. Possible values include: 'Burstable', 'GeneralPurpose', 'MemoryOptimized' 1468 Tier SkuTier `json:"tier,omitempty"` 1469} 1470 1471// Server represents a server. 1472type Server struct { 1473 autorest.Response `json:"-"` 1474 // Identity - The Azure Active Directory identity of the server. 1475 Identity *Identity `json:"identity,omitempty"` 1476 // Sku - The SKU (pricing tier) of the server. 1477 Sku *Sku `json:"sku,omitempty"` 1478 // ServerProperties - Properties of the server. 1479 *ServerProperties `json:"properties,omitempty"` 1480 // Tags - Resource tags. 1481 Tags map[string]*string `json:"tags"` 1482 // Location - The geo-location where the resource lives 1483 Location *string `json:"location,omitempty"` 1484 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1485 ID *string `json:"id,omitempty"` 1486 // Name - READ-ONLY; The name of the resource 1487 Name *string `json:"name,omitempty"` 1488 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1489 Type *string `json:"type,omitempty"` 1490} 1491 1492// MarshalJSON is the custom marshaler for Server. 1493func (s Server) MarshalJSON() ([]byte, error) { 1494 objectMap := make(map[string]interface{}) 1495 if s.Identity != nil { 1496 objectMap["identity"] = s.Identity 1497 } 1498 if s.Sku != nil { 1499 objectMap["sku"] = s.Sku 1500 } 1501 if s.ServerProperties != nil { 1502 objectMap["properties"] = s.ServerProperties 1503 } 1504 if s.Tags != nil { 1505 objectMap["tags"] = s.Tags 1506 } 1507 if s.Location != nil { 1508 objectMap["location"] = s.Location 1509 } 1510 return json.Marshal(objectMap) 1511} 1512 1513// UnmarshalJSON is the custom unmarshaler for Server struct. 1514func (s *Server) UnmarshalJSON(body []byte) error { 1515 var m map[string]*json.RawMessage 1516 err := json.Unmarshal(body, &m) 1517 if err != nil { 1518 return err 1519 } 1520 for k, v := range m { 1521 switch k { 1522 case "identity": 1523 if v != nil { 1524 var identity Identity 1525 err = json.Unmarshal(*v, &identity) 1526 if err != nil { 1527 return err 1528 } 1529 s.Identity = &identity 1530 } 1531 case "sku": 1532 if v != nil { 1533 var sku Sku 1534 err = json.Unmarshal(*v, &sku) 1535 if err != nil { 1536 return err 1537 } 1538 s.Sku = &sku 1539 } 1540 case "properties": 1541 if v != nil { 1542 var serverProperties ServerProperties 1543 err = json.Unmarshal(*v, &serverProperties) 1544 if err != nil { 1545 return err 1546 } 1547 s.ServerProperties = &serverProperties 1548 } 1549 case "tags": 1550 if v != nil { 1551 var tags map[string]*string 1552 err = json.Unmarshal(*v, &tags) 1553 if err != nil { 1554 return err 1555 } 1556 s.Tags = tags 1557 } 1558 case "location": 1559 if v != nil { 1560 var location string 1561 err = json.Unmarshal(*v, &location) 1562 if err != nil { 1563 return err 1564 } 1565 s.Location = &location 1566 } 1567 case "id": 1568 if v != nil { 1569 var ID string 1570 err = json.Unmarshal(*v, &ID) 1571 if err != nil { 1572 return err 1573 } 1574 s.ID = &ID 1575 } 1576 case "name": 1577 if v != nil { 1578 var name string 1579 err = json.Unmarshal(*v, &name) 1580 if err != nil { 1581 return err 1582 } 1583 s.Name = &name 1584 } 1585 case "type": 1586 if v != nil { 1587 var typeVar string 1588 err = json.Unmarshal(*v, &typeVar) 1589 if err != nil { 1590 return err 1591 } 1592 s.Type = &typeVar 1593 } 1594 } 1595 } 1596 1597 return nil 1598} 1599 1600// ServerEditionCapability server edition capabilities. 1601type ServerEditionCapability struct { 1602 // Name - READ-ONLY; Server edition name 1603 Name *string `json:"name,omitempty"` 1604 // SupportedStorageEditions - READ-ONLY; A list of supported storage editions 1605 SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"` 1606 // SupportedServerVersions - READ-ONLY; A list of supported server versions. 1607 SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` 1608} 1609 1610// MarshalJSON is the custom marshaler for ServerEditionCapability. 1611func (sec ServerEditionCapability) MarshalJSON() ([]byte, error) { 1612 objectMap := make(map[string]interface{}) 1613 return json.Marshal(objectMap) 1614} 1615 1616// ServerForUpdate parameters allowed to update for a server. 1617type ServerForUpdate struct { 1618 // Sku - The SKU (pricing tier) of the server. 1619 Sku *Sku `json:"sku,omitempty"` 1620 // ServerPropertiesForUpdate - The properties that can be updated for a server. 1621 *ServerPropertiesForUpdate `json:"properties,omitempty"` 1622 // Tags - Application-specific metadata in the form of key-value pairs. 1623 Tags map[string]*string `json:"tags"` 1624} 1625 1626// MarshalJSON is the custom marshaler for ServerForUpdate. 1627func (sfu ServerForUpdate) MarshalJSON() ([]byte, error) { 1628 objectMap := make(map[string]interface{}) 1629 if sfu.Sku != nil { 1630 objectMap["sku"] = sfu.Sku 1631 } 1632 if sfu.ServerPropertiesForUpdate != nil { 1633 objectMap["properties"] = sfu.ServerPropertiesForUpdate 1634 } 1635 if sfu.Tags != nil { 1636 objectMap["tags"] = sfu.Tags 1637 } 1638 return json.Marshal(objectMap) 1639} 1640 1641// UnmarshalJSON is the custom unmarshaler for ServerForUpdate struct. 1642func (sfu *ServerForUpdate) UnmarshalJSON(body []byte) error { 1643 var m map[string]*json.RawMessage 1644 err := json.Unmarshal(body, &m) 1645 if err != nil { 1646 return err 1647 } 1648 for k, v := range m { 1649 switch k { 1650 case "sku": 1651 if v != nil { 1652 var sku Sku 1653 err = json.Unmarshal(*v, &sku) 1654 if err != nil { 1655 return err 1656 } 1657 sfu.Sku = &sku 1658 } 1659 case "properties": 1660 if v != nil { 1661 var serverPropertiesForUpdate ServerPropertiesForUpdate 1662 err = json.Unmarshal(*v, &serverPropertiesForUpdate) 1663 if err != nil { 1664 return err 1665 } 1666 sfu.ServerPropertiesForUpdate = &serverPropertiesForUpdate 1667 } 1668 case "tags": 1669 if v != nil { 1670 var tags map[string]*string 1671 err = json.Unmarshal(*v, &tags) 1672 if err != nil { 1673 return err 1674 } 1675 sfu.Tags = tags 1676 } 1677 } 1678 } 1679 1680 return nil 1681} 1682 1683// ServerKey a MySQL Server key. 1684type ServerKey struct { 1685 autorest.Response `json:"-"` 1686 // Kind - READ-ONLY; Kind of encryption protector used to protect the key. 1687 Kind *string `json:"kind,omitempty"` 1688 // ServerKeyProperties - Properties of the ServerKey Resource. 1689 *ServerKeyProperties `json:"properties,omitempty"` 1690 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1691 ID *string `json:"id,omitempty"` 1692 // Name - READ-ONLY; The name of the resource 1693 Name *string `json:"name,omitempty"` 1694 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1695 Type *string `json:"type,omitempty"` 1696} 1697 1698// MarshalJSON is the custom marshaler for ServerKey. 1699func (sk ServerKey) MarshalJSON() ([]byte, error) { 1700 objectMap := make(map[string]interface{}) 1701 if sk.ServerKeyProperties != nil { 1702 objectMap["properties"] = sk.ServerKeyProperties 1703 } 1704 return json.Marshal(objectMap) 1705} 1706 1707// UnmarshalJSON is the custom unmarshaler for ServerKey struct. 1708func (sk *ServerKey) UnmarshalJSON(body []byte) error { 1709 var m map[string]*json.RawMessage 1710 err := json.Unmarshal(body, &m) 1711 if err != nil { 1712 return err 1713 } 1714 for k, v := range m { 1715 switch k { 1716 case "kind": 1717 if v != nil { 1718 var kind string 1719 err = json.Unmarshal(*v, &kind) 1720 if err != nil { 1721 return err 1722 } 1723 sk.Kind = &kind 1724 } 1725 case "properties": 1726 if v != nil { 1727 var serverKeyProperties ServerKeyProperties 1728 err = json.Unmarshal(*v, &serverKeyProperties) 1729 if err != nil { 1730 return err 1731 } 1732 sk.ServerKeyProperties = &serverKeyProperties 1733 } 1734 case "id": 1735 if v != nil { 1736 var ID string 1737 err = json.Unmarshal(*v, &ID) 1738 if err != nil { 1739 return err 1740 } 1741 sk.ID = &ID 1742 } 1743 case "name": 1744 if v != nil { 1745 var name string 1746 err = json.Unmarshal(*v, &name) 1747 if err != nil { 1748 return err 1749 } 1750 sk.Name = &name 1751 } 1752 case "type": 1753 if v != nil { 1754 var typeVar string 1755 err = json.Unmarshal(*v, &typeVar) 1756 if err != nil { 1757 return err 1758 } 1759 sk.Type = &typeVar 1760 } 1761 } 1762 } 1763 1764 return nil 1765} 1766 1767// ServerKeyListResult a list of MySQL Server keys. 1768type ServerKeyListResult struct { 1769 autorest.Response `json:"-"` 1770 // Value - READ-ONLY; A list of MySQL Server keys. 1771 Value *[]ServerKey `json:"value,omitempty"` 1772 // NextLink - READ-ONLY; Link to retrieve next page of results. 1773 NextLink *string `json:"nextLink,omitempty"` 1774} 1775 1776// MarshalJSON is the custom marshaler for ServerKeyListResult. 1777func (sklr ServerKeyListResult) MarshalJSON() ([]byte, error) { 1778 objectMap := make(map[string]interface{}) 1779 return json.Marshal(objectMap) 1780} 1781 1782// ServerKeyListResultIterator provides access to a complete listing of ServerKey values. 1783type ServerKeyListResultIterator struct { 1784 i int 1785 page ServerKeyListResultPage 1786} 1787 1788// NextWithContext advances to the next value. If there was an error making 1789// the request the iterator does not advance and the error is returned. 1790func (iter *ServerKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { 1791 if tracing.IsEnabled() { 1792 ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultIterator.NextWithContext") 1793 defer func() { 1794 sc := -1 1795 if iter.Response().Response.Response != nil { 1796 sc = iter.Response().Response.Response.StatusCode 1797 } 1798 tracing.EndSpan(ctx, sc, err) 1799 }() 1800 } 1801 iter.i++ 1802 if iter.i < len(iter.page.Values()) { 1803 return nil 1804 } 1805 err = iter.page.NextWithContext(ctx) 1806 if err != nil { 1807 iter.i-- 1808 return err 1809 } 1810 iter.i = 0 1811 return nil 1812} 1813 1814// Next advances to the next value. If there was an error making 1815// the request the iterator does not advance and the error is returned. 1816// Deprecated: Use NextWithContext() instead. 1817func (iter *ServerKeyListResultIterator) Next() error { 1818 return iter.NextWithContext(context.Background()) 1819} 1820 1821// NotDone returns true if the enumeration should be started or is not yet complete. 1822func (iter ServerKeyListResultIterator) NotDone() bool { 1823 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1824} 1825 1826// Response returns the raw server response from the last page request. 1827func (iter ServerKeyListResultIterator) Response() ServerKeyListResult { 1828 return iter.page.Response() 1829} 1830 1831// Value returns the current value or a zero-initialized value if the 1832// iterator has advanced beyond the end of the collection. 1833func (iter ServerKeyListResultIterator) Value() ServerKey { 1834 if !iter.page.NotDone() { 1835 return ServerKey{} 1836 } 1837 return iter.page.Values()[iter.i] 1838} 1839 1840// Creates a new instance of the ServerKeyListResultIterator type. 1841func NewServerKeyListResultIterator(page ServerKeyListResultPage) ServerKeyListResultIterator { 1842 return ServerKeyListResultIterator{page: page} 1843} 1844 1845// IsEmpty returns true if the ListResult contains no values. 1846func (sklr ServerKeyListResult) IsEmpty() bool { 1847 return sklr.Value == nil || len(*sklr.Value) == 0 1848} 1849 1850// hasNextLink returns true if the NextLink is not empty. 1851func (sklr ServerKeyListResult) hasNextLink() bool { 1852 return sklr.NextLink != nil && len(*sklr.NextLink) != 0 1853} 1854 1855// serverKeyListResultPreparer prepares a request to retrieve the next set of results. 1856// It returns nil if no more results exist. 1857func (sklr ServerKeyListResult) serverKeyListResultPreparer(ctx context.Context) (*http.Request, error) { 1858 if !sklr.hasNextLink() { 1859 return nil, nil 1860 } 1861 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1862 autorest.AsJSON(), 1863 autorest.AsGet(), 1864 autorest.WithBaseURL(to.String(sklr.NextLink))) 1865} 1866 1867// ServerKeyListResultPage contains a page of ServerKey values. 1868type ServerKeyListResultPage struct { 1869 fn func(context.Context, ServerKeyListResult) (ServerKeyListResult, error) 1870 sklr ServerKeyListResult 1871} 1872 1873// NextWithContext advances to the next page of values. If there was an error making 1874// the request the page does not advance and the error is returned. 1875func (page *ServerKeyListResultPage) NextWithContext(ctx context.Context) (err error) { 1876 if tracing.IsEnabled() { 1877 ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultPage.NextWithContext") 1878 defer func() { 1879 sc := -1 1880 if page.Response().Response.Response != nil { 1881 sc = page.Response().Response.Response.StatusCode 1882 } 1883 tracing.EndSpan(ctx, sc, err) 1884 }() 1885 } 1886 for { 1887 next, err := page.fn(ctx, page.sklr) 1888 if err != nil { 1889 return err 1890 } 1891 page.sklr = next 1892 if !next.hasNextLink() || !next.IsEmpty() { 1893 break 1894 } 1895 } 1896 return nil 1897} 1898 1899// Next advances to the next page of values. If there was an error making 1900// the request the page does not advance and the error is returned. 1901// Deprecated: Use NextWithContext() instead. 1902func (page *ServerKeyListResultPage) Next() error { 1903 return page.NextWithContext(context.Background()) 1904} 1905 1906// NotDone returns true if the page enumeration should be started or is not yet complete. 1907func (page ServerKeyListResultPage) NotDone() bool { 1908 return !page.sklr.IsEmpty() 1909} 1910 1911// Response returns the raw server response from the last page request. 1912func (page ServerKeyListResultPage) Response() ServerKeyListResult { 1913 return page.sklr 1914} 1915 1916// Values returns the slice of values for the current page or nil if there are no values. 1917func (page ServerKeyListResultPage) Values() []ServerKey { 1918 if page.sklr.IsEmpty() { 1919 return nil 1920 } 1921 return *page.sklr.Value 1922} 1923 1924// Creates a new instance of the ServerKeyListResultPage type. 1925func NewServerKeyListResultPage(cur ServerKeyListResult, getNextPage func(context.Context, ServerKeyListResult) (ServerKeyListResult, error)) ServerKeyListResultPage { 1926 return ServerKeyListResultPage{ 1927 fn: getNextPage, 1928 sklr: cur, 1929 } 1930} 1931 1932// ServerKeyProperties properties for a key execution. 1933type ServerKeyProperties struct { 1934 // ServerKeyType - The key type like 'AzureKeyVault'. 1935 ServerKeyType *string `json:"serverKeyType,omitempty"` 1936 // URI - The URI of the key. 1937 URI *string `json:"uri,omitempty"` 1938 // CreationDate - READ-ONLY; The key creation date. 1939 CreationDate *date.Time `json:"creationDate,omitempty"` 1940} 1941 1942// MarshalJSON is the custom marshaler for ServerKeyProperties. 1943func (skp ServerKeyProperties) MarshalJSON() ([]byte, error) { 1944 objectMap := make(map[string]interface{}) 1945 if skp.ServerKeyType != nil { 1946 objectMap["serverKeyType"] = skp.ServerKeyType 1947 } 1948 if skp.URI != nil { 1949 objectMap["uri"] = skp.URI 1950 } 1951 return json.Marshal(objectMap) 1952} 1953 1954// ServerKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1955// long-running operation. 1956type ServerKeysCreateOrUpdateFuture struct { 1957 azure.FutureAPI 1958 // Result returns the result of the asynchronous operation. 1959 // If the operation has not completed it will return an error. 1960 Result func(ServerKeysClient) (ServerKey, error) 1961} 1962 1963// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1964func (future *ServerKeysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1965 var azFuture azure.Future 1966 if err := json.Unmarshal(body, &azFuture); err != nil { 1967 return err 1968 } 1969 future.FutureAPI = &azFuture 1970 future.Result = future.result 1971 return nil 1972} 1973 1974// result is the default implementation for ServerKeysCreateOrUpdateFuture.Result. 1975func (future *ServerKeysCreateOrUpdateFuture) result(client ServerKeysClient) (sk ServerKey, err error) { 1976 var done bool 1977 done, err = future.DoneWithContext(context.Background(), client) 1978 if err != nil { 1979 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServerKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1980 return 1981 } 1982 if !done { 1983 sk.Response.Response = future.Response() 1984 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServerKeysCreateOrUpdateFuture") 1985 return 1986 } 1987 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1988 if sk.Response.Response, err = future.GetResult(sender); err == nil && sk.Response.Response.StatusCode != http.StatusNoContent { 1989 sk, err = client.CreateOrUpdateResponder(sk.Response.Response) 1990 if err != nil { 1991 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServerKeysCreateOrUpdateFuture", "Result", sk.Response.Response, "Failure responding to request") 1992 } 1993 } 1994 return 1995} 1996 1997// ServerKeysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1998// operation. 1999type ServerKeysDeleteFuture struct { 2000 azure.FutureAPI 2001 // Result returns the result of the asynchronous operation. 2002 // If the operation has not completed it will return an error. 2003 Result func(ServerKeysClient) (autorest.Response, error) 2004} 2005 2006// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2007func (future *ServerKeysDeleteFuture) UnmarshalJSON(body []byte) error { 2008 var azFuture azure.Future 2009 if err := json.Unmarshal(body, &azFuture); err != nil { 2010 return err 2011 } 2012 future.FutureAPI = &azFuture 2013 future.Result = future.result 2014 return nil 2015} 2016 2017// result is the default implementation for ServerKeysDeleteFuture.Result. 2018func (future *ServerKeysDeleteFuture) result(client ServerKeysClient) (ar autorest.Response, err error) { 2019 var done bool 2020 done, err = future.DoneWithContext(context.Background(), client) 2021 if err != nil { 2022 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServerKeysDeleteFuture", "Result", future.Response(), "Polling failure") 2023 return 2024 } 2025 if !done { 2026 ar.Response = future.Response() 2027 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServerKeysDeleteFuture") 2028 return 2029 } 2030 ar.Response = future.Response() 2031 return 2032} 2033 2034// ServerListResult a list of servers. 2035type ServerListResult struct { 2036 autorest.Response `json:"-"` 2037 // Value - The list of servers 2038 Value *[]Server `json:"value,omitempty"` 2039 // NextLink - The link used to get the next page of operations. 2040 NextLink *string `json:"nextLink,omitempty"` 2041} 2042 2043// ServerListResultIterator provides access to a complete listing of Server values. 2044type ServerListResultIterator struct { 2045 i int 2046 page ServerListResultPage 2047} 2048 2049// NextWithContext advances to the next value. If there was an error making 2050// the request the iterator does not advance and the error is returned. 2051func (iter *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) { 2052 if tracing.IsEnabled() { 2053 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.NextWithContext") 2054 defer func() { 2055 sc := -1 2056 if iter.Response().Response.Response != nil { 2057 sc = iter.Response().Response.Response.StatusCode 2058 } 2059 tracing.EndSpan(ctx, sc, err) 2060 }() 2061 } 2062 iter.i++ 2063 if iter.i < len(iter.page.Values()) { 2064 return nil 2065 } 2066 err = iter.page.NextWithContext(ctx) 2067 if err != nil { 2068 iter.i-- 2069 return err 2070 } 2071 iter.i = 0 2072 return nil 2073} 2074 2075// Next advances to the next value. If there was an error making 2076// the request the iterator does not advance and the error is returned. 2077// Deprecated: Use NextWithContext() instead. 2078func (iter *ServerListResultIterator) Next() error { 2079 return iter.NextWithContext(context.Background()) 2080} 2081 2082// NotDone returns true if the enumeration should be started or is not yet complete. 2083func (iter ServerListResultIterator) NotDone() bool { 2084 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2085} 2086 2087// Response returns the raw server response from the last page request. 2088func (iter ServerListResultIterator) Response() ServerListResult { 2089 return iter.page.Response() 2090} 2091 2092// Value returns the current value or a zero-initialized value if the 2093// iterator has advanced beyond the end of the collection. 2094func (iter ServerListResultIterator) Value() Server { 2095 if !iter.page.NotDone() { 2096 return Server{} 2097 } 2098 return iter.page.Values()[iter.i] 2099} 2100 2101// Creates a new instance of the ServerListResultIterator type. 2102func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator { 2103 return ServerListResultIterator{page: page} 2104} 2105 2106// IsEmpty returns true if the ListResult contains no values. 2107func (slr ServerListResult) IsEmpty() bool { 2108 return slr.Value == nil || len(*slr.Value) == 0 2109} 2110 2111// hasNextLink returns true if the NextLink is not empty. 2112func (slr ServerListResult) hasNextLink() bool { 2113 return slr.NextLink != nil && len(*slr.NextLink) != 0 2114} 2115 2116// serverListResultPreparer prepares a request to retrieve the next set of results. 2117// It returns nil if no more results exist. 2118func (slr ServerListResult) serverListResultPreparer(ctx context.Context) (*http.Request, error) { 2119 if !slr.hasNextLink() { 2120 return nil, nil 2121 } 2122 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2123 autorest.AsJSON(), 2124 autorest.AsGet(), 2125 autorest.WithBaseURL(to.String(slr.NextLink))) 2126} 2127 2128// ServerListResultPage contains a page of Server values. 2129type ServerListResultPage struct { 2130 fn func(context.Context, ServerListResult) (ServerListResult, error) 2131 slr ServerListResult 2132} 2133 2134// NextWithContext advances to the next page of values. If there was an error making 2135// the request the page does not advance and the error is returned. 2136func (page *ServerListResultPage) NextWithContext(ctx context.Context) (err error) { 2137 if tracing.IsEnabled() { 2138 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.NextWithContext") 2139 defer func() { 2140 sc := -1 2141 if page.Response().Response.Response != nil { 2142 sc = page.Response().Response.Response.StatusCode 2143 } 2144 tracing.EndSpan(ctx, sc, err) 2145 }() 2146 } 2147 for { 2148 next, err := page.fn(ctx, page.slr) 2149 if err != nil { 2150 return err 2151 } 2152 page.slr = next 2153 if !next.hasNextLink() || !next.IsEmpty() { 2154 break 2155 } 2156 } 2157 return nil 2158} 2159 2160// Next advances to the next page of values. If there was an error making 2161// the request the page does not advance and the error is returned. 2162// Deprecated: Use NextWithContext() instead. 2163func (page *ServerListResultPage) Next() error { 2164 return page.NextWithContext(context.Background()) 2165} 2166 2167// NotDone returns true if the page enumeration should be started or is not yet complete. 2168func (page ServerListResultPage) NotDone() bool { 2169 return !page.slr.IsEmpty() 2170} 2171 2172// Response returns the raw server response from the last page request. 2173func (page ServerListResultPage) Response() ServerListResult { 2174 return page.slr 2175} 2176 2177// Values returns the slice of values for the current page or nil if there are no values. 2178func (page ServerListResultPage) Values() []Server { 2179 if page.slr.IsEmpty() { 2180 return nil 2181 } 2182 return *page.slr.Value 2183} 2184 2185// Creates a new instance of the ServerListResultPage type. 2186func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage { 2187 return ServerListResultPage{ 2188 fn: getNextPage, 2189 slr: cur, 2190 } 2191} 2192 2193// ServerProperties the properties of a server. 2194type ServerProperties struct { 2195 // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). 2196 AdministratorLogin *string `json:"administratorLogin,omitempty"` 2197 // AdministratorLoginPassword - The password of the administrator login (required for server creation). 2198 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` 2199 // Version - Server version. Possible values include: 'FiveFullStopSeven' 2200 Version ServerVersion `json:"version,omitempty"` 2201 // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' 2202 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` 2203 // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnumEnabled', 'InfrastructureEncryptionEnumDisabled' 2204 InfrastructureEncryption InfrastructureEncryptionEnum `json:"infrastructureEncryption,omitempty"` 2205 // State - READ-ONLY; The state of a server. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled', 'ServerStateStarting', 'ServerStateStopping', 'ServerStateStopped', 'ServerStateUpdating' 2206 State ServerState `json:"state,omitempty"` 2207 // HaState - READ-ONLY; The state of a HA server. Possible values include: 'NotEnabled', 'CreatingStandby', 'ReplicatingData', 'FailingOver', 'Healthy', 'RemovingStandby' 2208 HaState ServerHAState `json:"haState,omitempty"` 2209 // HaEnabled - Enable HA or not for a server. Possible values include: 'Enabled', 'Disabled' 2210 HaEnabled HaEnabledEnum `json:"haEnabled,omitempty"` 2211 // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of a server. 2212 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` 2213 // EarliestRestoreDate - READ-ONLY; Earliest restore point creation time (ISO8601 format) 2214 EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` 2215 // StorageProfile - Storage profile of a server. 2216 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 2217 // ReplicationRole - The replication role. 2218 ReplicationRole *string `json:"replicationRole,omitempty"` 2219 // ReplicaCapacity - READ-ONLY; The maximum number of replicas that a primary server can have. 2220 ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"` 2221 // PublicNetworkAccess - READ-ONLY; Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' 2222 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` 2223 // MaintenanceWindow - Maintenance window of a server. 2224 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` 2225 // SourceServerID - The source MySQL server id. 2226 SourceServerID *string `json:"sourceServerId,omitempty"` 2227 // RestorePointInTime - Restore point creation time (ISO8601 format), specifying the time to restore from. 2228 RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` 2229 // AvailabilityZone - availability Zone information of the server. 2230 AvailabilityZone *string `json:"availabilityZone,omitempty"` 2231 // StandbyAvailabilityZone - READ-ONLY; availability Zone information of the server. 2232 StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"` 2233 // ByokEnforcement - READ-ONLY; Status showing whether the data encryption is enabled with customer-managed keys. 2234 ByokEnforcement *string `json:"byokEnforcement,omitempty"` 2235 // DelegatedSubnetArguments - Delegated subnet arguments. 2236 DelegatedSubnetArguments *DelegatedSubnetArguments `json:"delegatedSubnetArguments,omitempty"` 2237 // CreateMode - The mode to create a new MySQL server. Possible values include: 'Default', 'PointInTimeRestore', 'Replica' 2238 CreateMode CreateMode `json:"createMode,omitempty"` 2239 // Tags - Application-specific metadata in the form of key-value pairs. 2240 Tags map[string]*string `json:"tags"` 2241} 2242 2243// MarshalJSON is the custom marshaler for ServerProperties. 2244func (sp ServerProperties) MarshalJSON() ([]byte, error) { 2245 objectMap := make(map[string]interface{}) 2246 if sp.AdministratorLogin != nil { 2247 objectMap["administratorLogin"] = sp.AdministratorLogin 2248 } 2249 if sp.AdministratorLoginPassword != nil { 2250 objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword 2251 } 2252 if sp.Version != "" { 2253 objectMap["version"] = sp.Version 2254 } 2255 if sp.SslEnforcement != "" { 2256 objectMap["sslEnforcement"] = sp.SslEnforcement 2257 } 2258 if sp.InfrastructureEncryption != "" { 2259 objectMap["infrastructureEncryption"] = sp.InfrastructureEncryption 2260 } 2261 if sp.HaEnabled != "" { 2262 objectMap["haEnabled"] = sp.HaEnabled 2263 } 2264 if sp.StorageProfile != nil { 2265 objectMap["storageProfile"] = sp.StorageProfile 2266 } 2267 if sp.ReplicationRole != nil { 2268 objectMap["replicationRole"] = sp.ReplicationRole 2269 } 2270 if sp.MaintenanceWindow != nil { 2271 objectMap["maintenanceWindow"] = sp.MaintenanceWindow 2272 } 2273 if sp.SourceServerID != nil { 2274 objectMap["sourceServerId"] = sp.SourceServerID 2275 } 2276 if sp.RestorePointInTime != nil { 2277 objectMap["restorePointInTime"] = sp.RestorePointInTime 2278 } 2279 if sp.AvailabilityZone != nil { 2280 objectMap["availabilityZone"] = sp.AvailabilityZone 2281 } 2282 if sp.DelegatedSubnetArguments != nil { 2283 objectMap["delegatedSubnetArguments"] = sp.DelegatedSubnetArguments 2284 } 2285 if sp.CreateMode != "" { 2286 objectMap["createMode"] = sp.CreateMode 2287 } 2288 if sp.Tags != nil { 2289 objectMap["tags"] = sp.Tags 2290 } 2291 return json.Marshal(objectMap) 2292} 2293 2294// ServerPropertiesForUpdate the properties that can be updated for a server. 2295type ServerPropertiesForUpdate struct { 2296 // StorageProfile - Storage profile of a server. 2297 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 2298 // AdministratorLoginPassword - The password of the administrator login. 2299 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` 2300 // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' 2301 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` 2302 // DelegatedSubnetArguments - Delegated subnet arguments. 2303 DelegatedSubnetArguments *DelegatedSubnetArguments `json:"delegatedSubnetArguments,omitempty"` 2304 // HaEnabled - Enable HA or not for a server. Possible values include: 'Enabled', 'Disabled' 2305 HaEnabled HaEnabledEnum `json:"haEnabled,omitempty"` 2306 // MaintenanceWindow - Maintenance window of a server. 2307 MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` 2308 // ReplicationRole - The replication role of the server. 2309 ReplicationRole *string `json:"replicationRole,omitempty"` 2310} 2311 2312// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running 2313// operation. 2314type ServersCreateFuture struct { 2315 azure.FutureAPI 2316 // Result returns the result of the asynchronous operation. 2317 // If the operation has not completed it will return an error. 2318 Result func(ServersClient) (Server, error) 2319} 2320 2321// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2322func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error { 2323 var azFuture azure.Future 2324 if err := json.Unmarshal(body, &azFuture); err != nil { 2325 return err 2326 } 2327 future.FutureAPI = &azFuture 2328 future.Result = future.result 2329 return nil 2330} 2331 2332// result is the default implementation for ServersCreateFuture.Result. 2333func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) { 2334 var done bool 2335 done, err = future.DoneWithContext(context.Background(), client) 2336 if err != nil { 2337 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersCreateFuture", "Result", future.Response(), "Polling failure") 2338 return 2339 } 2340 if !done { 2341 s.Response.Response = future.Response() 2342 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersCreateFuture") 2343 return 2344 } 2345 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2346 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 2347 s, err = client.CreateResponder(s.Response.Response) 2348 if err != nil { 2349 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request") 2350 } 2351 } 2352 return 2353} 2354 2355// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2356// operation. 2357type ServersDeleteFuture struct { 2358 azure.FutureAPI 2359 // Result returns the result of the asynchronous operation. 2360 // If the operation has not completed it will return an error. 2361 Result func(ServersClient) (autorest.Response, error) 2362} 2363 2364// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2365func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error { 2366 var azFuture azure.Future 2367 if err := json.Unmarshal(body, &azFuture); err != nil { 2368 return err 2369 } 2370 future.FutureAPI = &azFuture 2371 future.Result = future.result 2372 return nil 2373} 2374 2375// result is the default implementation for ServersDeleteFuture.Result. 2376func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { 2377 var done bool 2378 done, err = future.DoneWithContext(context.Background(), client) 2379 if err != nil { 2380 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersDeleteFuture", "Result", future.Response(), "Polling failure") 2381 return 2382 } 2383 if !done { 2384 ar.Response = future.Response() 2385 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersDeleteFuture") 2386 return 2387 } 2388 ar.Response = future.Response() 2389 return 2390} 2391 2392// ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running 2393// operation. 2394type ServersRestartFuture struct { 2395 azure.FutureAPI 2396 // Result returns the result of the asynchronous operation. 2397 // If the operation has not completed it will return an error. 2398 Result func(ServersClient) (autorest.Response, error) 2399} 2400 2401// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2402func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error { 2403 var azFuture azure.Future 2404 if err := json.Unmarshal(body, &azFuture); err != nil { 2405 return err 2406 } 2407 future.FutureAPI = &azFuture 2408 future.Result = future.result 2409 return nil 2410} 2411 2412// result is the default implementation for ServersRestartFuture.Result. 2413func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) { 2414 var done bool 2415 done, err = future.DoneWithContext(context.Background(), client) 2416 if err != nil { 2417 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersRestartFuture", "Result", future.Response(), "Polling failure") 2418 return 2419 } 2420 if !done { 2421 ar.Response = future.Response() 2422 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersRestartFuture") 2423 return 2424 } 2425 ar.Response = future.Response() 2426 return 2427} 2428 2429// ServersStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2430type ServersStartFuture struct { 2431 azure.FutureAPI 2432 // Result returns the result of the asynchronous operation. 2433 // If the operation has not completed it will return an error. 2434 Result func(ServersClient) (autorest.Response, error) 2435} 2436 2437// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2438func (future *ServersStartFuture) UnmarshalJSON(body []byte) error { 2439 var azFuture azure.Future 2440 if err := json.Unmarshal(body, &azFuture); err != nil { 2441 return err 2442 } 2443 future.FutureAPI = &azFuture 2444 future.Result = future.result 2445 return nil 2446} 2447 2448// result is the default implementation for ServersStartFuture.Result. 2449func (future *ServersStartFuture) result(client ServersClient) (ar autorest.Response, err error) { 2450 var done bool 2451 done, err = future.DoneWithContext(context.Background(), client) 2452 if err != nil { 2453 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersStartFuture", "Result", future.Response(), "Polling failure") 2454 return 2455 } 2456 if !done { 2457 ar.Response = future.Response() 2458 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersStartFuture") 2459 return 2460 } 2461 ar.Response = future.Response() 2462 return 2463} 2464 2465// ServersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2466type ServersStopFuture struct { 2467 azure.FutureAPI 2468 // Result returns the result of the asynchronous operation. 2469 // If the operation has not completed it will return an error. 2470 Result func(ServersClient) (autorest.Response, error) 2471} 2472 2473// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2474func (future *ServersStopFuture) UnmarshalJSON(body []byte) error { 2475 var azFuture azure.Future 2476 if err := json.Unmarshal(body, &azFuture); err != nil { 2477 return err 2478 } 2479 future.FutureAPI = &azFuture 2480 future.Result = future.result 2481 return nil 2482} 2483 2484// result is the default implementation for ServersStopFuture.Result. 2485func (future *ServersStopFuture) result(client ServersClient) (ar autorest.Response, err error) { 2486 var done bool 2487 done, err = future.DoneWithContext(context.Background(), client) 2488 if err != nil { 2489 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersStopFuture", "Result", future.Response(), "Polling failure") 2490 return 2491 } 2492 if !done { 2493 ar.Response = future.Response() 2494 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersStopFuture") 2495 return 2496 } 2497 ar.Response = future.Response() 2498 return 2499} 2500 2501// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2502// operation. 2503type ServersUpdateFuture struct { 2504 azure.FutureAPI 2505 // Result returns the result of the asynchronous operation. 2506 // If the operation has not completed it will return an error. 2507 Result func(ServersClient) (Server, error) 2508} 2509 2510// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2511func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error { 2512 var azFuture azure.Future 2513 if err := json.Unmarshal(body, &azFuture); err != nil { 2514 return err 2515 } 2516 future.FutureAPI = &azFuture 2517 future.Result = future.result 2518 return nil 2519} 2520 2521// result is the default implementation for ServersUpdateFuture.Result. 2522func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { 2523 var done bool 2524 done, err = future.DoneWithContext(context.Background(), client) 2525 if err != nil { 2526 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersUpdateFuture", "Result", future.Response(), "Polling failure") 2527 return 2528 } 2529 if !done { 2530 s.Response.Response = future.Response() 2531 err = azure.NewAsyncOpIncompleteError("mysqlflexibleservers.ServersUpdateFuture") 2532 return 2533 } 2534 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2535 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 2536 s, err = client.UpdateResponder(s.Response.Response) 2537 if err != nil { 2538 err = autorest.NewErrorWithError(err, "mysqlflexibleservers.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") 2539 } 2540 } 2541 return 2542} 2543 2544// ServerVersionCapability server version capabilities. 2545type ServerVersionCapability struct { 2546 // Name - READ-ONLY; server version 2547 Name *string `json:"name,omitempty"` 2548 // SupportedVcores - READ-ONLY; A list of supported Vcores 2549 SupportedVcores *[]VcoreCapability `json:"supportedVcores,omitempty"` 2550} 2551 2552// MarshalJSON is the custom marshaler for ServerVersionCapability. 2553func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) { 2554 objectMap := make(map[string]interface{}) 2555 return json.Marshal(objectMap) 2556} 2557 2558// Sku billing information related properties of a server. 2559type Sku struct { 2560 // Name - The name of the sku, e.g. Standard_D32s_v3. 2561 Name *string `json:"name,omitempty"` 2562 // Tier - The tier of the particular SKU, e.g. GeneralPurpose. Possible values include: 'Burstable', 'GeneralPurpose', 'MemoryOptimized' 2563 Tier SkuTier `json:"tier,omitempty"` 2564} 2565 2566// StorageEditionCapability storage edition capability 2567type StorageEditionCapability struct { 2568 // Name - READ-ONLY; storage edition name 2569 Name *string `json:"name,omitempty"` 2570 // MinStorageSize - READ-ONLY; The minimal supported storage size in MB 2571 MinStorageSize *StorageMBCapability `json:"minStorageSize,omitempty"` 2572 // MaxStorageSize - READ-ONLY; The maximum supported storage size in MB 2573 MaxStorageSize *StorageMBCapability `json:"maxStorageSize,omitempty"` 2574 // MinBackupRetentionDays - READ-ONLY; Minimal backup retention days 2575 MinBackupRetentionDays *int64 `json:"minBackupRetentionDays,omitempty"` 2576 // MaxBackupRetentionDays - READ-ONLY; Maximum backup retention days 2577 MaxBackupRetentionDays *int64 `json:"maxBackupRetentionDays,omitempty"` 2578} 2579 2580// MarshalJSON is the custom marshaler for StorageEditionCapability. 2581func (sec StorageEditionCapability) MarshalJSON() ([]byte, error) { 2582 objectMap := make(map[string]interface{}) 2583 return json.Marshal(objectMap) 2584} 2585 2586// StorageMBCapability storage size in MB capability 2587type StorageMBCapability struct { 2588 // Name - READ-ONLY; storage MB name 2589 Name *string `json:"name,omitempty"` 2590 // StorageSizeMB - READ-ONLY; storage size in MB 2591 StorageSizeMB *int64 `json:"storageSizeMB,omitempty"` 2592} 2593 2594// MarshalJSON is the custom marshaler for StorageMBCapability. 2595func (smc StorageMBCapability) MarshalJSON() ([]byte, error) { 2596 objectMap := make(map[string]interface{}) 2597 return json.Marshal(objectMap) 2598} 2599 2600// StorageProfile storage Profile properties of a server 2601type StorageProfile struct { 2602 // BackupRetentionDays - Backup retention days for the server. 2603 BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` 2604 // StorageMB - Max storage allowed for a server. 2605 StorageMB *int32 `json:"storageMB,omitempty"` 2606 // StorageIops - Storage IOPS for a server. 2607 StorageIops *int32 `json:"storageIops,omitempty"` 2608 // StorageAutogrow - Enable Storage Auto Grow. Possible values include: 'StorageAutogrowEnabled', 'StorageAutogrowDisabled' 2609 StorageAutogrow StorageAutogrow `json:"storageAutogrow,omitempty"` 2610} 2611 2612// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource 2613// which has 'tags' and a 'location' 2614type TrackedResource struct { 2615 // Tags - Resource tags. 2616 Tags map[string]*string `json:"tags"` 2617 // Location - The geo-location where the resource lives 2618 Location *string `json:"location,omitempty"` 2619 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2620 ID *string `json:"id,omitempty"` 2621 // Name - READ-ONLY; The name of the resource 2622 Name *string `json:"name,omitempty"` 2623 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2624 Type *string `json:"type,omitempty"` 2625} 2626 2627// MarshalJSON is the custom marshaler for TrackedResource. 2628func (tr TrackedResource) MarshalJSON() ([]byte, error) { 2629 objectMap := make(map[string]interface{}) 2630 if tr.Tags != nil { 2631 objectMap["tags"] = tr.Tags 2632 } 2633 if tr.Location != nil { 2634 objectMap["location"] = tr.Location 2635 } 2636 return json.Marshal(objectMap) 2637} 2638 2639// VcoreCapability vcores capability 2640type VcoreCapability struct { 2641 // Name - READ-ONLY; vCore name 2642 Name *string `json:"name,omitempty"` 2643 // VCores - READ-ONLY; supported vCores 2644 VCores *int64 `json:"vCores,omitempty"` 2645 // SupportedIops - READ-ONLY; supported IOPS 2646 SupportedIops *int64 `json:"supportedIops,omitempty"` 2647 // SupportedMemoryPerVcoreMB - READ-ONLY; supported memory per vCore in MB 2648 SupportedMemoryPerVcoreMB *int64 `json:"supportedMemoryPerVcoreMB,omitempty"` 2649} 2650 2651// MarshalJSON is the custom marshaler for VcoreCapability. 2652func (vc VcoreCapability) MarshalJSON() ([]byte, error) { 2653 objectMap := make(map[string]interface{}) 2654 return json.Marshal(objectMap) 2655} 2656 2657// VirtualNetworkSubnetUsageParameter virtual network subnet usage parameter 2658type VirtualNetworkSubnetUsageParameter struct { 2659 // VirtualNetworkArmResourceID - Virtual network resource id. 2660 VirtualNetworkArmResourceID *string `json:"virtualNetworkArmResourceId,omitempty"` 2661} 2662 2663// VirtualNetworkSubnetUsageResult virtual network subnet usage data. 2664type VirtualNetworkSubnetUsageResult struct { 2665 autorest.Response `json:"-"` 2666 // DelegatedSubnetsUsage - READ-ONLY; A list of delegated subnet usage 2667 DelegatedSubnetsUsage *[]DelegatedSubnetUsage `json:"delegatedSubnetsUsage,omitempty"` 2668} 2669 2670// MarshalJSON is the custom marshaler for VirtualNetworkSubnetUsageResult. 2671func (vnsur VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) { 2672 objectMap := make(map[string]interface{}) 2673 return json.Marshal(objectMap) 2674} 2675