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