1package mysql 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "github.com/gofrs/uuid" 18 "net/http" 19) 20 21// The package's fully qualified name. 22const fqdn = "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" 23 24// Advisor represents a recommendation action advisor. 25type Advisor struct { 26 autorest.Response `json:"-"` 27 // Properties - The properties of a recommendation action advisor. 28 Properties interface{} `json:"properties,omitempty"` 29 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 30 ID *string `json:"id,omitempty"` 31 // Name - READ-ONLY; The name of the resource 32 Name *string `json:"name,omitempty"` 33 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 34 Type *string `json:"type,omitempty"` 35} 36 37// MarshalJSON is the custom marshaler for Advisor. 38func (a Advisor) MarshalJSON() ([]byte, error) { 39 objectMap := make(map[string]interface{}) 40 if a.Properties != nil { 41 objectMap["properties"] = a.Properties 42 } 43 return json.Marshal(objectMap) 44} 45 46// AdvisorsResultList a list of query statistics. 47type AdvisorsResultList struct { 48 autorest.Response `json:"-"` 49 // Value - READ-ONLY; The list of recommendation action advisors. 50 Value *[]Advisor `json:"value,omitempty"` 51 // NextLink - READ-ONLY; Link to retrieve next page of results. 52 NextLink *string `json:"nextLink,omitempty"` 53} 54 55// MarshalJSON is the custom marshaler for AdvisorsResultList. 56func (arl AdvisorsResultList) MarshalJSON() ([]byte, error) { 57 objectMap := make(map[string]interface{}) 58 return json.Marshal(objectMap) 59} 60 61// AdvisorsResultListIterator provides access to a complete listing of Advisor values. 62type AdvisorsResultListIterator struct { 63 i int 64 page AdvisorsResultListPage 65} 66 67// NextWithContext advances to the next value. If there was an error making 68// the request the iterator does not advance and the error is returned. 69func (iter *AdvisorsResultListIterator) NextWithContext(ctx context.Context) (err error) { 70 if tracing.IsEnabled() { 71 ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsResultListIterator.NextWithContext") 72 defer func() { 73 sc := -1 74 if iter.Response().Response.Response != nil { 75 sc = iter.Response().Response.Response.StatusCode 76 } 77 tracing.EndSpan(ctx, sc, err) 78 }() 79 } 80 iter.i++ 81 if iter.i < len(iter.page.Values()) { 82 return nil 83 } 84 err = iter.page.NextWithContext(ctx) 85 if err != nil { 86 iter.i-- 87 return err 88 } 89 iter.i = 0 90 return nil 91} 92 93// Next advances to the next value. If there was an error making 94// the request the iterator does not advance and the error is returned. 95// Deprecated: Use NextWithContext() instead. 96func (iter *AdvisorsResultListIterator) Next() error { 97 return iter.NextWithContext(context.Background()) 98} 99 100// NotDone returns true if the enumeration should be started or is not yet complete. 101func (iter AdvisorsResultListIterator) NotDone() bool { 102 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 103} 104 105// Response returns the raw server response from the last page request. 106func (iter AdvisorsResultListIterator) Response() AdvisorsResultList { 107 return iter.page.Response() 108} 109 110// Value returns the current value or a zero-initialized value if the 111// iterator has advanced beyond the end of the collection. 112func (iter AdvisorsResultListIterator) Value() Advisor { 113 if !iter.page.NotDone() { 114 return Advisor{} 115 } 116 return iter.page.Values()[iter.i] 117} 118 119// Creates a new instance of the AdvisorsResultListIterator type. 120func NewAdvisorsResultListIterator(page AdvisorsResultListPage) AdvisorsResultListIterator { 121 return AdvisorsResultListIterator{page: page} 122} 123 124// IsEmpty returns true if the ListResult contains no values. 125func (arl AdvisorsResultList) IsEmpty() bool { 126 return arl.Value == nil || len(*arl.Value) == 0 127} 128 129// hasNextLink returns true if the NextLink is not empty. 130func (arl AdvisorsResultList) hasNextLink() bool { 131 return arl.NextLink != nil && len(*arl.NextLink) != 0 132} 133 134// advisorsResultListPreparer prepares a request to retrieve the next set of results. 135// It returns nil if no more results exist. 136func (arl AdvisorsResultList) advisorsResultListPreparer(ctx context.Context) (*http.Request, error) { 137 if !arl.hasNextLink() { 138 return nil, nil 139 } 140 return autorest.Prepare((&http.Request{}).WithContext(ctx), 141 autorest.AsJSON(), 142 autorest.AsGet(), 143 autorest.WithBaseURL(to.String(arl.NextLink))) 144} 145 146// AdvisorsResultListPage contains a page of Advisor values. 147type AdvisorsResultListPage struct { 148 fn func(context.Context, AdvisorsResultList) (AdvisorsResultList, error) 149 arl AdvisorsResultList 150} 151 152// NextWithContext advances to the next page of values. If there was an error making 153// the request the page does not advance and the error is returned. 154func (page *AdvisorsResultListPage) NextWithContext(ctx context.Context) (err error) { 155 if tracing.IsEnabled() { 156 ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsResultListPage.NextWithContext") 157 defer func() { 158 sc := -1 159 if page.Response().Response.Response != nil { 160 sc = page.Response().Response.Response.StatusCode 161 } 162 tracing.EndSpan(ctx, sc, err) 163 }() 164 } 165 for { 166 next, err := page.fn(ctx, page.arl) 167 if err != nil { 168 return err 169 } 170 page.arl = next 171 if !next.hasNextLink() || !next.IsEmpty() { 172 break 173 } 174 } 175 return nil 176} 177 178// Next advances to the next page of values. If there was an error making 179// the request the page does not advance and the error is returned. 180// Deprecated: Use NextWithContext() instead. 181func (page *AdvisorsResultListPage) Next() error { 182 return page.NextWithContext(context.Background()) 183} 184 185// NotDone returns true if the page enumeration should be started or is not yet complete. 186func (page AdvisorsResultListPage) NotDone() bool { 187 return !page.arl.IsEmpty() 188} 189 190// Response returns the raw server response from the last page request. 191func (page AdvisorsResultListPage) Response() AdvisorsResultList { 192 return page.arl 193} 194 195// Values returns the slice of values for the current page or nil if there are no values. 196func (page AdvisorsResultListPage) Values() []Advisor { 197 if page.arl.IsEmpty() { 198 return nil 199 } 200 return *page.arl.Value 201} 202 203// Creates a new instance of the AdvisorsResultListPage type. 204func NewAdvisorsResultListPage(cur AdvisorsResultList, getNextPage func(context.Context, AdvisorsResultList) (AdvisorsResultList, error)) AdvisorsResultListPage { 205 return AdvisorsResultListPage{ 206 fn: getNextPage, 207 arl: cur, 208 } 209} 210 211// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. 212type AzureEntityResource struct { 213 // Etag - READ-ONLY; Resource Etag. 214 Etag *string `json:"etag,omitempty"` 215 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 216 ID *string `json:"id,omitempty"` 217 // Name - READ-ONLY; The name of the resource 218 Name *string `json:"name,omitempty"` 219 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 220 Type *string `json:"type,omitempty"` 221} 222 223// MarshalJSON is the custom marshaler for AzureEntityResource. 224func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { 225 objectMap := make(map[string]interface{}) 226 return json.Marshal(objectMap) 227} 228 229// CloudError an error response from the Batch service. 230type CloudError struct { 231 // Error - Error message 232 Error *ErrorResponse `json:"error,omitempty"` 233} 234 235// Configuration represents a Configuration. 236type Configuration struct { 237 autorest.Response `json:"-"` 238 // ConfigurationProperties - The properties of a configuration. 239 *ConfigurationProperties `json:"properties,omitempty"` 240 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 241 ID *string `json:"id,omitempty"` 242 // Name - READ-ONLY; The name of the resource 243 Name *string `json:"name,omitempty"` 244 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 245 Type *string `json:"type,omitempty"` 246} 247 248// MarshalJSON is the custom marshaler for Configuration. 249func (c Configuration) MarshalJSON() ([]byte, error) { 250 objectMap := make(map[string]interface{}) 251 if c.ConfigurationProperties != nil { 252 objectMap["properties"] = c.ConfigurationProperties 253 } 254 return json.Marshal(objectMap) 255} 256 257// UnmarshalJSON is the custom unmarshaler for Configuration struct. 258func (c *Configuration) UnmarshalJSON(body []byte) error { 259 var m map[string]*json.RawMessage 260 err := json.Unmarshal(body, &m) 261 if err != nil { 262 return err 263 } 264 for k, v := range m { 265 switch k { 266 case "properties": 267 if v != nil { 268 var configurationProperties ConfigurationProperties 269 err = json.Unmarshal(*v, &configurationProperties) 270 if err != nil { 271 return err 272 } 273 c.ConfigurationProperties = &configurationProperties 274 } 275 case "id": 276 if v != nil { 277 var ID string 278 err = json.Unmarshal(*v, &ID) 279 if err != nil { 280 return err 281 } 282 c.ID = &ID 283 } 284 case "name": 285 if v != nil { 286 var name string 287 err = json.Unmarshal(*v, &name) 288 if err != nil { 289 return err 290 } 291 c.Name = &name 292 } 293 case "type": 294 if v != nil { 295 var typeVar string 296 err = json.Unmarshal(*v, &typeVar) 297 if err != nil { 298 return err 299 } 300 c.Type = &typeVar 301 } 302 } 303 } 304 305 return nil 306} 307 308// ConfigurationListResult a list of server configurations. 309type ConfigurationListResult struct { 310 autorest.Response `json:"-"` 311 // Value - The list of server configurations. 312 Value *[]Configuration `json:"value,omitempty"` 313} 314 315// ConfigurationProperties the properties of a configuration. 316type ConfigurationProperties struct { 317 // Value - Value of the configuration. 318 Value *string `json:"value,omitempty"` 319 // Description - READ-ONLY; Description of the configuration. 320 Description *string `json:"description,omitempty"` 321 // DefaultValue - READ-ONLY; Default value of the configuration. 322 DefaultValue *string `json:"defaultValue,omitempty"` 323 // DataType - READ-ONLY; Data type of the configuration. 324 DataType *string `json:"dataType,omitempty"` 325 // AllowedValues - READ-ONLY; Allowed values of the configuration. 326 AllowedValues *string `json:"allowedValues,omitempty"` 327 // Source - Source of the configuration. 328 Source *string `json:"source,omitempty"` 329} 330 331// MarshalJSON is the custom marshaler for ConfigurationProperties. 332func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) { 333 objectMap := make(map[string]interface{}) 334 if cp.Value != nil { 335 objectMap["value"] = cp.Value 336 } 337 if cp.Source != nil { 338 objectMap["source"] = cp.Source 339 } 340 return json.Marshal(objectMap) 341} 342 343// ConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 344// long-running operation. 345type ConfigurationsCreateOrUpdateFuture struct { 346 azure.FutureAPI 347 // Result returns the result of the asynchronous operation. 348 // If the operation has not completed it will return an error. 349 Result func(ConfigurationsClient) (Configuration, error) 350} 351 352// UnmarshalJSON is the custom unmarshaller for CreateFuture. 353func (future *ConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 354 var azFuture azure.Future 355 if err := json.Unmarshal(body, &azFuture); err != nil { 356 return err 357 } 358 future.FutureAPI = &azFuture 359 future.Result = future.result 360 return nil 361} 362 363// result is the default implementation for ConfigurationsCreateOrUpdateFuture.Result. 364func (future *ConfigurationsCreateOrUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) { 365 var done bool 366 done, err = future.DoneWithContext(context.Background(), client) 367 if err != nil { 368 err = autorest.NewErrorWithError(err, "mysql.ConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 369 return 370 } 371 if !done { 372 c.Response.Response = future.Response() 373 err = azure.NewAsyncOpIncompleteError("mysql.ConfigurationsCreateOrUpdateFuture") 374 return 375 } 376 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 377 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 378 c, err = client.CreateOrUpdateResponder(c.Response.Response) 379 if err != nil { 380 err = autorest.NewErrorWithError(err, "mysql.ConfigurationsCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") 381 } 382 } 383 return 384} 385 386// CreateRecommendedActionSessionFuture an abstraction for monitoring and retrieving the results of a 387// long-running operation. 388type CreateRecommendedActionSessionFuture struct { 389 azure.FutureAPI 390 // Result returns the result of the asynchronous operation. 391 // If the operation has not completed it will return an error. 392 Result func(BaseClient) (autorest.Response, error) 393} 394 395// UnmarshalJSON is the custom unmarshaller for CreateFuture. 396func (future *CreateRecommendedActionSessionFuture) UnmarshalJSON(body []byte) error { 397 var azFuture azure.Future 398 if err := json.Unmarshal(body, &azFuture); err != nil { 399 return err 400 } 401 future.FutureAPI = &azFuture 402 future.Result = future.result 403 return nil 404} 405 406// result is the default implementation for CreateRecommendedActionSessionFuture.Result. 407func (future *CreateRecommendedActionSessionFuture) result(client BaseClient) (ar autorest.Response, err error) { 408 var done bool 409 done, err = future.DoneWithContext(context.Background(), client) 410 if err != nil { 411 err = autorest.NewErrorWithError(err, "mysql.CreateRecommendedActionSessionFuture", "Result", future.Response(), "Polling failure") 412 return 413 } 414 if !done { 415 ar.Response = future.Response() 416 err = azure.NewAsyncOpIncompleteError("mysql.CreateRecommendedActionSessionFuture") 417 return 418 } 419 ar.Response = future.Response() 420 return 421} 422 423// Database represents a Database. 424type Database struct { 425 autorest.Response `json:"-"` 426 // DatabaseProperties - The properties of a database. 427 *DatabaseProperties `json:"properties,omitempty"` 428 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 429 ID *string `json:"id,omitempty"` 430 // Name - READ-ONLY; The name of the resource 431 Name *string `json:"name,omitempty"` 432 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 433 Type *string `json:"type,omitempty"` 434} 435 436// MarshalJSON is the custom marshaler for Database. 437func (d Database) MarshalJSON() ([]byte, error) { 438 objectMap := make(map[string]interface{}) 439 if d.DatabaseProperties != nil { 440 objectMap["properties"] = d.DatabaseProperties 441 } 442 return json.Marshal(objectMap) 443} 444 445// UnmarshalJSON is the custom unmarshaler for Database struct. 446func (d *Database) UnmarshalJSON(body []byte) error { 447 var m map[string]*json.RawMessage 448 err := json.Unmarshal(body, &m) 449 if err != nil { 450 return err 451 } 452 for k, v := range m { 453 switch k { 454 case "properties": 455 if v != nil { 456 var databaseProperties DatabaseProperties 457 err = json.Unmarshal(*v, &databaseProperties) 458 if err != nil { 459 return err 460 } 461 d.DatabaseProperties = &databaseProperties 462 } 463 case "id": 464 if v != nil { 465 var ID string 466 err = json.Unmarshal(*v, &ID) 467 if err != nil { 468 return err 469 } 470 d.ID = &ID 471 } 472 case "name": 473 if v != nil { 474 var name string 475 err = json.Unmarshal(*v, &name) 476 if err != nil { 477 return err 478 } 479 d.Name = &name 480 } 481 case "type": 482 if v != nil { 483 var typeVar string 484 err = json.Unmarshal(*v, &typeVar) 485 if err != nil { 486 return err 487 } 488 d.Type = &typeVar 489 } 490 } 491 } 492 493 return nil 494} 495 496// DatabaseListResult a List of databases. 497type DatabaseListResult struct { 498 autorest.Response `json:"-"` 499 // Value - The list of databases housed in a server 500 Value *[]Database `json:"value,omitempty"` 501} 502 503// DatabaseProperties the properties of a database. 504type DatabaseProperties struct { 505 // Charset - The charset of the database. 506 Charset *string `json:"charset,omitempty"` 507 // Collation - The collation of the database. 508 Collation *string `json:"collation,omitempty"` 509} 510 511// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 512// operation. 513type DatabasesCreateOrUpdateFuture struct { 514 azure.FutureAPI 515 // Result returns the result of the asynchronous operation. 516 // If the operation has not completed it will return an error. 517 Result func(DatabasesClient) (Database, error) 518} 519 520// UnmarshalJSON is the custom unmarshaller for CreateFuture. 521func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 522 var azFuture azure.Future 523 if err := json.Unmarshal(body, &azFuture); err != nil { 524 return err 525 } 526 future.FutureAPI = &azFuture 527 future.Result = future.result 528 return nil 529} 530 531// result is the default implementation for DatabasesCreateOrUpdateFuture.Result. 532func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) { 533 var done bool 534 done, err = future.DoneWithContext(context.Background(), client) 535 if err != nil { 536 err = autorest.NewErrorWithError(err, "mysql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 537 return 538 } 539 if !done { 540 d.Response.Response = future.Response() 541 err = azure.NewAsyncOpIncompleteError("mysql.DatabasesCreateOrUpdateFuture") 542 return 543 } 544 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 545 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { 546 d, err = client.CreateOrUpdateResponder(d.Response.Response) 547 if err != nil { 548 err = autorest.NewErrorWithError(err, "mysql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") 549 } 550 } 551 return 552} 553 554// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 555// operation. 556type DatabasesDeleteFuture struct { 557 azure.FutureAPI 558 // Result returns the result of the asynchronous operation. 559 // If the operation has not completed it will return an error. 560 Result func(DatabasesClient) (autorest.Response, error) 561} 562 563// UnmarshalJSON is the custom unmarshaller for CreateFuture. 564func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { 565 var azFuture azure.Future 566 if err := json.Unmarshal(body, &azFuture); err != nil { 567 return err 568 } 569 future.FutureAPI = &azFuture 570 future.Result = future.result 571 return nil 572} 573 574// result is the default implementation for DatabasesDeleteFuture.Result. 575func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { 576 var done bool 577 done, err = future.DoneWithContext(context.Background(), client) 578 if err != nil { 579 err = autorest.NewErrorWithError(err, "mysql.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") 580 return 581 } 582 if !done { 583 ar.Response = future.Response() 584 err = azure.NewAsyncOpIncompleteError("mysql.DatabasesDeleteFuture") 585 return 586 } 587 ar.Response = future.Response() 588 return 589} 590 591// ErrorAdditionalInfo the resource management error additional info. 592type ErrorAdditionalInfo struct { 593 // Type - READ-ONLY; The additional info type. 594 Type *string `json:"type,omitempty"` 595 // Info - READ-ONLY; The additional info. 596 Info interface{} `json:"info,omitempty"` 597} 598 599// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. 600func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { 601 objectMap := make(map[string]interface{}) 602 return json.Marshal(objectMap) 603} 604 605// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for 606// failed operations. (This also follows the OData error response format.) 607type ErrorResponse struct { 608 // Code - READ-ONLY; The error code. 609 Code *string `json:"code,omitempty"` 610 // Message - READ-ONLY; The error message. 611 Message *string `json:"message,omitempty"` 612 // Target - READ-ONLY; The error target. 613 Target *string `json:"target,omitempty"` 614 // Details - READ-ONLY; The error details. 615 Details *[]ErrorResponse `json:"details,omitempty"` 616 // AdditionalInfo - READ-ONLY; The error additional info. 617 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 618} 619 620// MarshalJSON is the custom marshaler for ErrorResponse. 621func (er ErrorResponse) MarshalJSON() ([]byte, error) { 622 objectMap := make(map[string]interface{}) 623 return json.Marshal(objectMap) 624} 625 626// FirewallRule represents a server firewall rule. 627type FirewallRule struct { 628 autorest.Response `json:"-"` 629 // FirewallRuleProperties - The properties of a firewall rule. 630 *FirewallRuleProperties `json:"properties,omitempty"` 631 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 632 ID *string `json:"id,omitempty"` 633 // Name - READ-ONLY; The name of the resource 634 Name *string `json:"name,omitempty"` 635 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 636 Type *string `json:"type,omitempty"` 637} 638 639// MarshalJSON is the custom marshaler for FirewallRule. 640func (fr FirewallRule) MarshalJSON() ([]byte, error) { 641 objectMap := make(map[string]interface{}) 642 if fr.FirewallRuleProperties != nil { 643 objectMap["properties"] = fr.FirewallRuleProperties 644 } 645 return json.Marshal(objectMap) 646} 647 648// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. 649func (fr *FirewallRule) UnmarshalJSON(body []byte) error { 650 var m map[string]*json.RawMessage 651 err := json.Unmarshal(body, &m) 652 if err != nil { 653 return err 654 } 655 for k, v := range m { 656 switch k { 657 case "properties": 658 if v != nil { 659 var firewallRuleProperties FirewallRuleProperties 660 err = json.Unmarshal(*v, &firewallRuleProperties) 661 if err != nil { 662 return err 663 } 664 fr.FirewallRuleProperties = &firewallRuleProperties 665 } 666 case "id": 667 if v != nil { 668 var ID string 669 err = json.Unmarshal(*v, &ID) 670 if err != nil { 671 return err 672 } 673 fr.ID = &ID 674 } 675 case "name": 676 if v != nil { 677 var name string 678 err = json.Unmarshal(*v, &name) 679 if err != nil { 680 return err 681 } 682 fr.Name = &name 683 } 684 case "type": 685 if v != nil { 686 var typeVar string 687 err = json.Unmarshal(*v, &typeVar) 688 if err != nil { 689 return err 690 } 691 fr.Type = &typeVar 692 } 693 } 694 } 695 696 return nil 697} 698 699// FirewallRuleListResult a list of firewall rules. 700type FirewallRuleListResult struct { 701 autorest.Response `json:"-"` 702 // Value - The list of firewall rules in a server. 703 Value *[]FirewallRule `json:"value,omitempty"` 704} 705 706// FirewallRuleProperties the properties of a server firewall rule. 707type FirewallRuleProperties struct { 708 // StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format. 709 StartIPAddress *string `json:"startIpAddress,omitempty"` 710 // EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format. 711 EndIPAddress *string `json:"endIpAddress,omitempty"` 712} 713 714// FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 715// long-running operation. 716type FirewallRulesCreateOrUpdateFuture struct { 717 azure.FutureAPI 718 // Result returns the result of the asynchronous operation. 719 // If the operation has not completed it will return an error. 720 Result func(FirewallRulesClient) (FirewallRule, error) 721} 722 723// UnmarshalJSON is the custom unmarshaller for CreateFuture. 724func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 725 var azFuture azure.Future 726 if err := json.Unmarshal(body, &azFuture); err != nil { 727 return err 728 } 729 future.FutureAPI = &azFuture 730 future.Result = future.result 731 return nil 732} 733 734// result is the default implementation for FirewallRulesCreateOrUpdateFuture.Result. 735func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) { 736 var done bool 737 done, err = future.DoneWithContext(context.Background(), client) 738 if err != nil { 739 err = autorest.NewErrorWithError(err, "mysql.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 740 return 741 } 742 if !done { 743 fr.Response.Response = future.Response() 744 err = azure.NewAsyncOpIncompleteError("mysql.FirewallRulesCreateOrUpdateFuture") 745 return 746 } 747 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 748 if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent { 749 fr, err = client.CreateOrUpdateResponder(fr.Response.Response) 750 if err != nil { 751 err = autorest.NewErrorWithError(err, "mysql.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request") 752 } 753 } 754 return 755} 756 757// FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 758// operation. 759type FirewallRulesDeleteFuture struct { 760 azure.FutureAPI 761 // Result returns the result of the asynchronous operation. 762 // If the operation has not completed it will return an error. 763 Result func(FirewallRulesClient) (autorest.Response, error) 764} 765 766// UnmarshalJSON is the custom unmarshaller for CreateFuture. 767func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error { 768 var azFuture azure.Future 769 if err := json.Unmarshal(body, &azFuture); err != nil { 770 return err 771 } 772 future.FutureAPI = &azFuture 773 future.Result = future.result 774 return nil 775} 776 777// result is the default implementation for FirewallRulesDeleteFuture.Result. 778func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) { 779 var done bool 780 done, err = future.DoneWithContext(context.Background(), client) 781 if err != nil { 782 err = autorest.NewErrorWithError(err, "mysql.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure") 783 return 784 } 785 if !done { 786 ar.Response = future.Response() 787 err = azure.NewAsyncOpIncompleteError("mysql.FirewallRulesDeleteFuture") 788 return 789 } 790 ar.Response = future.Response() 791 return 792} 793 794// LogFile represents a log file. 795type LogFile struct { 796 // LogFileProperties - The properties of the log file. 797 *LogFileProperties `json:"properties,omitempty"` 798 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 799 ID *string `json:"id,omitempty"` 800 // Name - READ-ONLY; The name of the resource 801 Name *string `json:"name,omitempty"` 802 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 803 Type *string `json:"type,omitempty"` 804} 805 806// MarshalJSON is the custom marshaler for LogFile. 807func (lf LogFile) MarshalJSON() ([]byte, error) { 808 objectMap := make(map[string]interface{}) 809 if lf.LogFileProperties != nil { 810 objectMap["properties"] = lf.LogFileProperties 811 } 812 return json.Marshal(objectMap) 813} 814 815// UnmarshalJSON is the custom unmarshaler for LogFile struct. 816func (lf *LogFile) UnmarshalJSON(body []byte) error { 817 var m map[string]*json.RawMessage 818 err := json.Unmarshal(body, &m) 819 if err != nil { 820 return err 821 } 822 for k, v := range m { 823 switch k { 824 case "properties": 825 if v != nil { 826 var logFileProperties LogFileProperties 827 err = json.Unmarshal(*v, &logFileProperties) 828 if err != nil { 829 return err 830 } 831 lf.LogFileProperties = &logFileProperties 832 } 833 case "id": 834 if v != nil { 835 var ID string 836 err = json.Unmarshal(*v, &ID) 837 if err != nil { 838 return err 839 } 840 lf.ID = &ID 841 } 842 case "name": 843 if v != nil { 844 var name string 845 err = json.Unmarshal(*v, &name) 846 if err != nil { 847 return err 848 } 849 lf.Name = &name 850 } 851 case "type": 852 if v != nil { 853 var typeVar string 854 err = json.Unmarshal(*v, &typeVar) 855 if err != nil { 856 return err 857 } 858 lf.Type = &typeVar 859 } 860 } 861 } 862 863 return nil 864} 865 866// LogFileListResult a list of log files. 867type LogFileListResult struct { 868 autorest.Response `json:"-"` 869 // Value - The list of log files. 870 Value *[]LogFile `json:"value,omitempty"` 871} 872 873// LogFileProperties the properties of a log file. 874type LogFileProperties struct { 875 // SizeInKB - Size of the log file. 876 SizeInKB *int64 `json:"sizeInKB,omitempty"` 877 // CreatedTime - READ-ONLY; Creation timestamp of the log file. 878 CreatedTime *date.Time `json:"createdTime,omitempty"` 879 // LastModifiedTime - READ-ONLY; Last modified timestamp of the log file. 880 LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` 881 // Type - Type of the log file. 882 Type *string `json:"type,omitempty"` 883 // URL - The url to download the log file from. 884 URL *string `json:"url,omitempty"` 885} 886 887// MarshalJSON is the custom marshaler for LogFileProperties. 888func (lfp LogFileProperties) MarshalJSON() ([]byte, error) { 889 objectMap := make(map[string]interface{}) 890 if lfp.SizeInKB != nil { 891 objectMap["sizeInKB"] = lfp.SizeInKB 892 } 893 if lfp.Type != nil { 894 objectMap["type"] = lfp.Type 895 } 896 if lfp.URL != nil { 897 objectMap["url"] = lfp.URL 898 } 899 return json.Marshal(objectMap) 900} 901 902// NameAvailability represents a resource name availability. 903type NameAvailability struct { 904 autorest.Response `json:"-"` 905 // Message - Error Message. 906 Message *string `json:"message,omitempty"` 907 // NameAvailable - Indicates whether the resource name is available. 908 NameAvailable *bool `json:"nameAvailable,omitempty"` 909 // Reason - Reason for name being unavailable. 910 Reason *string `json:"reason,omitempty"` 911} 912 913// NameAvailabilityRequest request from client to check resource name availability. 914type NameAvailabilityRequest struct { 915 // Name - Resource name to verify. 916 Name *string `json:"name,omitempty"` 917 // Type - Resource type used for verification. 918 Type *string `json:"type,omitempty"` 919} 920 921// Operation REST API operation definition. 922type Operation struct { 923 // Name - READ-ONLY; The name of the operation being performed on this particular object. 924 Name *string `json:"name,omitempty"` 925 // Display - READ-ONLY; The localized display information for this particular operation or action. 926 Display *OperationDisplay `json:"display,omitempty"` 927 // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'NotSpecified', 'User', 'System' 928 Origin OperationOrigin `json:"origin,omitempty"` 929 // Properties - READ-ONLY; Additional descriptions for the operation. 930 Properties map[string]interface{} `json:"properties"` 931} 932 933// MarshalJSON is the custom marshaler for Operation. 934func (o Operation) MarshalJSON() ([]byte, error) { 935 objectMap := make(map[string]interface{}) 936 return json.Marshal(objectMap) 937} 938 939// OperationDisplay display metadata associated with the operation. 940type OperationDisplay struct { 941 // Provider - READ-ONLY; Operation resource provider name. 942 Provider *string `json:"provider,omitempty"` 943 // Resource - READ-ONLY; Resource on which the operation is performed. 944 Resource *string `json:"resource,omitempty"` 945 // Operation - READ-ONLY; Localized friendly name for the operation. 946 Operation *string `json:"operation,omitempty"` 947 // Description - READ-ONLY; Operation description. 948 Description *string `json:"description,omitempty"` 949} 950 951// MarshalJSON is the custom marshaler for OperationDisplay. 952func (od OperationDisplay) MarshalJSON() ([]byte, error) { 953 objectMap := make(map[string]interface{}) 954 return json.Marshal(objectMap) 955} 956 957// OperationListResult a list of resource provider operations. 958type OperationListResult struct { 959 autorest.Response `json:"-"` 960 // Value - The list of resource provider operations. 961 Value *[]Operation `json:"value,omitempty"` 962} 963 964// PerformanceTierListResult a list of performance tiers. 965type PerformanceTierListResult struct { 966 autorest.Response `json:"-"` 967 // Value - The list of performance tiers 968 Value *[]PerformanceTierProperties `json:"value,omitempty"` 969} 970 971// PerformanceTierProperties performance tier properties 972type PerformanceTierProperties struct { 973 // ID - ID of the performance tier. 974 ID *string `json:"id,omitempty"` 975 // MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition 976 MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"` 977 // MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition 978 MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"` 979 // MaxStorageMB - Max storage allowed for a server. 980 MaxStorageMB *int32 `json:"maxStorageMB,omitempty"` 981 // MinLargeStorageMB - Max storage allowed for a server. 982 MinLargeStorageMB *int32 `json:"minLargeStorageMB,omitempty"` 983 // MaxLargeStorageMB - Max storage allowed for a server. 984 MaxLargeStorageMB *int32 `json:"maxLargeStorageMB,omitempty"` 985 // MinStorageMB - Max storage allowed for a server. 986 MinStorageMB *int32 `json:"minStorageMB,omitempty"` 987 // ServiceLevelObjectives - Service level objectives associated with the performance tier 988 ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"` 989} 990 991// PerformanceTierServiceLevelObjectives service level objectives for performance tier. 992type PerformanceTierServiceLevelObjectives struct { 993 // ID - ID for the service level objective. 994 ID *string `json:"id,omitempty"` 995 // Edition - Edition of the performance tier. 996 Edition *string `json:"edition,omitempty"` 997 // VCore - vCore associated with the service level objective 998 VCore *int32 `json:"vCore,omitempty"` 999 // HardwareGeneration - Hardware generation associated with the service level objective 1000 HardwareGeneration *string `json:"hardwareGeneration,omitempty"` 1001 // MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition 1002 MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"` 1003 // MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition 1004 MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"` 1005 // MaxStorageMB - Max storage allowed for a server. 1006 MaxStorageMB *int32 `json:"maxStorageMB,omitempty"` 1007 // MinStorageMB - Max storage allowed for a server. 1008 MinStorageMB *int32 `json:"minStorageMB,omitempty"` 1009} 1010 1011// PrivateEndpointConnection a private endpoint connection 1012type PrivateEndpointConnection struct { 1013 autorest.Response `json:"-"` 1014 // PrivateEndpointConnectionProperties - Resource properties. 1015 *PrivateEndpointConnectionProperties `json:"properties,omitempty"` 1016 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1017 ID *string `json:"id,omitempty"` 1018 // Name - READ-ONLY; The name of the resource 1019 Name *string `json:"name,omitempty"` 1020 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1021 Type *string `json:"type,omitempty"` 1022} 1023 1024// MarshalJSON is the custom marshaler for PrivateEndpointConnection. 1025func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { 1026 objectMap := make(map[string]interface{}) 1027 if pec.PrivateEndpointConnectionProperties != nil { 1028 objectMap["properties"] = pec.PrivateEndpointConnectionProperties 1029 } 1030 return json.Marshal(objectMap) 1031} 1032 1033// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. 1034func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { 1035 var m map[string]*json.RawMessage 1036 err := json.Unmarshal(body, &m) 1037 if err != nil { 1038 return err 1039 } 1040 for k, v := range m { 1041 switch k { 1042 case "properties": 1043 if v != nil { 1044 var privateEndpointConnectionProperties PrivateEndpointConnectionProperties 1045 err = json.Unmarshal(*v, &privateEndpointConnectionProperties) 1046 if err != nil { 1047 return err 1048 } 1049 pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties 1050 } 1051 case "id": 1052 if v != nil { 1053 var ID string 1054 err = json.Unmarshal(*v, &ID) 1055 if err != nil { 1056 return err 1057 } 1058 pec.ID = &ID 1059 } 1060 case "name": 1061 if v != nil { 1062 var name string 1063 err = json.Unmarshal(*v, &name) 1064 if err != nil { 1065 return err 1066 } 1067 pec.Name = &name 1068 } 1069 case "type": 1070 if v != nil { 1071 var typeVar string 1072 err = json.Unmarshal(*v, &typeVar) 1073 if err != nil { 1074 return err 1075 } 1076 pec.Type = &typeVar 1077 } 1078 } 1079 } 1080 1081 return nil 1082} 1083 1084// PrivateEndpointConnectionListResult a list of private endpoint connections. 1085type PrivateEndpointConnectionListResult struct { 1086 autorest.Response `json:"-"` 1087 // Value - READ-ONLY; Array of results. 1088 Value *[]PrivateEndpointConnection `json:"value,omitempty"` 1089 // NextLink - READ-ONLY; Link to retrieve next page of results. 1090 NextLink *string `json:"nextLink,omitempty"` 1091} 1092 1093// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. 1094func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { 1095 objectMap := make(map[string]interface{}) 1096 return json.Marshal(objectMap) 1097} 1098 1099// PrivateEndpointConnectionListResultIterator provides access to a complete listing of 1100// PrivateEndpointConnection values. 1101type PrivateEndpointConnectionListResultIterator struct { 1102 i int 1103 page PrivateEndpointConnectionListResultPage 1104} 1105 1106// NextWithContext advances to the next value. If there was an error making 1107// the request the iterator does not advance and the error is returned. 1108func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { 1109 if tracing.IsEnabled() { 1110 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") 1111 defer func() { 1112 sc := -1 1113 if iter.Response().Response.Response != nil { 1114 sc = iter.Response().Response.Response.StatusCode 1115 } 1116 tracing.EndSpan(ctx, sc, err) 1117 }() 1118 } 1119 iter.i++ 1120 if iter.i < len(iter.page.Values()) { 1121 return nil 1122 } 1123 err = iter.page.NextWithContext(ctx) 1124 if err != nil { 1125 iter.i-- 1126 return err 1127 } 1128 iter.i = 0 1129 return nil 1130} 1131 1132// Next advances to the next value. If there was an error making 1133// the request the iterator does not advance and the error is returned. 1134// Deprecated: Use NextWithContext() instead. 1135func (iter *PrivateEndpointConnectionListResultIterator) Next() error { 1136 return iter.NextWithContext(context.Background()) 1137} 1138 1139// NotDone returns true if the enumeration should be started or is not yet complete. 1140func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { 1141 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1142} 1143 1144// Response returns the raw server response from the last page request. 1145func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { 1146 return iter.page.Response() 1147} 1148 1149// Value returns the current value or a zero-initialized value if the 1150// iterator has advanced beyond the end of the collection. 1151func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { 1152 if !iter.page.NotDone() { 1153 return PrivateEndpointConnection{} 1154 } 1155 return iter.page.Values()[iter.i] 1156} 1157 1158// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. 1159func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { 1160 return PrivateEndpointConnectionListResultIterator{page: page} 1161} 1162 1163// IsEmpty returns true if the ListResult contains no values. 1164func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { 1165 return peclr.Value == nil || len(*peclr.Value) == 0 1166} 1167 1168// hasNextLink returns true if the NextLink is not empty. 1169func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { 1170 return peclr.NextLink != nil && len(*peclr.NextLink) != 0 1171} 1172 1173// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. 1174// It returns nil if no more results exist. 1175func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { 1176 if !peclr.hasNextLink() { 1177 return nil, nil 1178 } 1179 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1180 autorest.AsJSON(), 1181 autorest.AsGet(), 1182 autorest.WithBaseURL(to.String(peclr.NextLink))) 1183} 1184 1185// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. 1186type PrivateEndpointConnectionListResultPage struct { 1187 fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) 1188 peclr PrivateEndpointConnectionListResult 1189} 1190 1191// NextWithContext advances to the next page of values. If there was an error making 1192// the request the page does not advance and the error is returned. 1193func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { 1194 if tracing.IsEnabled() { 1195 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") 1196 defer func() { 1197 sc := -1 1198 if page.Response().Response.Response != nil { 1199 sc = page.Response().Response.Response.StatusCode 1200 } 1201 tracing.EndSpan(ctx, sc, err) 1202 }() 1203 } 1204 for { 1205 next, err := page.fn(ctx, page.peclr) 1206 if err != nil { 1207 return err 1208 } 1209 page.peclr = next 1210 if !next.hasNextLink() || !next.IsEmpty() { 1211 break 1212 } 1213 } 1214 return nil 1215} 1216 1217// Next advances to the next page of values. If there was an error making 1218// the request the page does not advance and the error is returned. 1219// Deprecated: Use NextWithContext() instead. 1220func (page *PrivateEndpointConnectionListResultPage) Next() error { 1221 return page.NextWithContext(context.Background()) 1222} 1223 1224// NotDone returns true if the page enumeration should be started or is not yet complete. 1225func (page PrivateEndpointConnectionListResultPage) NotDone() bool { 1226 return !page.peclr.IsEmpty() 1227} 1228 1229// Response returns the raw server response from the last page request. 1230func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { 1231 return page.peclr 1232} 1233 1234// Values returns the slice of values for the current page or nil if there are no values. 1235func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { 1236 if page.peclr.IsEmpty() { 1237 return nil 1238 } 1239 return *page.peclr.Value 1240} 1241 1242// Creates a new instance of the PrivateEndpointConnectionListResultPage type. 1243func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { 1244 return PrivateEndpointConnectionListResultPage{ 1245 fn: getNextPage, 1246 peclr: cur, 1247 } 1248} 1249 1250// PrivateEndpointConnectionProperties properties of a private endpoint connection. 1251type PrivateEndpointConnectionProperties struct { 1252 // PrivateEndpoint - Private endpoint which the connection belongs to. 1253 PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` 1254 // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. 1255 PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` 1256 // ProvisioningState - READ-ONLY; State of the private endpoint connection. 1257 ProvisioningState *string `json:"provisioningState,omitempty"` 1258} 1259 1260// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. 1261func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { 1262 objectMap := make(map[string]interface{}) 1263 if pecp.PrivateEndpoint != nil { 1264 objectMap["privateEndpoint"] = pecp.PrivateEndpoint 1265 } 1266 if pecp.PrivateLinkServiceConnectionState != nil { 1267 objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState 1268 } 1269 return json.Marshal(objectMap) 1270} 1271 1272// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 1273// of a long-running operation. 1274type PrivateEndpointConnectionsCreateOrUpdateFuture struct { 1275 azure.FutureAPI 1276 // Result returns the result of the asynchronous operation. 1277 // If the operation has not completed it will return an error. 1278 Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) 1279} 1280 1281// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1282func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1283 var azFuture azure.Future 1284 if err := json.Unmarshal(body, &azFuture); err != nil { 1285 return err 1286 } 1287 future.FutureAPI = &azFuture 1288 future.Result = future.result 1289 return nil 1290} 1291 1292// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. 1293func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { 1294 var done bool 1295 done, err = future.DoneWithContext(context.Background(), client) 1296 if err != nil { 1297 err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1298 return 1299 } 1300 if !done { 1301 pec.Response.Response = future.Response() 1302 err = azure.NewAsyncOpIncompleteError("mysql.PrivateEndpointConnectionsCreateOrUpdateFuture") 1303 return 1304 } 1305 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1306 if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { 1307 pec, err = client.CreateOrUpdateResponder(pec.Response.Response) 1308 if err != nil { 1309 err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") 1310 } 1311 } 1312 return 1313} 1314 1315// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a 1316// long-running operation. 1317type PrivateEndpointConnectionsDeleteFuture struct { 1318 azure.FutureAPI 1319 // Result returns the result of the asynchronous operation. 1320 // If the operation has not completed it will return an error. 1321 Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) 1322} 1323 1324// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1325func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { 1326 var azFuture azure.Future 1327 if err := json.Unmarshal(body, &azFuture); err != nil { 1328 return err 1329 } 1330 future.FutureAPI = &azFuture 1331 future.Result = future.result 1332 return nil 1333} 1334 1335// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. 1336func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { 1337 var done bool 1338 done, err = future.DoneWithContext(context.Background(), client) 1339 if err != nil { 1340 err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") 1341 return 1342 } 1343 if !done { 1344 ar.Response = future.Response() 1345 err = azure.NewAsyncOpIncompleteError("mysql.PrivateEndpointConnectionsDeleteFuture") 1346 return 1347 } 1348 ar.Response = future.Response() 1349 return 1350} 1351 1352// PrivateEndpointConnectionsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a 1353// long-running operation. 1354type PrivateEndpointConnectionsUpdateTagsFuture struct { 1355 azure.FutureAPI 1356 // Result returns the result of the asynchronous operation. 1357 // If the operation has not completed it will return an error. 1358 Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) 1359} 1360 1361// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1362func (future *PrivateEndpointConnectionsUpdateTagsFuture) UnmarshalJSON(body []byte) error { 1363 var azFuture azure.Future 1364 if err := json.Unmarshal(body, &azFuture); err != nil { 1365 return err 1366 } 1367 future.FutureAPI = &azFuture 1368 future.Result = future.result 1369 return nil 1370} 1371 1372// result is the default implementation for PrivateEndpointConnectionsUpdateTagsFuture.Result. 1373func (future *PrivateEndpointConnectionsUpdateTagsFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { 1374 var done bool 1375 done, err = future.DoneWithContext(context.Background(), client) 1376 if err != nil { 1377 err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsUpdateTagsFuture", "Result", future.Response(), "Polling failure") 1378 return 1379 } 1380 if !done { 1381 pec.Response.Response = future.Response() 1382 err = azure.NewAsyncOpIncompleteError("mysql.PrivateEndpointConnectionsUpdateTagsFuture") 1383 return 1384 } 1385 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1386 if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { 1387 pec, err = client.UpdateTagsResponder(pec.Response.Response) 1388 if err != nil { 1389 err = autorest.NewErrorWithError(err, "mysql.PrivateEndpointConnectionsUpdateTagsFuture", "Result", pec.Response.Response, "Failure responding to request") 1390 } 1391 } 1392 return 1393} 1394 1395// PrivateEndpointProperty ... 1396type PrivateEndpointProperty struct { 1397 // ID - Resource id of the private endpoint. 1398 ID *string `json:"id,omitempty"` 1399} 1400 1401// PrivateLinkResource a private link resource 1402type PrivateLinkResource struct { 1403 autorest.Response `json:"-"` 1404 // Properties - READ-ONLY; The private link resource group id. 1405 Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` 1406 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1407 ID *string `json:"id,omitempty"` 1408 // Name - READ-ONLY; The name of the resource 1409 Name *string `json:"name,omitempty"` 1410 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1411 Type *string `json:"type,omitempty"` 1412} 1413 1414// MarshalJSON is the custom marshaler for PrivateLinkResource. 1415func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { 1416 objectMap := make(map[string]interface{}) 1417 return json.Marshal(objectMap) 1418} 1419 1420// PrivateLinkResourceListResult a list of private link resources 1421type PrivateLinkResourceListResult struct { 1422 autorest.Response `json:"-"` 1423 // Value - READ-ONLY; Array of results. 1424 Value *[]PrivateLinkResource `json:"value,omitempty"` 1425 // NextLink - READ-ONLY; Link to retrieve next page of results. 1426 NextLink *string `json:"nextLink,omitempty"` 1427} 1428 1429// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. 1430func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { 1431 objectMap := make(map[string]interface{}) 1432 return json.Marshal(objectMap) 1433} 1434 1435// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource 1436// values. 1437type PrivateLinkResourceListResultIterator struct { 1438 i int 1439 page PrivateLinkResourceListResultPage 1440} 1441 1442// NextWithContext advances to the next value. If there was an error making 1443// the request the iterator does not advance and the error is returned. 1444func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { 1445 if tracing.IsEnabled() { 1446 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext") 1447 defer func() { 1448 sc := -1 1449 if iter.Response().Response.Response != nil { 1450 sc = iter.Response().Response.Response.StatusCode 1451 } 1452 tracing.EndSpan(ctx, sc, err) 1453 }() 1454 } 1455 iter.i++ 1456 if iter.i < len(iter.page.Values()) { 1457 return nil 1458 } 1459 err = iter.page.NextWithContext(ctx) 1460 if err != nil { 1461 iter.i-- 1462 return err 1463 } 1464 iter.i = 0 1465 return nil 1466} 1467 1468// Next advances to the next value. If there was an error making 1469// the request the iterator does not advance and the error is returned. 1470// Deprecated: Use NextWithContext() instead. 1471func (iter *PrivateLinkResourceListResultIterator) Next() error { 1472 return iter.NextWithContext(context.Background()) 1473} 1474 1475// NotDone returns true if the enumeration should be started or is not yet complete. 1476func (iter PrivateLinkResourceListResultIterator) NotDone() bool { 1477 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1478} 1479 1480// Response returns the raw server response from the last page request. 1481func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { 1482 return iter.page.Response() 1483} 1484 1485// Value returns the current value or a zero-initialized value if the 1486// iterator has advanced beyond the end of the collection. 1487func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { 1488 if !iter.page.NotDone() { 1489 return PrivateLinkResource{} 1490 } 1491 return iter.page.Values()[iter.i] 1492} 1493 1494// Creates a new instance of the PrivateLinkResourceListResultIterator type. 1495func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { 1496 return PrivateLinkResourceListResultIterator{page: page} 1497} 1498 1499// IsEmpty returns true if the ListResult contains no values. 1500func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { 1501 return plrlr.Value == nil || len(*plrlr.Value) == 0 1502} 1503 1504// hasNextLink returns true if the NextLink is not empty. 1505func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { 1506 return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 1507} 1508 1509// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. 1510// It returns nil if no more results exist. 1511func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { 1512 if !plrlr.hasNextLink() { 1513 return nil, nil 1514 } 1515 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1516 autorest.AsJSON(), 1517 autorest.AsGet(), 1518 autorest.WithBaseURL(to.String(plrlr.NextLink))) 1519} 1520 1521// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. 1522type PrivateLinkResourceListResultPage struct { 1523 fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) 1524 plrlr PrivateLinkResourceListResult 1525} 1526 1527// NextWithContext advances to the next page of values. If there was an error making 1528// the request the page does not advance and the error is returned. 1529func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { 1530 if tracing.IsEnabled() { 1531 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext") 1532 defer func() { 1533 sc := -1 1534 if page.Response().Response.Response != nil { 1535 sc = page.Response().Response.Response.StatusCode 1536 } 1537 tracing.EndSpan(ctx, sc, err) 1538 }() 1539 } 1540 for { 1541 next, err := page.fn(ctx, page.plrlr) 1542 if err != nil { 1543 return err 1544 } 1545 page.plrlr = next 1546 if !next.hasNextLink() || !next.IsEmpty() { 1547 break 1548 } 1549 } 1550 return nil 1551} 1552 1553// Next advances to the next page of values. If there was an error making 1554// the request the page does not advance and the error is returned. 1555// Deprecated: Use NextWithContext() instead. 1556func (page *PrivateLinkResourceListResultPage) Next() error { 1557 return page.NextWithContext(context.Background()) 1558} 1559 1560// NotDone returns true if the page enumeration should be started or is not yet complete. 1561func (page PrivateLinkResourceListResultPage) NotDone() bool { 1562 return !page.plrlr.IsEmpty() 1563} 1564 1565// Response returns the raw server response from the last page request. 1566func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { 1567 return page.plrlr 1568} 1569 1570// Values returns the slice of values for the current page or nil if there are no values. 1571func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { 1572 if page.plrlr.IsEmpty() { 1573 return nil 1574 } 1575 return *page.plrlr.Value 1576} 1577 1578// Creates a new instance of the PrivateLinkResourceListResultPage type. 1579func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { 1580 return PrivateLinkResourceListResultPage{ 1581 fn: getNextPage, 1582 plrlr: cur, 1583 } 1584} 1585 1586// PrivateLinkResourceProperties properties of a private link resource. 1587type PrivateLinkResourceProperties struct { 1588 // GroupID - READ-ONLY; The private link resource group id. 1589 GroupID *string `json:"groupId,omitempty"` 1590 // RequiredMembers - READ-ONLY; The private link resource required member names. 1591 RequiredMembers *[]string `json:"requiredMembers,omitempty"` 1592} 1593 1594// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. 1595func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { 1596 objectMap := make(map[string]interface{}) 1597 return json.Marshal(objectMap) 1598} 1599 1600// PrivateLinkServiceConnectionStateProperty ... 1601type PrivateLinkServiceConnectionStateProperty struct { 1602 // Status - The private link service connection status. 1603 Status *string `json:"status,omitempty"` 1604 // Description - The private link service connection description. 1605 Description *string `json:"description,omitempty"` 1606 // ActionsRequired - READ-ONLY; The actions required for private link service connection. 1607 ActionsRequired *string `json:"actionsRequired,omitempty"` 1608} 1609 1610// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. 1611func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { 1612 objectMap := make(map[string]interface{}) 1613 if plscsp.Status != nil { 1614 objectMap["status"] = plscsp.Status 1615 } 1616 if plscsp.Description != nil { 1617 objectMap["description"] = plscsp.Description 1618 } 1619 return json.Marshal(objectMap) 1620} 1621 1622// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not 1623// have tags and a location 1624type ProxyResource struct { 1625 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1626 ID *string `json:"id,omitempty"` 1627 // Name - READ-ONLY; The name of the resource 1628 Name *string `json:"name,omitempty"` 1629 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1630 Type *string `json:"type,omitempty"` 1631} 1632 1633// MarshalJSON is the custom marshaler for ProxyResource. 1634func (pr ProxyResource) MarshalJSON() ([]byte, error) { 1635 objectMap := make(map[string]interface{}) 1636 return json.Marshal(objectMap) 1637} 1638 1639// QueryPerformanceInsightResetDataResult result of Query Performance Insight data reset. 1640type QueryPerformanceInsightResetDataResult struct { 1641 autorest.Response `json:"-"` 1642 // Status - Indicates result of the operation. Possible values include: 'QueryPerformanceInsightResetDataResultStateSucceeded', 'QueryPerformanceInsightResetDataResultStateFailed' 1643 Status QueryPerformanceInsightResetDataResultState `json:"status,omitempty"` 1644 // Message - operation message. 1645 Message *string `json:"message,omitempty"` 1646} 1647 1648// QueryStatistic represents a Query Statistic. 1649type QueryStatistic struct { 1650 autorest.Response `json:"-"` 1651 // QueryStatisticProperties - The properties of a query statistic. 1652 *QueryStatisticProperties `json:"properties,omitempty"` 1653 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1654 ID *string `json:"id,omitempty"` 1655 // Name - READ-ONLY; The name of the resource 1656 Name *string `json:"name,omitempty"` 1657 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1658 Type *string `json:"type,omitempty"` 1659} 1660 1661// MarshalJSON is the custom marshaler for QueryStatistic. 1662func (qs QueryStatistic) MarshalJSON() ([]byte, error) { 1663 objectMap := make(map[string]interface{}) 1664 if qs.QueryStatisticProperties != nil { 1665 objectMap["properties"] = qs.QueryStatisticProperties 1666 } 1667 return json.Marshal(objectMap) 1668} 1669 1670// UnmarshalJSON is the custom unmarshaler for QueryStatistic struct. 1671func (qs *QueryStatistic) UnmarshalJSON(body []byte) error { 1672 var m map[string]*json.RawMessage 1673 err := json.Unmarshal(body, &m) 1674 if err != nil { 1675 return err 1676 } 1677 for k, v := range m { 1678 switch k { 1679 case "properties": 1680 if v != nil { 1681 var queryStatisticProperties QueryStatisticProperties 1682 err = json.Unmarshal(*v, &queryStatisticProperties) 1683 if err != nil { 1684 return err 1685 } 1686 qs.QueryStatisticProperties = &queryStatisticProperties 1687 } 1688 case "id": 1689 if v != nil { 1690 var ID string 1691 err = json.Unmarshal(*v, &ID) 1692 if err != nil { 1693 return err 1694 } 1695 qs.ID = &ID 1696 } 1697 case "name": 1698 if v != nil { 1699 var name string 1700 err = json.Unmarshal(*v, &name) 1701 if err != nil { 1702 return err 1703 } 1704 qs.Name = &name 1705 } 1706 case "type": 1707 if v != nil { 1708 var typeVar string 1709 err = json.Unmarshal(*v, &typeVar) 1710 if err != nil { 1711 return err 1712 } 1713 qs.Type = &typeVar 1714 } 1715 } 1716 } 1717 1718 return nil 1719} 1720 1721// QueryStatisticProperties the properties of a query statistic. 1722type QueryStatisticProperties struct { 1723 // QueryID - Database query identifier. 1724 QueryID *string `json:"queryId,omitempty"` 1725 // StartTime - Observation start time. 1726 StartTime *date.Time `json:"startTime,omitempty"` 1727 // EndTime - Observation end time. 1728 EndTime *date.Time `json:"endTime,omitempty"` 1729 // AggregationFunction - Aggregation function name. 1730 AggregationFunction *string `json:"aggregationFunction,omitempty"` 1731 // DatabaseNames - The list of database names. 1732 DatabaseNames *[]string `json:"databaseNames,omitempty"` 1733 // QueryExecutionCount - Number of query executions in this time interval. 1734 QueryExecutionCount *int64 `json:"queryExecutionCount,omitempty"` 1735 // MetricName - Metric name. 1736 MetricName *string `json:"metricName,omitempty"` 1737 // MetricDisplayName - Metric display name. 1738 MetricDisplayName *string `json:"metricDisplayName,omitempty"` 1739 // MetricValue - Metric value. 1740 MetricValue *float64 `json:"metricValue,omitempty"` 1741 // MetricValueUnit - Metric value unit. 1742 MetricValueUnit *string `json:"metricValueUnit,omitempty"` 1743} 1744 1745// QueryText represents a Query Text. 1746type QueryText struct { 1747 autorest.Response `json:"-"` 1748 // QueryTextProperties - The properties of a query text. 1749 *QueryTextProperties `json:"properties,omitempty"` 1750 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1751 ID *string `json:"id,omitempty"` 1752 // Name - READ-ONLY; The name of the resource 1753 Name *string `json:"name,omitempty"` 1754 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1755 Type *string `json:"type,omitempty"` 1756} 1757 1758// MarshalJSON is the custom marshaler for QueryText. 1759func (qt QueryText) MarshalJSON() ([]byte, error) { 1760 objectMap := make(map[string]interface{}) 1761 if qt.QueryTextProperties != nil { 1762 objectMap["properties"] = qt.QueryTextProperties 1763 } 1764 return json.Marshal(objectMap) 1765} 1766 1767// UnmarshalJSON is the custom unmarshaler for QueryText struct. 1768func (qt *QueryText) UnmarshalJSON(body []byte) error { 1769 var m map[string]*json.RawMessage 1770 err := json.Unmarshal(body, &m) 1771 if err != nil { 1772 return err 1773 } 1774 for k, v := range m { 1775 switch k { 1776 case "properties": 1777 if v != nil { 1778 var queryTextProperties QueryTextProperties 1779 err = json.Unmarshal(*v, &queryTextProperties) 1780 if err != nil { 1781 return err 1782 } 1783 qt.QueryTextProperties = &queryTextProperties 1784 } 1785 case "id": 1786 if v != nil { 1787 var ID string 1788 err = json.Unmarshal(*v, &ID) 1789 if err != nil { 1790 return err 1791 } 1792 qt.ID = &ID 1793 } 1794 case "name": 1795 if v != nil { 1796 var name string 1797 err = json.Unmarshal(*v, &name) 1798 if err != nil { 1799 return err 1800 } 1801 qt.Name = &name 1802 } 1803 case "type": 1804 if v != nil { 1805 var typeVar string 1806 err = json.Unmarshal(*v, &typeVar) 1807 if err != nil { 1808 return err 1809 } 1810 qt.Type = &typeVar 1811 } 1812 } 1813 } 1814 1815 return nil 1816} 1817 1818// QueryTextProperties the properties of a query text. 1819type QueryTextProperties struct { 1820 // QueryID - Query identifier unique to the server. 1821 QueryID *string `json:"queryId,omitempty"` 1822 // QueryText - Query text. 1823 QueryText *string `json:"queryText,omitempty"` 1824} 1825 1826// QueryTextsResultList a list of query texts. 1827type QueryTextsResultList struct { 1828 autorest.Response `json:"-"` 1829 // Value - READ-ONLY; The list of query texts. 1830 Value *[]QueryText `json:"value,omitempty"` 1831 // NextLink - READ-ONLY; Link to retrieve next page of results. 1832 NextLink *string `json:"nextLink,omitempty"` 1833} 1834 1835// MarshalJSON is the custom marshaler for QueryTextsResultList. 1836func (qtrl QueryTextsResultList) MarshalJSON() ([]byte, error) { 1837 objectMap := make(map[string]interface{}) 1838 return json.Marshal(objectMap) 1839} 1840 1841// QueryTextsResultListIterator provides access to a complete listing of QueryText values. 1842type QueryTextsResultListIterator struct { 1843 i int 1844 page QueryTextsResultListPage 1845} 1846 1847// NextWithContext advances to the next value. If there was an error making 1848// the request the iterator does not advance and the error is returned. 1849func (iter *QueryTextsResultListIterator) NextWithContext(ctx context.Context) (err error) { 1850 if tracing.IsEnabled() { 1851 ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsResultListIterator.NextWithContext") 1852 defer func() { 1853 sc := -1 1854 if iter.Response().Response.Response != nil { 1855 sc = iter.Response().Response.Response.StatusCode 1856 } 1857 tracing.EndSpan(ctx, sc, err) 1858 }() 1859 } 1860 iter.i++ 1861 if iter.i < len(iter.page.Values()) { 1862 return nil 1863 } 1864 err = iter.page.NextWithContext(ctx) 1865 if err != nil { 1866 iter.i-- 1867 return err 1868 } 1869 iter.i = 0 1870 return nil 1871} 1872 1873// Next advances to the next value. If there was an error making 1874// the request the iterator does not advance and the error is returned. 1875// Deprecated: Use NextWithContext() instead. 1876func (iter *QueryTextsResultListIterator) Next() error { 1877 return iter.NextWithContext(context.Background()) 1878} 1879 1880// NotDone returns true if the enumeration should be started or is not yet complete. 1881func (iter QueryTextsResultListIterator) NotDone() bool { 1882 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1883} 1884 1885// Response returns the raw server response from the last page request. 1886func (iter QueryTextsResultListIterator) Response() QueryTextsResultList { 1887 return iter.page.Response() 1888} 1889 1890// Value returns the current value or a zero-initialized value if the 1891// iterator has advanced beyond the end of the collection. 1892func (iter QueryTextsResultListIterator) Value() QueryText { 1893 if !iter.page.NotDone() { 1894 return QueryText{} 1895 } 1896 return iter.page.Values()[iter.i] 1897} 1898 1899// Creates a new instance of the QueryTextsResultListIterator type. 1900func NewQueryTextsResultListIterator(page QueryTextsResultListPage) QueryTextsResultListIterator { 1901 return QueryTextsResultListIterator{page: page} 1902} 1903 1904// IsEmpty returns true if the ListResult contains no values. 1905func (qtrl QueryTextsResultList) IsEmpty() bool { 1906 return qtrl.Value == nil || len(*qtrl.Value) == 0 1907} 1908 1909// hasNextLink returns true if the NextLink is not empty. 1910func (qtrl QueryTextsResultList) hasNextLink() bool { 1911 return qtrl.NextLink != nil && len(*qtrl.NextLink) != 0 1912} 1913 1914// queryTextsResultListPreparer prepares a request to retrieve the next set of results. 1915// It returns nil if no more results exist. 1916func (qtrl QueryTextsResultList) queryTextsResultListPreparer(ctx context.Context) (*http.Request, error) { 1917 if !qtrl.hasNextLink() { 1918 return nil, nil 1919 } 1920 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1921 autorest.AsJSON(), 1922 autorest.AsGet(), 1923 autorest.WithBaseURL(to.String(qtrl.NextLink))) 1924} 1925 1926// QueryTextsResultListPage contains a page of QueryText values. 1927type QueryTextsResultListPage struct { 1928 fn func(context.Context, QueryTextsResultList) (QueryTextsResultList, error) 1929 qtrl QueryTextsResultList 1930} 1931 1932// NextWithContext advances to the next page of values. If there was an error making 1933// the request the page does not advance and the error is returned. 1934func (page *QueryTextsResultListPage) NextWithContext(ctx context.Context) (err error) { 1935 if tracing.IsEnabled() { 1936 ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsResultListPage.NextWithContext") 1937 defer func() { 1938 sc := -1 1939 if page.Response().Response.Response != nil { 1940 sc = page.Response().Response.Response.StatusCode 1941 } 1942 tracing.EndSpan(ctx, sc, err) 1943 }() 1944 } 1945 for { 1946 next, err := page.fn(ctx, page.qtrl) 1947 if err != nil { 1948 return err 1949 } 1950 page.qtrl = next 1951 if !next.hasNextLink() || !next.IsEmpty() { 1952 break 1953 } 1954 } 1955 return nil 1956} 1957 1958// Next advances to the next page of values. If there was an error making 1959// the request the page does not advance and the error is returned. 1960// Deprecated: Use NextWithContext() instead. 1961func (page *QueryTextsResultListPage) Next() error { 1962 return page.NextWithContext(context.Background()) 1963} 1964 1965// NotDone returns true if the page enumeration should be started or is not yet complete. 1966func (page QueryTextsResultListPage) NotDone() bool { 1967 return !page.qtrl.IsEmpty() 1968} 1969 1970// Response returns the raw server response from the last page request. 1971func (page QueryTextsResultListPage) Response() QueryTextsResultList { 1972 return page.qtrl 1973} 1974 1975// Values returns the slice of values for the current page or nil if there are no values. 1976func (page QueryTextsResultListPage) Values() []QueryText { 1977 if page.qtrl.IsEmpty() { 1978 return nil 1979 } 1980 return *page.qtrl.Value 1981} 1982 1983// Creates a new instance of the QueryTextsResultListPage type. 1984func NewQueryTextsResultListPage(cur QueryTextsResultList, getNextPage func(context.Context, QueryTextsResultList) (QueryTextsResultList, error)) QueryTextsResultListPage { 1985 return QueryTextsResultListPage{ 1986 fn: getNextPage, 1987 qtrl: cur, 1988 } 1989} 1990 1991// RecommendationAction represents a Recommendation Action. 1992type RecommendationAction struct { 1993 autorest.Response `json:"-"` 1994 // RecommendationActionProperties - The properties of a recommendation action. 1995 *RecommendationActionProperties `json:"properties,omitempty"` 1996 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1997 ID *string `json:"id,omitempty"` 1998 // Name - READ-ONLY; The name of the resource 1999 Name *string `json:"name,omitempty"` 2000 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2001 Type *string `json:"type,omitempty"` 2002} 2003 2004// MarshalJSON is the custom marshaler for RecommendationAction. 2005func (ra RecommendationAction) MarshalJSON() ([]byte, error) { 2006 objectMap := make(map[string]interface{}) 2007 if ra.RecommendationActionProperties != nil { 2008 objectMap["properties"] = ra.RecommendationActionProperties 2009 } 2010 return json.Marshal(objectMap) 2011} 2012 2013// UnmarshalJSON is the custom unmarshaler for RecommendationAction struct. 2014func (ra *RecommendationAction) UnmarshalJSON(body []byte) error { 2015 var m map[string]*json.RawMessage 2016 err := json.Unmarshal(body, &m) 2017 if err != nil { 2018 return err 2019 } 2020 for k, v := range m { 2021 switch k { 2022 case "properties": 2023 if v != nil { 2024 var recommendationActionProperties RecommendationActionProperties 2025 err = json.Unmarshal(*v, &recommendationActionProperties) 2026 if err != nil { 2027 return err 2028 } 2029 ra.RecommendationActionProperties = &recommendationActionProperties 2030 } 2031 case "id": 2032 if v != nil { 2033 var ID string 2034 err = json.Unmarshal(*v, &ID) 2035 if err != nil { 2036 return err 2037 } 2038 ra.ID = &ID 2039 } 2040 case "name": 2041 if v != nil { 2042 var name string 2043 err = json.Unmarshal(*v, &name) 2044 if err != nil { 2045 return err 2046 } 2047 ra.Name = &name 2048 } 2049 case "type": 2050 if v != nil { 2051 var typeVar string 2052 err = json.Unmarshal(*v, &typeVar) 2053 if err != nil { 2054 return err 2055 } 2056 ra.Type = &typeVar 2057 } 2058 } 2059 } 2060 2061 return nil 2062} 2063 2064// RecommendationActionProperties the properties of a recommendation action. 2065type RecommendationActionProperties struct { 2066 // AdvisorName - Advisor name. 2067 AdvisorName *string `json:"advisorName,omitempty"` 2068 // SessionID - Recommendation action session identifier. 2069 SessionID *string `json:"sessionId,omitempty"` 2070 // ActionID - Recommendation action identifier. 2071 ActionID *int32 `json:"actionId,omitempty"` 2072 // CreatedTime - Recommendation action creation time. 2073 CreatedTime *date.Time `json:"createdTime,omitempty"` 2074 // ExpirationTime - Recommendation action expiration time. 2075 ExpirationTime *date.Time `json:"expirationTime,omitempty"` 2076 // Reason - Recommendation action reason. 2077 Reason *string `json:"reason,omitempty"` 2078 // RecommendationType - Recommendation action type. 2079 RecommendationType *string `json:"recommendationType,omitempty"` 2080 // Details - Recommendation action details. 2081 Details map[string]*string `json:"details"` 2082} 2083 2084// MarshalJSON is the custom marshaler for RecommendationActionProperties. 2085func (rap RecommendationActionProperties) MarshalJSON() ([]byte, error) { 2086 objectMap := make(map[string]interface{}) 2087 if rap.AdvisorName != nil { 2088 objectMap["advisorName"] = rap.AdvisorName 2089 } 2090 if rap.SessionID != nil { 2091 objectMap["sessionId"] = rap.SessionID 2092 } 2093 if rap.ActionID != nil { 2094 objectMap["actionId"] = rap.ActionID 2095 } 2096 if rap.CreatedTime != nil { 2097 objectMap["createdTime"] = rap.CreatedTime 2098 } 2099 if rap.ExpirationTime != nil { 2100 objectMap["expirationTime"] = rap.ExpirationTime 2101 } 2102 if rap.Reason != nil { 2103 objectMap["reason"] = rap.Reason 2104 } 2105 if rap.RecommendationType != nil { 2106 objectMap["recommendationType"] = rap.RecommendationType 2107 } 2108 if rap.Details != nil { 2109 objectMap["details"] = rap.Details 2110 } 2111 return json.Marshal(objectMap) 2112} 2113 2114// RecommendationActionsResultList a list of recommendation actions. 2115type RecommendationActionsResultList struct { 2116 autorest.Response `json:"-"` 2117 // Value - READ-ONLY; The list of recommendation action advisors. 2118 Value *[]RecommendationAction `json:"value,omitempty"` 2119 // NextLink - READ-ONLY; Link to retrieve next page of results. 2120 NextLink *string `json:"nextLink,omitempty"` 2121} 2122 2123// MarshalJSON is the custom marshaler for RecommendationActionsResultList. 2124func (rarl RecommendationActionsResultList) MarshalJSON() ([]byte, error) { 2125 objectMap := make(map[string]interface{}) 2126 return json.Marshal(objectMap) 2127} 2128 2129// RecommendationActionsResultListIterator provides access to a complete listing of RecommendationAction 2130// values. 2131type RecommendationActionsResultListIterator struct { 2132 i int 2133 page RecommendationActionsResultListPage 2134} 2135 2136// NextWithContext advances to the next value. If there was an error making 2137// the request the iterator does not advance and the error is returned. 2138func (iter *RecommendationActionsResultListIterator) NextWithContext(ctx context.Context) (err error) { 2139 if tracing.IsEnabled() { 2140 ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationActionsResultListIterator.NextWithContext") 2141 defer func() { 2142 sc := -1 2143 if iter.Response().Response.Response != nil { 2144 sc = iter.Response().Response.Response.StatusCode 2145 } 2146 tracing.EndSpan(ctx, sc, err) 2147 }() 2148 } 2149 iter.i++ 2150 if iter.i < len(iter.page.Values()) { 2151 return nil 2152 } 2153 err = iter.page.NextWithContext(ctx) 2154 if err != nil { 2155 iter.i-- 2156 return err 2157 } 2158 iter.i = 0 2159 return nil 2160} 2161 2162// Next advances to the next value. If there was an error making 2163// the request the iterator does not advance and the error is returned. 2164// Deprecated: Use NextWithContext() instead. 2165func (iter *RecommendationActionsResultListIterator) Next() error { 2166 return iter.NextWithContext(context.Background()) 2167} 2168 2169// NotDone returns true if the enumeration should be started or is not yet complete. 2170func (iter RecommendationActionsResultListIterator) NotDone() bool { 2171 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2172} 2173 2174// Response returns the raw server response from the last page request. 2175func (iter RecommendationActionsResultListIterator) Response() RecommendationActionsResultList { 2176 return iter.page.Response() 2177} 2178 2179// Value returns the current value or a zero-initialized value if the 2180// iterator has advanced beyond the end of the collection. 2181func (iter RecommendationActionsResultListIterator) Value() RecommendationAction { 2182 if !iter.page.NotDone() { 2183 return RecommendationAction{} 2184 } 2185 return iter.page.Values()[iter.i] 2186} 2187 2188// Creates a new instance of the RecommendationActionsResultListIterator type. 2189func NewRecommendationActionsResultListIterator(page RecommendationActionsResultListPage) RecommendationActionsResultListIterator { 2190 return RecommendationActionsResultListIterator{page: page} 2191} 2192 2193// IsEmpty returns true if the ListResult contains no values. 2194func (rarl RecommendationActionsResultList) IsEmpty() bool { 2195 return rarl.Value == nil || len(*rarl.Value) == 0 2196} 2197 2198// hasNextLink returns true if the NextLink is not empty. 2199func (rarl RecommendationActionsResultList) hasNextLink() bool { 2200 return rarl.NextLink != nil && len(*rarl.NextLink) != 0 2201} 2202 2203// recommendationActionsResultListPreparer prepares a request to retrieve the next set of results. 2204// It returns nil if no more results exist. 2205func (rarl RecommendationActionsResultList) recommendationActionsResultListPreparer(ctx context.Context) (*http.Request, error) { 2206 if !rarl.hasNextLink() { 2207 return nil, nil 2208 } 2209 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2210 autorest.AsJSON(), 2211 autorest.AsGet(), 2212 autorest.WithBaseURL(to.String(rarl.NextLink))) 2213} 2214 2215// RecommendationActionsResultListPage contains a page of RecommendationAction values. 2216type RecommendationActionsResultListPage struct { 2217 fn func(context.Context, RecommendationActionsResultList) (RecommendationActionsResultList, error) 2218 rarl RecommendationActionsResultList 2219} 2220 2221// NextWithContext advances to the next page of values. If there was an error making 2222// the request the page does not advance and the error is returned. 2223func (page *RecommendationActionsResultListPage) NextWithContext(ctx context.Context) (err error) { 2224 if tracing.IsEnabled() { 2225 ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationActionsResultListPage.NextWithContext") 2226 defer func() { 2227 sc := -1 2228 if page.Response().Response.Response != nil { 2229 sc = page.Response().Response.Response.StatusCode 2230 } 2231 tracing.EndSpan(ctx, sc, err) 2232 }() 2233 } 2234 for { 2235 next, err := page.fn(ctx, page.rarl) 2236 if err != nil { 2237 return err 2238 } 2239 page.rarl = next 2240 if !next.hasNextLink() || !next.IsEmpty() { 2241 break 2242 } 2243 } 2244 return nil 2245} 2246 2247// Next advances to the next page of values. If there was an error making 2248// the request the page does not advance and the error is returned. 2249// Deprecated: Use NextWithContext() instead. 2250func (page *RecommendationActionsResultListPage) Next() error { 2251 return page.NextWithContext(context.Background()) 2252} 2253 2254// NotDone returns true if the page enumeration should be started or is not yet complete. 2255func (page RecommendationActionsResultListPage) NotDone() bool { 2256 return !page.rarl.IsEmpty() 2257} 2258 2259// Response returns the raw server response from the last page request. 2260func (page RecommendationActionsResultListPage) Response() RecommendationActionsResultList { 2261 return page.rarl 2262} 2263 2264// Values returns the slice of values for the current page or nil if there are no values. 2265func (page RecommendationActionsResultListPage) Values() []RecommendationAction { 2266 if page.rarl.IsEmpty() { 2267 return nil 2268 } 2269 return *page.rarl.Value 2270} 2271 2272// Creates a new instance of the RecommendationActionsResultListPage type. 2273func NewRecommendationActionsResultListPage(cur RecommendationActionsResultList, getNextPage func(context.Context, RecommendationActionsResultList) (RecommendationActionsResultList, error)) RecommendationActionsResultListPage { 2274 return RecommendationActionsResultListPage{ 2275 fn: getNextPage, 2276 rarl: cur, 2277 } 2278} 2279 2280// RecommendedActionSessionsOperationStatus recommendation action session operation status. 2281type RecommendedActionSessionsOperationStatus struct { 2282 autorest.Response `json:"-"` 2283 // Name - Operation identifier. 2284 Name *string `json:"name,omitempty"` 2285 // StartTime - Operation start time. 2286 StartTime *date.Time `json:"startTime,omitempty"` 2287 // Status - Operation status. 2288 Status *string `json:"status,omitempty"` 2289} 2290 2291// RecoverableServerProperties the recoverable server's properties. 2292type RecoverableServerProperties struct { 2293 // LastAvailableBackupDateTime - READ-ONLY; The last available backup date time. 2294 LastAvailableBackupDateTime *string `json:"lastAvailableBackupDateTime,omitempty"` 2295 // ServiceLevelObjective - READ-ONLY; The service level objective 2296 ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` 2297 // Edition - READ-ONLY; Edition of the performance tier. 2298 Edition *string `json:"edition,omitempty"` 2299 // VCore - READ-ONLY; vCore associated with the service level objective 2300 VCore *int32 `json:"vCore,omitempty"` 2301 // HardwareGeneration - READ-ONLY; Hardware generation associated with the service level objective 2302 HardwareGeneration *string `json:"hardwareGeneration,omitempty"` 2303 // Version - READ-ONLY; The MySQL version 2304 Version *string `json:"version,omitempty"` 2305} 2306 2307// MarshalJSON is the custom marshaler for RecoverableServerProperties. 2308func (rsp RecoverableServerProperties) MarshalJSON() ([]byte, error) { 2309 objectMap := make(map[string]interface{}) 2310 return json.Marshal(objectMap) 2311} 2312 2313// RecoverableServerResource a recoverable server resource. 2314type RecoverableServerResource struct { 2315 autorest.Response `json:"-"` 2316 // RecoverableServerProperties - Resource properties. 2317 *RecoverableServerProperties `json:"properties,omitempty"` 2318 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2319 ID *string `json:"id,omitempty"` 2320 // Name - READ-ONLY; The name of the resource 2321 Name *string `json:"name,omitempty"` 2322 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2323 Type *string `json:"type,omitempty"` 2324} 2325 2326// MarshalJSON is the custom marshaler for RecoverableServerResource. 2327func (rsr RecoverableServerResource) MarshalJSON() ([]byte, error) { 2328 objectMap := make(map[string]interface{}) 2329 if rsr.RecoverableServerProperties != nil { 2330 objectMap["properties"] = rsr.RecoverableServerProperties 2331 } 2332 return json.Marshal(objectMap) 2333} 2334 2335// UnmarshalJSON is the custom unmarshaler for RecoverableServerResource struct. 2336func (rsr *RecoverableServerResource) UnmarshalJSON(body []byte) error { 2337 var m map[string]*json.RawMessage 2338 err := json.Unmarshal(body, &m) 2339 if err != nil { 2340 return err 2341 } 2342 for k, v := range m { 2343 switch k { 2344 case "properties": 2345 if v != nil { 2346 var recoverableServerProperties RecoverableServerProperties 2347 err = json.Unmarshal(*v, &recoverableServerProperties) 2348 if err != nil { 2349 return err 2350 } 2351 rsr.RecoverableServerProperties = &recoverableServerProperties 2352 } 2353 case "id": 2354 if v != nil { 2355 var ID string 2356 err = json.Unmarshal(*v, &ID) 2357 if err != nil { 2358 return err 2359 } 2360 rsr.ID = &ID 2361 } 2362 case "name": 2363 if v != nil { 2364 var name string 2365 err = json.Unmarshal(*v, &name) 2366 if err != nil { 2367 return err 2368 } 2369 rsr.Name = &name 2370 } 2371 case "type": 2372 if v != nil { 2373 var typeVar string 2374 err = json.Unmarshal(*v, &typeVar) 2375 if err != nil { 2376 return err 2377 } 2378 rsr.Type = &typeVar 2379 } 2380 } 2381 } 2382 2383 return nil 2384} 2385 2386// Resource common fields that are returned in the response for all Azure Resource Manager resources 2387type Resource struct { 2388 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2389 ID *string `json:"id,omitempty"` 2390 // Name - READ-ONLY; The name of the resource 2391 Name *string `json:"name,omitempty"` 2392 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2393 Type *string `json:"type,omitempty"` 2394} 2395 2396// MarshalJSON is the custom marshaler for Resource. 2397func (r Resource) MarshalJSON() ([]byte, error) { 2398 objectMap := make(map[string]interface{}) 2399 return json.Marshal(objectMap) 2400} 2401 2402// ResourceIdentity azure Active Directory identity configuration for a resource. 2403type ResourceIdentity struct { 2404 // PrincipalID - READ-ONLY; The Azure Active Directory principal id. 2405 PrincipalID *uuid.UUID `json:"principalId,omitempty"` 2406 // Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned' 2407 Type IdentityType `json:"type,omitempty"` 2408 // TenantID - READ-ONLY; The Azure Active Directory tenant id. 2409 TenantID *uuid.UUID `json:"tenantId,omitempty"` 2410} 2411 2412// MarshalJSON is the custom marshaler for ResourceIdentity. 2413func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { 2414 objectMap := make(map[string]interface{}) 2415 if ri.Type != "" { 2416 objectMap["type"] = ri.Type 2417 } 2418 return json.Marshal(objectMap) 2419} 2420 2421// SecurityAlertPolicyProperties properties of a security alert policy. 2422type SecurityAlertPolicyProperties struct { 2423 // State - Specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'ServerSecurityAlertPolicyStateEnabled', 'ServerSecurityAlertPolicyStateDisabled' 2424 State ServerSecurityAlertPolicyState `json:"state,omitempty"` 2425 // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly 2426 DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` 2427 // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. 2428 EmailAddresses *[]string `json:"emailAddresses,omitempty"` 2429 // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. 2430 EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` 2431 // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. 2432 StorageEndpoint *string `json:"storageEndpoint,omitempty"` 2433 // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. 2434 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 2435 // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. 2436 RetentionDays *int32 `json:"retentionDays,omitempty"` 2437} 2438 2439// Server represents a server. 2440type Server struct { 2441 autorest.Response `json:"-"` 2442 // Identity - The Azure Active Directory identity of the server. 2443 Identity *ResourceIdentity `json:"identity,omitempty"` 2444 // Sku - The SKU (pricing tier) of the server. 2445 Sku *Sku `json:"sku,omitempty"` 2446 // ServerProperties - Properties of the server. 2447 *ServerProperties `json:"properties,omitempty"` 2448 // Tags - Resource tags. 2449 Tags map[string]*string `json:"tags"` 2450 // Location - The geo-location where the resource lives 2451 Location *string `json:"location,omitempty"` 2452 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2453 ID *string `json:"id,omitempty"` 2454 // Name - READ-ONLY; The name of the resource 2455 Name *string `json:"name,omitempty"` 2456 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2457 Type *string `json:"type,omitempty"` 2458} 2459 2460// MarshalJSON is the custom marshaler for Server. 2461func (s Server) MarshalJSON() ([]byte, error) { 2462 objectMap := make(map[string]interface{}) 2463 if s.Identity != nil { 2464 objectMap["identity"] = s.Identity 2465 } 2466 if s.Sku != nil { 2467 objectMap["sku"] = s.Sku 2468 } 2469 if s.ServerProperties != nil { 2470 objectMap["properties"] = s.ServerProperties 2471 } 2472 if s.Tags != nil { 2473 objectMap["tags"] = s.Tags 2474 } 2475 if s.Location != nil { 2476 objectMap["location"] = s.Location 2477 } 2478 return json.Marshal(objectMap) 2479} 2480 2481// UnmarshalJSON is the custom unmarshaler for Server struct. 2482func (s *Server) UnmarshalJSON(body []byte) error { 2483 var m map[string]*json.RawMessage 2484 err := json.Unmarshal(body, &m) 2485 if err != nil { 2486 return err 2487 } 2488 for k, v := range m { 2489 switch k { 2490 case "identity": 2491 if v != nil { 2492 var identity ResourceIdentity 2493 err = json.Unmarshal(*v, &identity) 2494 if err != nil { 2495 return err 2496 } 2497 s.Identity = &identity 2498 } 2499 case "sku": 2500 if v != nil { 2501 var sku Sku 2502 err = json.Unmarshal(*v, &sku) 2503 if err != nil { 2504 return err 2505 } 2506 s.Sku = &sku 2507 } 2508 case "properties": 2509 if v != nil { 2510 var serverProperties ServerProperties 2511 err = json.Unmarshal(*v, &serverProperties) 2512 if err != nil { 2513 return err 2514 } 2515 s.ServerProperties = &serverProperties 2516 } 2517 case "tags": 2518 if v != nil { 2519 var tags map[string]*string 2520 err = json.Unmarshal(*v, &tags) 2521 if err != nil { 2522 return err 2523 } 2524 s.Tags = tags 2525 } 2526 case "location": 2527 if v != nil { 2528 var location string 2529 err = json.Unmarshal(*v, &location) 2530 if err != nil { 2531 return err 2532 } 2533 s.Location = &location 2534 } 2535 case "id": 2536 if v != nil { 2537 var ID string 2538 err = json.Unmarshal(*v, &ID) 2539 if err != nil { 2540 return err 2541 } 2542 s.ID = &ID 2543 } 2544 case "name": 2545 if v != nil { 2546 var name string 2547 err = json.Unmarshal(*v, &name) 2548 if err != nil { 2549 return err 2550 } 2551 s.Name = &name 2552 } 2553 case "type": 2554 if v != nil { 2555 var typeVar string 2556 err = json.Unmarshal(*v, &typeVar) 2557 if err != nil { 2558 return err 2559 } 2560 s.Type = &typeVar 2561 } 2562 } 2563 } 2564 2565 return nil 2566} 2567 2568// ServerAdministratorProperties the properties of an server Administrator. 2569type ServerAdministratorProperties struct { 2570 // AdministratorType - The type of administrator. 2571 AdministratorType *string `json:"administratorType,omitempty"` 2572 // Login - The server administrator login account name. 2573 Login *string `json:"login,omitempty"` 2574 // Sid - The server administrator Sid (Secure ID). 2575 Sid *uuid.UUID `json:"sid,omitempty"` 2576 // TenantID - The server Active Directory Administrator tenant id. 2577 TenantID *uuid.UUID `json:"tenantId,omitempty"` 2578} 2579 2580// ServerAdministratorResource represents a and external administrator to be created. 2581type ServerAdministratorResource struct { 2582 autorest.Response `json:"-"` 2583 // ServerAdministratorProperties - Properties of the server AAD administrator. 2584 *ServerAdministratorProperties `json:"properties,omitempty"` 2585 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2586 ID *string `json:"id,omitempty"` 2587 // Name - READ-ONLY; The name of the resource 2588 Name *string `json:"name,omitempty"` 2589 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2590 Type *string `json:"type,omitempty"` 2591} 2592 2593// MarshalJSON is the custom marshaler for ServerAdministratorResource. 2594func (sar ServerAdministratorResource) MarshalJSON() ([]byte, error) { 2595 objectMap := make(map[string]interface{}) 2596 if sar.ServerAdministratorProperties != nil { 2597 objectMap["properties"] = sar.ServerAdministratorProperties 2598 } 2599 return json.Marshal(objectMap) 2600} 2601 2602// UnmarshalJSON is the custom unmarshaler for ServerAdministratorResource struct. 2603func (sar *ServerAdministratorResource) UnmarshalJSON(body []byte) error { 2604 var m map[string]*json.RawMessage 2605 err := json.Unmarshal(body, &m) 2606 if err != nil { 2607 return err 2608 } 2609 for k, v := range m { 2610 switch k { 2611 case "properties": 2612 if v != nil { 2613 var serverAdministratorProperties ServerAdministratorProperties 2614 err = json.Unmarshal(*v, &serverAdministratorProperties) 2615 if err != nil { 2616 return err 2617 } 2618 sar.ServerAdministratorProperties = &serverAdministratorProperties 2619 } 2620 case "id": 2621 if v != nil { 2622 var ID string 2623 err = json.Unmarshal(*v, &ID) 2624 if err != nil { 2625 return err 2626 } 2627 sar.ID = &ID 2628 } 2629 case "name": 2630 if v != nil { 2631 var name string 2632 err = json.Unmarshal(*v, &name) 2633 if err != nil { 2634 return err 2635 } 2636 sar.Name = &name 2637 } 2638 case "type": 2639 if v != nil { 2640 var typeVar string 2641 err = json.Unmarshal(*v, &typeVar) 2642 if err != nil { 2643 return err 2644 } 2645 sar.Type = &typeVar 2646 } 2647 } 2648 } 2649 2650 return nil 2651} 2652 2653// ServerAdministratorResourceListResult the response to a list Active Directory Administrators request. 2654type ServerAdministratorResourceListResult struct { 2655 autorest.Response `json:"-"` 2656 // Value - The list of server Active Directory Administrators for the server. 2657 Value *[]ServerAdministratorResource `json:"value,omitempty"` 2658} 2659 2660// ServerAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 2661// long-running operation. 2662type ServerAdministratorsCreateOrUpdateFuture struct { 2663 azure.FutureAPI 2664 // Result returns the result of the asynchronous operation. 2665 // If the operation has not completed it will return an error. 2666 Result func(ServerAdministratorsClient) (ServerAdministratorResource, error) 2667} 2668 2669// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2670func (future *ServerAdministratorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 2671 var azFuture azure.Future 2672 if err := json.Unmarshal(body, &azFuture); err != nil { 2673 return err 2674 } 2675 future.FutureAPI = &azFuture 2676 future.Result = future.result 2677 return nil 2678} 2679 2680// result is the default implementation for ServerAdministratorsCreateOrUpdateFuture.Result. 2681func (future *ServerAdministratorsCreateOrUpdateFuture) result(client ServerAdministratorsClient) (sar ServerAdministratorResource, err error) { 2682 var done bool 2683 done, err = future.DoneWithContext(context.Background(), client) 2684 if err != nil { 2685 err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 2686 return 2687 } 2688 if !done { 2689 sar.Response.Response = future.Response() 2690 err = azure.NewAsyncOpIncompleteError("mysql.ServerAdministratorsCreateOrUpdateFuture") 2691 return 2692 } 2693 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2694 if sar.Response.Response, err = future.GetResult(sender); err == nil && sar.Response.Response.StatusCode != http.StatusNoContent { 2695 sar, err = client.CreateOrUpdateResponder(sar.Response.Response) 2696 if err != nil { 2697 err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsCreateOrUpdateFuture", "Result", sar.Response.Response, "Failure responding to request") 2698 } 2699 } 2700 return 2701} 2702 2703// ServerAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a 2704// long-running operation. 2705type ServerAdministratorsDeleteFuture struct { 2706 azure.FutureAPI 2707 // Result returns the result of the asynchronous operation. 2708 // If the operation has not completed it will return an error. 2709 Result func(ServerAdministratorsClient) (autorest.Response, error) 2710} 2711 2712// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2713func (future *ServerAdministratorsDeleteFuture) UnmarshalJSON(body []byte) error { 2714 var azFuture azure.Future 2715 if err := json.Unmarshal(body, &azFuture); err != nil { 2716 return err 2717 } 2718 future.FutureAPI = &azFuture 2719 future.Result = future.result 2720 return nil 2721} 2722 2723// result is the default implementation for ServerAdministratorsDeleteFuture.Result. 2724func (future *ServerAdministratorsDeleteFuture) result(client ServerAdministratorsClient) (ar autorest.Response, err error) { 2725 var done bool 2726 done, err = future.DoneWithContext(context.Background(), client) 2727 if err != nil { 2728 err = autorest.NewErrorWithError(err, "mysql.ServerAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") 2729 return 2730 } 2731 if !done { 2732 ar.Response = future.Response() 2733 err = azure.NewAsyncOpIncompleteError("mysql.ServerAdministratorsDeleteFuture") 2734 return 2735 } 2736 ar.Response = future.Response() 2737 return 2738} 2739 2740// ServerForCreate represents a server to be created. 2741type ServerForCreate struct { 2742 // Identity - The Azure Active Directory identity of the server. 2743 Identity *ResourceIdentity `json:"identity,omitempty"` 2744 // Sku - The SKU (pricing tier) of the server. 2745 Sku *Sku `json:"sku,omitempty"` 2746 // Properties - Properties of the server. 2747 Properties BasicServerPropertiesForCreate `json:"properties,omitempty"` 2748 // Location - The location the resource resides in. 2749 Location *string `json:"location,omitempty"` 2750 // Tags - Application-specific metadata in the form of key-value pairs. 2751 Tags map[string]*string `json:"tags"` 2752} 2753 2754// MarshalJSON is the custom marshaler for ServerForCreate. 2755func (sfc ServerForCreate) MarshalJSON() ([]byte, error) { 2756 objectMap := make(map[string]interface{}) 2757 if sfc.Identity != nil { 2758 objectMap["identity"] = sfc.Identity 2759 } 2760 if sfc.Sku != nil { 2761 objectMap["sku"] = sfc.Sku 2762 } 2763 objectMap["properties"] = sfc.Properties 2764 if sfc.Location != nil { 2765 objectMap["location"] = sfc.Location 2766 } 2767 if sfc.Tags != nil { 2768 objectMap["tags"] = sfc.Tags 2769 } 2770 return json.Marshal(objectMap) 2771} 2772 2773// UnmarshalJSON is the custom unmarshaler for ServerForCreate struct. 2774func (sfc *ServerForCreate) UnmarshalJSON(body []byte) error { 2775 var m map[string]*json.RawMessage 2776 err := json.Unmarshal(body, &m) 2777 if err != nil { 2778 return err 2779 } 2780 for k, v := range m { 2781 switch k { 2782 case "identity": 2783 if v != nil { 2784 var identity ResourceIdentity 2785 err = json.Unmarshal(*v, &identity) 2786 if err != nil { 2787 return err 2788 } 2789 sfc.Identity = &identity 2790 } 2791 case "sku": 2792 if v != nil { 2793 var sku Sku 2794 err = json.Unmarshal(*v, &sku) 2795 if err != nil { 2796 return err 2797 } 2798 sfc.Sku = &sku 2799 } 2800 case "properties": 2801 if v != nil { 2802 properties, err := unmarshalBasicServerPropertiesForCreate(*v) 2803 if err != nil { 2804 return err 2805 } 2806 sfc.Properties = properties 2807 } 2808 case "location": 2809 if v != nil { 2810 var location string 2811 err = json.Unmarshal(*v, &location) 2812 if err != nil { 2813 return err 2814 } 2815 sfc.Location = &location 2816 } 2817 case "tags": 2818 if v != nil { 2819 var tags map[string]*string 2820 err = json.Unmarshal(*v, &tags) 2821 if err != nil { 2822 return err 2823 } 2824 sfc.Tags = tags 2825 } 2826 } 2827 } 2828 2829 return nil 2830} 2831 2832// ServerKey a MySQL Server key. 2833type ServerKey struct { 2834 autorest.Response `json:"-"` 2835 // Kind - READ-ONLY; Kind of encryption protector used to protect the key. 2836 Kind *string `json:"kind,omitempty"` 2837 // ServerKeyProperties - Properties of the ServerKey Resource. 2838 *ServerKeyProperties `json:"properties,omitempty"` 2839 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2840 ID *string `json:"id,omitempty"` 2841 // Name - READ-ONLY; The name of the resource 2842 Name *string `json:"name,omitempty"` 2843 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2844 Type *string `json:"type,omitempty"` 2845} 2846 2847// MarshalJSON is the custom marshaler for ServerKey. 2848func (sk ServerKey) MarshalJSON() ([]byte, error) { 2849 objectMap := make(map[string]interface{}) 2850 if sk.ServerKeyProperties != nil { 2851 objectMap["properties"] = sk.ServerKeyProperties 2852 } 2853 return json.Marshal(objectMap) 2854} 2855 2856// UnmarshalJSON is the custom unmarshaler for ServerKey struct. 2857func (sk *ServerKey) UnmarshalJSON(body []byte) error { 2858 var m map[string]*json.RawMessage 2859 err := json.Unmarshal(body, &m) 2860 if err != nil { 2861 return err 2862 } 2863 for k, v := range m { 2864 switch k { 2865 case "kind": 2866 if v != nil { 2867 var kind string 2868 err = json.Unmarshal(*v, &kind) 2869 if err != nil { 2870 return err 2871 } 2872 sk.Kind = &kind 2873 } 2874 case "properties": 2875 if v != nil { 2876 var serverKeyProperties ServerKeyProperties 2877 err = json.Unmarshal(*v, &serverKeyProperties) 2878 if err != nil { 2879 return err 2880 } 2881 sk.ServerKeyProperties = &serverKeyProperties 2882 } 2883 case "id": 2884 if v != nil { 2885 var ID string 2886 err = json.Unmarshal(*v, &ID) 2887 if err != nil { 2888 return err 2889 } 2890 sk.ID = &ID 2891 } 2892 case "name": 2893 if v != nil { 2894 var name string 2895 err = json.Unmarshal(*v, &name) 2896 if err != nil { 2897 return err 2898 } 2899 sk.Name = &name 2900 } 2901 case "type": 2902 if v != nil { 2903 var typeVar string 2904 err = json.Unmarshal(*v, &typeVar) 2905 if err != nil { 2906 return err 2907 } 2908 sk.Type = &typeVar 2909 } 2910 } 2911 } 2912 2913 return nil 2914} 2915 2916// ServerKeyListResult a list of MySQL Server keys. 2917type ServerKeyListResult struct { 2918 autorest.Response `json:"-"` 2919 // Value - READ-ONLY; A list of MySQL Server keys. 2920 Value *[]ServerKey `json:"value,omitempty"` 2921 // NextLink - READ-ONLY; Link to retrieve next page of results. 2922 NextLink *string `json:"nextLink,omitempty"` 2923} 2924 2925// MarshalJSON is the custom marshaler for ServerKeyListResult. 2926func (sklr ServerKeyListResult) MarshalJSON() ([]byte, error) { 2927 objectMap := make(map[string]interface{}) 2928 return json.Marshal(objectMap) 2929} 2930 2931// ServerKeyListResultIterator provides access to a complete listing of ServerKey values. 2932type ServerKeyListResultIterator struct { 2933 i int 2934 page ServerKeyListResultPage 2935} 2936 2937// NextWithContext advances to the next value. If there was an error making 2938// the request the iterator does not advance and the error is returned. 2939func (iter *ServerKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { 2940 if tracing.IsEnabled() { 2941 ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultIterator.NextWithContext") 2942 defer func() { 2943 sc := -1 2944 if iter.Response().Response.Response != nil { 2945 sc = iter.Response().Response.Response.StatusCode 2946 } 2947 tracing.EndSpan(ctx, sc, err) 2948 }() 2949 } 2950 iter.i++ 2951 if iter.i < len(iter.page.Values()) { 2952 return nil 2953 } 2954 err = iter.page.NextWithContext(ctx) 2955 if err != nil { 2956 iter.i-- 2957 return err 2958 } 2959 iter.i = 0 2960 return nil 2961} 2962 2963// Next advances to the next value. If there was an error making 2964// the request the iterator does not advance and the error is returned. 2965// Deprecated: Use NextWithContext() instead. 2966func (iter *ServerKeyListResultIterator) Next() error { 2967 return iter.NextWithContext(context.Background()) 2968} 2969 2970// NotDone returns true if the enumeration should be started or is not yet complete. 2971func (iter ServerKeyListResultIterator) NotDone() bool { 2972 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2973} 2974 2975// Response returns the raw server response from the last page request. 2976func (iter ServerKeyListResultIterator) Response() ServerKeyListResult { 2977 return iter.page.Response() 2978} 2979 2980// Value returns the current value or a zero-initialized value if the 2981// iterator has advanced beyond the end of the collection. 2982func (iter ServerKeyListResultIterator) Value() ServerKey { 2983 if !iter.page.NotDone() { 2984 return ServerKey{} 2985 } 2986 return iter.page.Values()[iter.i] 2987} 2988 2989// Creates a new instance of the ServerKeyListResultIterator type. 2990func NewServerKeyListResultIterator(page ServerKeyListResultPage) ServerKeyListResultIterator { 2991 return ServerKeyListResultIterator{page: page} 2992} 2993 2994// IsEmpty returns true if the ListResult contains no values. 2995func (sklr ServerKeyListResult) IsEmpty() bool { 2996 return sklr.Value == nil || len(*sklr.Value) == 0 2997} 2998 2999// hasNextLink returns true if the NextLink is not empty. 3000func (sklr ServerKeyListResult) hasNextLink() bool { 3001 return sklr.NextLink != nil && len(*sklr.NextLink) != 0 3002} 3003 3004// serverKeyListResultPreparer prepares a request to retrieve the next set of results. 3005// It returns nil if no more results exist. 3006func (sklr ServerKeyListResult) serverKeyListResultPreparer(ctx context.Context) (*http.Request, error) { 3007 if !sklr.hasNextLink() { 3008 return nil, nil 3009 } 3010 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3011 autorest.AsJSON(), 3012 autorest.AsGet(), 3013 autorest.WithBaseURL(to.String(sklr.NextLink))) 3014} 3015 3016// ServerKeyListResultPage contains a page of ServerKey values. 3017type ServerKeyListResultPage struct { 3018 fn func(context.Context, ServerKeyListResult) (ServerKeyListResult, error) 3019 sklr ServerKeyListResult 3020} 3021 3022// NextWithContext advances to the next page of values. If there was an error making 3023// the request the page does not advance and the error is returned. 3024func (page *ServerKeyListResultPage) NextWithContext(ctx context.Context) (err error) { 3025 if tracing.IsEnabled() { 3026 ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultPage.NextWithContext") 3027 defer func() { 3028 sc := -1 3029 if page.Response().Response.Response != nil { 3030 sc = page.Response().Response.Response.StatusCode 3031 } 3032 tracing.EndSpan(ctx, sc, err) 3033 }() 3034 } 3035 for { 3036 next, err := page.fn(ctx, page.sklr) 3037 if err != nil { 3038 return err 3039 } 3040 page.sklr = next 3041 if !next.hasNextLink() || !next.IsEmpty() { 3042 break 3043 } 3044 } 3045 return nil 3046} 3047 3048// Next advances to the next page of values. If there was an error making 3049// the request the page does not advance and the error is returned. 3050// Deprecated: Use NextWithContext() instead. 3051func (page *ServerKeyListResultPage) Next() error { 3052 return page.NextWithContext(context.Background()) 3053} 3054 3055// NotDone returns true if the page enumeration should be started or is not yet complete. 3056func (page ServerKeyListResultPage) NotDone() bool { 3057 return !page.sklr.IsEmpty() 3058} 3059 3060// Response returns the raw server response from the last page request. 3061func (page ServerKeyListResultPage) Response() ServerKeyListResult { 3062 return page.sklr 3063} 3064 3065// Values returns the slice of values for the current page or nil if there are no values. 3066func (page ServerKeyListResultPage) Values() []ServerKey { 3067 if page.sklr.IsEmpty() { 3068 return nil 3069 } 3070 return *page.sklr.Value 3071} 3072 3073// Creates a new instance of the ServerKeyListResultPage type. 3074func NewServerKeyListResultPage(cur ServerKeyListResult, getNextPage func(context.Context, ServerKeyListResult) (ServerKeyListResult, error)) ServerKeyListResultPage { 3075 return ServerKeyListResultPage{ 3076 fn: getNextPage, 3077 sklr: cur, 3078 } 3079} 3080 3081// ServerKeyProperties properties for a key execution. 3082type ServerKeyProperties struct { 3083 // ServerKeyType - The key type like 'AzureKeyVault'. 3084 ServerKeyType *string `json:"serverKeyType,omitempty"` 3085 // URI - The URI of the key. 3086 URI *string `json:"uri,omitempty"` 3087 // CreationDate - READ-ONLY; The key creation date. 3088 CreationDate *date.Time `json:"creationDate,omitempty"` 3089} 3090 3091// MarshalJSON is the custom marshaler for ServerKeyProperties. 3092func (skp ServerKeyProperties) MarshalJSON() ([]byte, error) { 3093 objectMap := make(map[string]interface{}) 3094 if skp.ServerKeyType != nil { 3095 objectMap["serverKeyType"] = skp.ServerKeyType 3096 } 3097 if skp.URI != nil { 3098 objectMap["uri"] = skp.URI 3099 } 3100 return json.Marshal(objectMap) 3101} 3102 3103// ServerKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 3104// long-running operation. 3105type ServerKeysCreateOrUpdateFuture struct { 3106 azure.FutureAPI 3107 // Result returns the result of the asynchronous operation. 3108 // If the operation has not completed it will return an error. 3109 Result func(ServerKeysClient) (ServerKey, error) 3110} 3111 3112// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3113func (future *ServerKeysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 3114 var azFuture azure.Future 3115 if err := json.Unmarshal(body, &azFuture); err != nil { 3116 return err 3117 } 3118 future.FutureAPI = &azFuture 3119 future.Result = future.result 3120 return nil 3121} 3122 3123// result is the default implementation for ServerKeysCreateOrUpdateFuture.Result. 3124func (future *ServerKeysCreateOrUpdateFuture) result(client ServerKeysClient) (sk ServerKey, err error) { 3125 var done bool 3126 done, err = future.DoneWithContext(context.Background(), client) 3127 if err != nil { 3128 err = autorest.NewErrorWithError(err, "mysql.ServerKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 3129 return 3130 } 3131 if !done { 3132 sk.Response.Response = future.Response() 3133 err = azure.NewAsyncOpIncompleteError("mysql.ServerKeysCreateOrUpdateFuture") 3134 return 3135 } 3136 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3137 if sk.Response.Response, err = future.GetResult(sender); err == nil && sk.Response.Response.StatusCode != http.StatusNoContent { 3138 sk, err = client.CreateOrUpdateResponder(sk.Response.Response) 3139 if err != nil { 3140 err = autorest.NewErrorWithError(err, "mysql.ServerKeysCreateOrUpdateFuture", "Result", sk.Response.Response, "Failure responding to request") 3141 } 3142 } 3143 return 3144} 3145 3146// ServerKeysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 3147// operation. 3148type ServerKeysDeleteFuture struct { 3149 azure.FutureAPI 3150 // Result returns the result of the asynchronous operation. 3151 // If the operation has not completed it will return an error. 3152 Result func(ServerKeysClient) (autorest.Response, error) 3153} 3154 3155// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3156func (future *ServerKeysDeleteFuture) UnmarshalJSON(body []byte) error { 3157 var azFuture azure.Future 3158 if err := json.Unmarshal(body, &azFuture); err != nil { 3159 return err 3160 } 3161 future.FutureAPI = &azFuture 3162 future.Result = future.result 3163 return nil 3164} 3165 3166// result is the default implementation for ServerKeysDeleteFuture.Result. 3167func (future *ServerKeysDeleteFuture) result(client ServerKeysClient) (ar autorest.Response, err error) { 3168 var done bool 3169 done, err = future.DoneWithContext(context.Background(), client) 3170 if err != nil { 3171 err = autorest.NewErrorWithError(err, "mysql.ServerKeysDeleteFuture", "Result", future.Response(), "Polling failure") 3172 return 3173 } 3174 if !done { 3175 ar.Response = future.Response() 3176 err = azure.NewAsyncOpIncompleteError("mysql.ServerKeysDeleteFuture") 3177 return 3178 } 3179 ar.Response = future.Response() 3180 return 3181} 3182 3183// ServerListResult a list of servers. 3184type ServerListResult struct { 3185 autorest.Response `json:"-"` 3186 // Value - The list of servers 3187 Value *[]Server `json:"value,omitempty"` 3188} 3189 3190// ServerParametersListUpdateConfigurationsFuture an abstraction for monitoring and retrieving the results 3191// of a long-running operation. 3192type ServerParametersListUpdateConfigurationsFuture struct { 3193 azure.FutureAPI 3194 // Result returns the result of the asynchronous operation. 3195 // If the operation has not completed it will return an error. 3196 Result func(ServerParametersClient) (ConfigurationListResult, error) 3197} 3198 3199// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3200func (future *ServerParametersListUpdateConfigurationsFuture) UnmarshalJSON(body []byte) error { 3201 var azFuture azure.Future 3202 if err := json.Unmarshal(body, &azFuture); err != nil { 3203 return err 3204 } 3205 future.FutureAPI = &azFuture 3206 future.Result = future.result 3207 return nil 3208} 3209 3210// result is the default implementation for ServerParametersListUpdateConfigurationsFuture.Result. 3211func (future *ServerParametersListUpdateConfigurationsFuture) result(client ServerParametersClient) (clr ConfigurationListResult, err error) { 3212 var done bool 3213 done, err = future.DoneWithContext(context.Background(), client) 3214 if err != nil { 3215 err = autorest.NewErrorWithError(err, "mysql.ServerParametersListUpdateConfigurationsFuture", "Result", future.Response(), "Polling failure") 3216 return 3217 } 3218 if !done { 3219 clr.Response.Response = future.Response() 3220 err = azure.NewAsyncOpIncompleteError("mysql.ServerParametersListUpdateConfigurationsFuture") 3221 return 3222 } 3223 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3224 if clr.Response.Response, err = future.GetResult(sender); err == nil && clr.Response.Response.StatusCode != http.StatusNoContent { 3225 clr, err = client.ListUpdateConfigurationsResponder(clr.Response.Response) 3226 if err != nil { 3227 err = autorest.NewErrorWithError(err, "mysql.ServerParametersListUpdateConfigurationsFuture", "Result", clr.Response.Response, "Failure responding to request") 3228 } 3229 } 3230 return 3231} 3232 3233// ServerPrivateEndpointConnection a private endpoint connection under a server 3234type ServerPrivateEndpointConnection struct { 3235 // ID - READ-ONLY; Resource Id of the private endpoint connection. 3236 ID *string `json:"id,omitempty"` 3237 // Properties - READ-ONLY; Private endpoint connection properties 3238 Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"` 3239} 3240 3241// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnection. 3242func (spec ServerPrivateEndpointConnection) MarshalJSON() ([]byte, error) { 3243 objectMap := make(map[string]interface{}) 3244 return json.Marshal(objectMap) 3245} 3246 3247// ServerPrivateEndpointConnectionProperties properties of a private endpoint connection. 3248type ServerPrivateEndpointConnectionProperties struct { 3249 // PrivateEndpoint - Private endpoint which the connection belongs to. 3250 PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` 3251 // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. 3252 PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` 3253 // ProvisioningState - READ-ONLY; State of the private endpoint connection. Possible values include: 'Approving', 'Ready', 'Dropping', 'Failed', 'Rejecting' 3254 ProvisioningState PrivateEndpointProvisioningState `json:"provisioningState,omitempty"` 3255} 3256 3257// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnectionProperties. 3258func (specp ServerPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { 3259 objectMap := make(map[string]interface{}) 3260 if specp.PrivateEndpoint != nil { 3261 objectMap["privateEndpoint"] = specp.PrivateEndpoint 3262 } 3263 if specp.PrivateLinkServiceConnectionState != nil { 3264 objectMap["privateLinkServiceConnectionState"] = specp.PrivateLinkServiceConnectionState 3265 } 3266 return json.Marshal(objectMap) 3267} 3268 3269// ServerPrivateLinkServiceConnectionStateProperty ... 3270type ServerPrivateLinkServiceConnectionStateProperty struct { 3271 // Status - The private link service connection status. Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' 3272 Status PrivateLinkServiceConnectionStateStatus `json:"status,omitempty"` 3273 // Description - The private link service connection description. 3274 Description *string `json:"description,omitempty"` 3275 // ActionsRequired - READ-ONLY; The actions required for private link service connection. Possible values include: 'None' 3276 ActionsRequired PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` 3277} 3278 3279// MarshalJSON is the custom marshaler for ServerPrivateLinkServiceConnectionStateProperty. 3280func (splscsp ServerPrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { 3281 objectMap := make(map[string]interface{}) 3282 if splscsp.Status != "" { 3283 objectMap["status"] = splscsp.Status 3284 } 3285 if splscsp.Description != nil { 3286 objectMap["description"] = splscsp.Description 3287 } 3288 return json.Marshal(objectMap) 3289} 3290 3291// ServerProperties the properties of a server. 3292type ServerProperties struct { 3293 // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). 3294 AdministratorLogin *string `json:"administratorLogin,omitempty"` 3295 // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' 3296 Version ServerVersion `json:"version,omitempty"` 3297 // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' 3298 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` 3299 // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' 3300 MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` 3301 // ByokEnforcement - READ-ONLY; Status showing whether the server data encryption is enabled with customer-managed keys. 3302 ByokEnforcement *string `json:"byokEnforcement,omitempty"` 3303 // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' 3304 InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` 3305 // UserVisibleState - A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled', 'ServerStateInaccessible' 3306 UserVisibleState ServerState `json:"userVisibleState,omitempty"` 3307 // FullyQualifiedDomainName - The fully qualified domain name of a server. 3308 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` 3309 // EarliestRestoreDate - Earliest restore point creation time (ISO8601 format) 3310 EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` 3311 // StorageProfile - Storage profile of a server. 3312 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 3313 // ReplicationRole - The replication role of the server. 3314 ReplicationRole *string `json:"replicationRole,omitempty"` 3315 // MasterServerID - The master server id of a replica server. 3316 MasterServerID *string `json:"masterServerId,omitempty"` 3317 // ReplicaCapacity - The maximum number of replicas that a master server can have. 3318 ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"` 3319 // PublicNetworkAccess - 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' 3320 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` 3321 // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections on a server 3322 PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` 3323} 3324 3325// MarshalJSON is the custom marshaler for ServerProperties. 3326func (sp ServerProperties) MarshalJSON() ([]byte, error) { 3327 objectMap := make(map[string]interface{}) 3328 if sp.AdministratorLogin != nil { 3329 objectMap["administratorLogin"] = sp.AdministratorLogin 3330 } 3331 if sp.Version != "" { 3332 objectMap["version"] = sp.Version 3333 } 3334 if sp.SslEnforcement != "" { 3335 objectMap["sslEnforcement"] = sp.SslEnforcement 3336 } 3337 if sp.MinimalTLSVersion != "" { 3338 objectMap["minimalTlsVersion"] = sp.MinimalTLSVersion 3339 } 3340 if sp.InfrastructureEncryption != "" { 3341 objectMap["infrastructureEncryption"] = sp.InfrastructureEncryption 3342 } 3343 if sp.UserVisibleState != "" { 3344 objectMap["userVisibleState"] = sp.UserVisibleState 3345 } 3346 if sp.FullyQualifiedDomainName != nil { 3347 objectMap["fullyQualifiedDomainName"] = sp.FullyQualifiedDomainName 3348 } 3349 if sp.EarliestRestoreDate != nil { 3350 objectMap["earliestRestoreDate"] = sp.EarliestRestoreDate 3351 } 3352 if sp.StorageProfile != nil { 3353 objectMap["storageProfile"] = sp.StorageProfile 3354 } 3355 if sp.ReplicationRole != nil { 3356 objectMap["replicationRole"] = sp.ReplicationRole 3357 } 3358 if sp.MasterServerID != nil { 3359 objectMap["masterServerId"] = sp.MasterServerID 3360 } 3361 if sp.ReplicaCapacity != nil { 3362 objectMap["replicaCapacity"] = sp.ReplicaCapacity 3363 } 3364 if sp.PublicNetworkAccess != "" { 3365 objectMap["publicNetworkAccess"] = sp.PublicNetworkAccess 3366 } 3367 return json.Marshal(objectMap) 3368} 3369 3370// BasicServerPropertiesForCreate the properties used to create a new server. 3371type BasicServerPropertiesForCreate interface { 3372 AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) 3373 AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) 3374 AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) 3375 AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) 3376 AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) 3377} 3378 3379// ServerPropertiesForCreate the properties used to create a new server. 3380type ServerPropertiesForCreate struct { 3381 // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' 3382 Version ServerVersion `json:"version,omitempty"` 3383 // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' 3384 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` 3385 // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' 3386 MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` 3387 // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' 3388 InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` 3389 // PublicNetworkAccess - 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' 3390 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` 3391 // StorageProfile - Storage profile of a server. 3392 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 3393 // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' 3394 CreateMode CreateMode `json:"createMode,omitempty"` 3395} 3396 3397func unmarshalBasicServerPropertiesForCreate(body []byte) (BasicServerPropertiesForCreate, error) { 3398 var m map[string]interface{} 3399 err := json.Unmarshal(body, &m) 3400 if err != nil { 3401 return nil, err 3402 } 3403 3404 switch m["createMode"] { 3405 case string(CreateModeDefault): 3406 var spfdc ServerPropertiesForDefaultCreate 3407 err := json.Unmarshal(body, &spfdc) 3408 return spfdc, err 3409 case string(CreateModePointInTimeRestore): 3410 var spfr ServerPropertiesForRestore 3411 err := json.Unmarshal(body, &spfr) 3412 return spfr, err 3413 case string(CreateModeGeoRestore): 3414 var spfgr ServerPropertiesForGeoRestore 3415 err := json.Unmarshal(body, &spfgr) 3416 return spfgr, err 3417 case string(CreateModeReplica): 3418 var spfr ServerPropertiesForReplica 3419 err := json.Unmarshal(body, &spfr) 3420 return spfr, err 3421 default: 3422 var spfc ServerPropertiesForCreate 3423 err := json.Unmarshal(body, &spfc) 3424 return spfc, err 3425 } 3426} 3427func unmarshalBasicServerPropertiesForCreateArray(body []byte) ([]BasicServerPropertiesForCreate, error) { 3428 var rawMessages []*json.RawMessage 3429 err := json.Unmarshal(body, &rawMessages) 3430 if err != nil { 3431 return nil, err 3432 } 3433 3434 spfcArray := make([]BasicServerPropertiesForCreate, len(rawMessages)) 3435 3436 for index, rawMessage := range rawMessages { 3437 spfc, err := unmarshalBasicServerPropertiesForCreate(*rawMessage) 3438 if err != nil { 3439 return nil, err 3440 } 3441 spfcArray[index] = spfc 3442 } 3443 return spfcArray, nil 3444} 3445 3446// MarshalJSON is the custom marshaler for ServerPropertiesForCreate. 3447func (spfc ServerPropertiesForCreate) MarshalJSON() ([]byte, error) { 3448 spfc.CreateMode = CreateModeServerPropertiesForCreate 3449 objectMap := make(map[string]interface{}) 3450 if spfc.Version != "" { 3451 objectMap["version"] = spfc.Version 3452 } 3453 if spfc.SslEnforcement != "" { 3454 objectMap["sslEnforcement"] = spfc.SslEnforcement 3455 } 3456 if spfc.MinimalTLSVersion != "" { 3457 objectMap["minimalTlsVersion"] = spfc.MinimalTLSVersion 3458 } 3459 if spfc.InfrastructureEncryption != "" { 3460 objectMap["infrastructureEncryption"] = spfc.InfrastructureEncryption 3461 } 3462 if spfc.PublicNetworkAccess != "" { 3463 objectMap["publicNetworkAccess"] = spfc.PublicNetworkAccess 3464 } 3465 if spfc.StorageProfile != nil { 3466 objectMap["storageProfile"] = spfc.StorageProfile 3467 } 3468 if spfc.CreateMode != "" { 3469 objectMap["createMode"] = spfc.CreateMode 3470 } 3471 return json.Marshal(objectMap) 3472} 3473 3474// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. 3475func (spfc ServerPropertiesForCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { 3476 return nil, false 3477} 3478 3479// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. 3480func (spfc ServerPropertiesForCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { 3481 return nil, false 3482} 3483 3484// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. 3485func (spfc ServerPropertiesForCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { 3486 return nil, false 3487} 3488 3489// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. 3490func (spfc ServerPropertiesForCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { 3491 return nil, false 3492} 3493 3494// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. 3495func (spfc ServerPropertiesForCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { 3496 return &spfc, true 3497} 3498 3499// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. 3500func (spfc ServerPropertiesForCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { 3501 return &spfc, true 3502} 3503 3504// ServerPropertiesForDefaultCreate the properties used to create a new server. 3505type ServerPropertiesForDefaultCreate struct { 3506 // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). 3507 AdministratorLogin *string `json:"administratorLogin,omitempty"` 3508 // AdministratorLoginPassword - The password of the administrator login. 3509 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` 3510 // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' 3511 Version ServerVersion `json:"version,omitempty"` 3512 // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' 3513 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` 3514 // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' 3515 MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` 3516 // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' 3517 InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` 3518 // PublicNetworkAccess - 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' 3519 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` 3520 // StorageProfile - Storage profile of a server. 3521 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 3522 // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' 3523 CreateMode CreateMode `json:"createMode,omitempty"` 3524} 3525 3526// MarshalJSON is the custom marshaler for ServerPropertiesForDefaultCreate. 3527func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { 3528 spfdc.CreateMode = CreateModeDefault 3529 objectMap := make(map[string]interface{}) 3530 if spfdc.AdministratorLogin != nil { 3531 objectMap["administratorLogin"] = spfdc.AdministratorLogin 3532 } 3533 if spfdc.AdministratorLoginPassword != nil { 3534 objectMap["administratorLoginPassword"] = spfdc.AdministratorLoginPassword 3535 } 3536 if spfdc.Version != "" { 3537 objectMap["version"] = spfdc.Version 3538 } 3539 if spfdc.SslEnforcement != "" { 3540 objectMap["sslEnforcement"] = spfdc.SslEnforcement 3541 } 3542 if spfdc.MinimalTLSVersion != "" { 3543 objectMap["minimalTlsVersion"] = spfdc.MinimalTLSVersion 3544 } 3545 if spfdc.InfrastructureEncryption != "" { 3546 objectMap["infrastructureEncryption"] = spfdc.InfrastructureEncryption 3547 } 3548 if spfdc.PublicNetworkAccess != "" { 3549 objectMap["publicNetworkAccess"] = spfdc.PublicNetworkAccess 3550 } 3551 if spfdc.StorageProfile != nil { 3552 objectMap["storageProfile"] = spfdc.StorageProfile 3553 } 3554 if spfdc.CreateMode != "" { 3555 objectMap["createMode"] = spfdc.CreateMode 3556 } 3557 return json.Marshal(objectMap) 3558} 3559 3560// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. 3561func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { 3562 return &spfdc, true 3563} 3564 3565// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. 3566func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { 3567 return nil, false 3568} 3569 3570// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. 3571func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { 3572 return nil, false 3573} 3574 3575// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. 3576func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { 3577 return nil, false 3578} 3579 3580// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. 3581func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { 3582 return nil, false 3583} 3584 3585// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. 3586func (spfdc ServerPropertiesForDefaultCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { 3587 return &spfdc, true 3588} 3589 3590// ServerPropertiesForGeoRestore the properties used to create a new server by restoring to a different 3591// region from a geo replicated backup. 3592type ServerPropertiesForGeoRestore struct { 3593 // SourceServerID - The source server id to restore from. 3594 SourceServerID *string `json:"sourceServerId,omitempty"` 3595 // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' 3596 Version ServerVersion `json:"version,omitempty"` 3597 // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' 3598 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` 3599 // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' 3600 MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` 3601 // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' 3602 InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` 3603 // PublicNetworkAccess - 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' 3604 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` 3605 // StorageProfile - Storage profile of a server. 3606 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 3607 // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' 3608 CreateMode CreateMode `json:"createMode,omitempty"` 3609} 3610 3611// MarshalJSON is the custom marshaler for ServerPropertiesForGeoRestore. 3612func (spfgr ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { 3613 spfgr.CreateMode = CreateModeGeoRestore 3614 objectMap := make(map[string]interface{}) 3615 if spfgr.SourceServerID != nil { 3616 objectMap["sourceServerId"] = spfgr.SourceServerID 3617 } 3618 if spfgr.Version != "" { 3619 objectMap["version"] = spfgr.Version 3620 } 3621 if spfgr.SslEnforcement != "" { 3622 objectMap["sslEnforcement"] = spfgr.SslEnforcement 3623 } 3624 if spfgr.MinimalTLSVersion != "" { 3625 objectMap["minimalTlsVersion"] = spfgr.MinimalTLSVersion 3626 } 3627 if spfgr.InfrastructureEncryption != "" { 3628 objectMap["infrastructureEncryption"] = spfgr.InfrastructureEncryption 3629 } 3630 if spfgr.PublicNetworkAccess != "" { 3631 objectMap["publicNetworkAccess"] = spfgr.PublicNetworkAccess 3632 } 3633 if spfgr.StorageProfile != nil { 3634 objectMap["storageProfile"] = spfgr.StorageProfile 3635 } 3636 if spfgr.CreateMode != "" { 3637 objectMap["createMode"] = spfgr.CreateMode 3638 } 3639 return json.Marshal(objectMap) 3640} 3641 3642// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. 3643func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { 3644 return nil, false 3645} 3646 3647// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. 3648func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { 3649 return nil, false 3650} 3651 3652// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. 3653func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { 3654 return &spfgr, true 3655} 3656 3657// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. 3658func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { 3659 return nil, false 3660} 3661 3662// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. 3663func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { 3664 return nil, false 3665} 3666 3667// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. 3668func (spfgr ServerPropertiesForGeoRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { 3669 return &spfgr, true 3670} 3671 3672// ServerPropertiesForReplica the properties to create a new replica. 3673type ServerPropertiesForReplica struct { 3674 // SourceServerID - The master server id to create replica from. 3675 SourceServerID *string `json:"sourceServerId,omitempty"` 3676 // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' 3677 Version ServerVersion `json:"version,omitempty"` 3678 // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' 3679 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` 3680 // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' 3681 MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` 3682 // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' 3683 InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` 3684 // PublicNetworkAccess - 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' 3685 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` 3686 // StorageProfile - Storage profile of a server. 3687 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 3688 // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' 3689 CreateMode CreateMode `json:"createMode,omitempty"` 3690} 3691 3692// MarshalJSON is the custom marshaler for ServerPropertiesForReplica. 3693func (spfr ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { 3694 spfr.CreateMode = CreateModeReplica 3695 objectMap := make(map[string]interface{}) 3696 if spfr.SourceServerID != nil { 3697 objectMap["sourceServerId"] = spfr.SourceServerID 3698 } 3699 if spfr.Version != "" { 3700 objectMap["version"] = spfr.Version 3701 } 3702 if spfr.SslEnforcement != "" { 3703 objectMap["sslEnforcement"] = spfr.SslEnforcement 3704 } 3705 if spfr.MinimalTLSVersion != "" { 3706 objectMap["minimalTlsVersion"] = spfr.MinimalTLSVersion 3707 } 3708 if spfr.InfrastructureEncryption != "" { 3709 objectMap["infrastructureEncryption"] = spfr.InfrastructureEncryption 3710 } 3711 if spfr.PublicNetworkAccess != "" { 3712 objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess 3713 } 3714 if spfr.StorageProfile != nil { 3715 objectMap["storageProfile"] = spfr.StorageProfile 3716 } 3717 if spfr.CreateMode != "" { 3718 objectMap["createMode"] = spfr.CreateMode 3719 } 3720 return json.Marshal(objectMap) 3721} 3722 3723// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. 3724func (spfr ServerPropertiesForReplica) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { 3725 return nil, false 3726} 3727 3728// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. 3729func (spfr ServerPropertiesForReplica) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { 3730 return nil, false 3731} 3732 3733// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. 3734func (spfr ServerPropertiesForReplica) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { 3735 return nil, false 3736} 3737 3738// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. 3739func (spfr ServerPropertiesForReplica) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { 3740 return &spfr, true 3741} 3742 3743// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. 3744func (spfr ServerPropertiesForReplica) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { 3745 return nil, false 3746} 3747 3748// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. 3749func (spfr ServerPropertiesForReplica) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { 3750 return &spfr, true 3751} 3752 3753// ServerPropertiesForRestore the properties used to create a new server by restoring from a backup. 3754type ServerPropertiesForRestore struct { 3755 // SourceServerID - The source server id to restore from. 3756 SourceServerID *string `json:"sourceServerId,omitempty"` 3757 // RestorePointInTime - Restore point creation time (ISO8601 format), specifying the time to restore from. 3758 RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` 3759 // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' 3760 Version ServerVersion `json:"version,omitempty"` 3761 // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' 3762 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` 3763 // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' 3764 MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` 3765 // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' 3766 InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` 3767 // PublicNetworkAccess - 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' 3768 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` 3769 // StorageProfile - Storage profile of a server. 3770 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 3771 // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' 3772 CreateMode CreateMode `json:"createMode,omitempty"` 3773} 3774 3775// MarshalJSON is the custom marshaler for ServerPropertiesForRestore. 3776func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { 3777 spfr.CreateMode = CreateModePointInTimeRestore 3778 objectMap := make(map[string]interface{}) 3779 if spfr.SourceServerID != nil { 3780 objectMap["sourceServerId"] = spfr.SourceServerID 3781 } 3782 if spfr.RestorePointInTime != nil { 3783 objectMap["restorePointInTime"] = spfr.RestorePointInTime 3784 } 3785 if spfr.Version != "" { 3786 objectMap["version"] = spfr.Version 3787 } 3788 if spfr.SslEnforcement != "" { 3789 objectMap["sslEnforcement"] = spfr.SslEnforcement 3790 } 3791 if spfr.MinimalTLSVersion != "" { 3792 objectMap["minimalTlsVersion"] = spfr.MinimalTLSVersion 3793 } 3794 if spfr.InfrastructureEncryption != "" { 3795 objectMap["infrastructureEncryption"] = spfr.InfrastructureEncryption 3796 } 3797 if spfr.PublicNetworkAccess != "" { 3798 objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess 3799 } 3800 if spfr.StorageProfile != nil { 3801 objectMap["storageProfile"] = spfr.StorageProfile 3802 } 3803 if spfr.CreateMode != "" { 3804 objectMap["createMode"] = spfr.CreateMode 3805 } 3806 return json.Marshal(objectMap) 3807} 3808 3809// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. 3810func (spfr ServerPropertiesForRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { 3811 return nil, false 3812} 3813 3814// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. 3815func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { 3816 return &spfr, true 3817} 3818 3819// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. 3820func (spfr ServerPropertiesForRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { 3821 return nil, false 3822} 3823 3824// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. 3825func (spfr ServerPropertiesForRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { 3826 return nil, false 3827} 3828 3829// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. 3830func (spfr ServerPropertiesForRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { 3831 return nil, false 3832} 3833 3834// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. 3835func (spfr ServerPropertiesForRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { 3836 return &spfr, true 3837} 3838 3839// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running 3840// operation. 3841type ServersCreateFuture struct { 3842 azure.FutureAPI 3843 // Result returns the result of the asynchronous operation. 3844 // If the operation has not completed it will return an error. 3845 Result func(ServersClient) (Server, error) 3846} 3847 3848// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3849func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error { 3850 var azFuture azure.Future 3851 if err := json.Unmarshal(body, &azFuture); err != nil { 3852 return err 3853 } 3854 future.FutureAPI = &azFuture 3855 future.Result = future.result 3856 return nil 3857} 3858 3859// result is the default implementation for ServersCreateFuture.Result. 3860func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) { 3861 var done bool 3862 done, err = future.DoneWithContext(context.Background(), client) 3863 if err != nil { 3864 err = autorest.NewErrorWithError(err, "mysql.ServersCreateFuture", "Result", future.Response(), "Polling failure") 3865 return 3866 } 3867 if !done { 3868 s.Response.Response = future.Response() 3869 err = azure.NewAsyncOpIncompleteError("mysql.ServersCreateFuture") 3870 return 3871 } 3872 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3873 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 3874 s, err = client.CreateResponder(s.Response.Response) 3875 if err != nil { 3876 err = autorest.NewErrorWithError(err, "mysql.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request") 3877 } 3878 } 3879 return 3880} 3881 3882// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 3883// operation. 3884type ServersDeleteFuture struct { 3885 azure.FutureAPI 3886 // Result returns the result of the asynchronous operation. 3887 // If the operation has not completed it will return an error. 3888 Result func(ServersClient) (autorest.Response, error) 3889} 3890 3891// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3892func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error { 3893 var azFuture azure.Future 3894 if err := json.Unmarshal(body, &azFuture); err != nil { 3895 return err 3896 } 3897 future.FutureAPI = &azFuture 3898 future.Result = future.result 3899 return nil 3900} 3901 3902// result is the default implementation for ServersDeleteFuture.Result. 3903func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { 3904 var done bool 3905 done, err = future.DoneWithContext(context.Background(), client) 3906 if err != nil { 3907 err = autorest.NewErrorWithError(err, "mysql.ServersDeleteFuture", "Result", future.Response(), "Polling failure") 3908 return 3909 } 3910 if !done { 3911 ar.Response = future.Response() 3912 err = azure.NewAsyncOpIncompleteError("mysql.ServersDeleteFuture") 3913 return 3914 } 3915 ar.Response = future.Response() 3916 return 3917} 3918 3919// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 3920// of a long-running operation. 3921type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct { 3922 azure.FutureAPI 3923 // Result returns the result of the asynchronous operation. 3924 // If the operation has not completed it will return an error. 3925 Result func(ServerSecurityAlertPoliciesClient) (ServerSecurityAlertPolicy, error) 3926} 3927 3928// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3929func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 3930 var azFuture azure.Future 3931 if err := json.Unmarshal(body, &azFuture); err != nil { 3932 return err 3933 } 3934 future.FutureAPI = &azFuture 3935 future.Result = future.result 3936 return nil 3937} 3938 3939// result is the default implementation for ServerSecurityAlertPoliciesCreateOrUpdateFuture.Result. 3940func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) { 3941 var done bool 3942 done, err = future.DoneWithContext(context.Background(), client) 3943 if err != nil { 3944 err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 3945 return 3946 } 3947 if !done { 3948 ssap.Response.Response = future.Response() 3949 err = azure.NewAsyncOpIncompleteError("mysql.ServerSecurityAlertPoliciesCreateOrUpdateFuture") 3950 return 3951 } 3952 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3953 if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { 3954 ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) 3955 if err != nil { 3956 err = autorest.NewErrorWithError(err, "mysql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") 3957 } 3958 } 3959 return 3960} 3961 3962// ServerSecurityAlertPolicy a server security alert policy. 3963type ServerSecurityAlertPolicy struct { 3964 autorest.Response `json:"-"` 3965 // SecurityAlertPolicyProperties - Resource properties. 3966 *SecurityAlertPolicyProperties `json:"properties,omitempty"` 3967 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 3968 ID *string `json:"id,omitempty"` 3969 // Name - READ-ONLY; The name of the resource 3970 Name *string `json:"name,omitempty"` 3971 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 3972 Type *string `json:"type,omitempty"` 3973} 3974 3975// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy. 3976func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { 3977 objectMap := make(map[string]interface{}) 3978 if ssap.SecurityAlertPolicyProperties != nil { 3979 objectMap["properties"] = ssap.SecurityAlertPolicyProperties 3980 } 3981 return json.Marshal(objectMap) 3982} 3983 3984// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. 3985func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { 3986 var m map[string]*json.RawMessage 3987 err := json.Unmarshal(body, &m) 3988 if err != nil { 3989 return err 3990 } 3991 for k, v := range m { 3992 switch k { 3993 case "properties": 3994 if v != nil { 3995 var securityAlertPolicyProperties SecurityAlertPolicyProperties 3996 err = json.Unmarshal(*v, &securityAlertPolicyProperties) 3997 if err != nil { 3998 return err 3999 } 4000 ssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties 4001 } 4002 case "id": 4003 if v != nil { 4004 var ID string 4005 err = json.Unmarshal(*v, &ID) 4006 if err != nil { 4007 return err 4008 } 4009 ssap.ID = &ID 4010 } 4011 case "name": 4012 if v != nil { 4013 var name string 4014 err = json.Unmarshal(*v, &name) 4015 if err != nil { 4016 return err 4017 } 4018 ssap.Name = &name 4019 } 4020 case "type": 4021 if v != nil { 4022 var typeVar string 4023 err = json.Unmarshal(*v, &typeVar) 4024 if err != nil { 4025 return err 4026 } 4027 ssap.Type = &typeVar 4028 } 4029 } 4030 } 4031 4032 return nil 4033} 4034 4035// ServerSecurityAlertPolicyListResult a list of the server's security alert policies. 4036type ServerSecurityAlertPolicyListResult struct { 4037 autorest.Response `json:"-"` 4038 // Value - READ-ONLY; Array of results. 4039 Value *[]ServerSecurityAlertPolicy `json:"value,omitempty"` 4040 // NextLink - READ-ONLY; Link to retrieve next page of results. 4041 NextLink *string `json:"nextLink,omitempty"` 4042} 4043 4044// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicyListResult. 4045func (ssaplr ServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { 4046 objectMap := make(map[string]interface{}) 4047 return json.Marshal(objectMap) 4048} 4049 4050// ServerSecurityAlertPolicyListResultIterator provides access to a complete listing of 4051// ServerSecurityAlertPolicy values. 4052type ServerSecurityAlertPolicyListResultIterator struct { 4053 i int 4054 page ServerSecurityAlertPolicyListResultPage 4055} 4056 4057// NextWithContext advances to the next value. If there was an error making 4058// the request the iterator does not advance and the error is returned. 4059func (iter *ServerSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { 4060 if tracing.IsEnabled() { 4061 ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPolicyListResultIterator.NextWithContext") 4062 defer func() { 4063 sc := -1 4064 if iter.Response().Response.Response != nil { 4065 sc = iter.Response().Response.Response.StatusCode 4066 } 4067 tracing.EndSpan(ctx, sc, err) 4068 }() 4069 } 4070 iter.i++ 4071 if iter.i < len(iter.page.Values()) { 4072 return nil 4073 } 4074 err = iter.page.NextWithContext(ctx) 4075 if err != nil { 4076 iter.i-- 4077 return err 4078 } 4079 iter.i = 0 4080 return nil 4081} 4082 4083// Next advances to the next value. If there was an error making 4084// the request the iterator does not advance and the error is returned. 4085// Deprecated: Use NextWithContext() instead. 4086func (iter *ServerSecurityAlertPolicyListResultIterator) Next() error { 4087 return iter.NextWithContext(context.Background()) 4088} 4089 4090// NotDone returns true if the enumeration should be started or is not yet complete. 4091func (iter ServerSecurityAlertPolicyListResultIterator) NotDone() bool { 4092 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4093} 4094 4095// Response returns the raw server response from the last page request. 4096func (iter ServerSecurityAlertPolicyListResultIterator) Response() ServerSecurityAlertPolicyListResult { 4097 return iter.page.Response() 4098} 4099 4100// Value returns the current value or a zero-initialized value if the 4101// iterator has advanced beyond the end of the collection. 4102func (iter ServerSecurityAlertPolicyListResultIterator) Value() ServerSecurityAlertPolicy { 4103 if !iter.page.NotDone() { 4104 return ServerSecurityAlertPolicy{} 4105 } 4106 return iter.page.Values()[iter.i] 4107} 4108 4109// Creates a new instance of the ServerSecurityAlertPolicyListResultIterator type. 4110func NewServerSecurityAlertPolicyListResultIterator(page ServerSecurityAlertPolicyListResultPage) ServerSecurityAlertPolicyListResultIterator { 4111 return ServerSecurityAlertPolicyListResultIterator{page: page} 4112} 4113 4114// IsEmpty returns true if the ListResult contains no values. 4115func (ssaplr ServerSecurityAlertPolicyListResult) IsEmpty() bool { 4116 return ssaplr.Value == nil || len(*ssaplr.Value) == 0 4117} 4118 4119// hasNextLink returns true if the NextLink is not empty. 4120func (ssaplr ServerSecurityAlertPolicyListResult) hasNextLink() bool { 4121 return ssaplr.NextLink != nil && len(*ssaplr.NextLink) != 0 4122} 4123 4124// serverSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. 4125// It returns nil if no more results exist. 4126func (ssaplr ServerSecurityAlertPolicyListResult) serverSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { 4127 if !ssaplr.hasNextLink() { 4128 return nil, nil 4129 } 4130 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4131 autorest.AsJSON(), 4132 autorest.AsGet(), 4133 autorest.WithBaseURL(to.String(ssaplr.NextLink))) 4134} 4135 4136// ServerSecurityAlertPolicyListResultPage contains a page of ServerSecurityAlertPolicy values. 4137type ServerSecurityAlertPolicyListResultPage struct { 4138 fn func(context.Context, ServerSecurityAlertPolicyListResult) (ServerSecurityAlertPolicyListResult, error) 4139 ssaplr ServerSecurityAlertPolicyListResult 4140} 4141 4142// NextWithContext advances to the next page of values. If there was an error making 4143// the request the page does not advance and the error is returned. 4144func (page *ServerSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { 4145 if tracing.IsEnabled() { 4146 ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPolicyListResultPage.NextWithContext") 4147 defer func() { 4148 sc := -1 4149 if page.Response().Response.Response != nil { 4150 sc = page.Response().Response.Response.StatusCode 4151 } 4152 tracing.EndSpan(ctx, sc, err) 4153 }() 4154 } 4155 for { 4156 next, err := page.fn(ctx, page.ssaplr) 4157 if err != nil { 4158 return err 4159 } 4160 page.ssaplr = next 4161 if !next.hasNextLink() || !next.IsEmpty() { 4162 break 4163 } 4164 } 4165 return nil 4166} 4167 4168// Next advances to the next page of values. If there was an error making 4169// the request the page does not advance and the error is returned. 4170// Deprecated: Use NextWithContext() instead. 4171func (page *ServerSecurityAlertPolicyListResultPage) Next() error { 4172 return page.NextWithContext(context.Background()) 4173} 4174 4175// NotDone returns true if the page enumeration should be started or is not yet complete. 4176func (page ServerSecurityAlertPolicyListResultPage) NotDone() bool { 4177 return !page.ssaplr.IsEmpty() 4178} 4179 4180// Response returns the raw server response from the last page request. 4181func (page ServerSecurityAlertPolicyListResultPage) Response() ServerSecurityAlertPolicyListResult { 4182 return page.ssaplr 4183} 4184 4185// Values returns the slice of values for the current page or nil if there are no values. 4186func (page ServerSecurityAlertPolicyListResultPage) Values() []ServerSecurityAlertPolicy { 4187 if page.ssaplr.IsEmpty() { 4188 return nil 4189 } 4190 return *page.ssaplr.Value 4191} 4192 4193// Creates a new instance of the ServerSecurityAlertPolicyListResultPage type. 4194func NewServerSecurityAlertPolicyListResultPage(cur ServerSecurityAlertPolicyListResult, getNextPage func(context.Context, ServerSecurityAlertPolicyListResult) (ServerSecurityAlertPolicyListResult, error)) ServerSecurityAlertPolicyListResultPage { 4195 return ServerSecurityAlertPolicyListResultPage{ 4196 fn: getNextPage, 4197 ssaplr: cur, 4198 } 4199} 4200 4201// ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running 4202// operation. 4203type ServersRestartFuture struct { 4204 azure.FutureAPI 4205 // Result returns the result of the asynchronous operation. 4206 // If the operation has not completed it will return an error. 4207 Result func(ServersClient) (autorest.Response, error) 4208} 4209 4210// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4211func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error { 4212 var azFuture azure.Future 4213 if err := json.Unmarshal(body, &azFuture); err != nil { 4214 return err 4215 } 4216 future.FutureAPI = &azFuture 4217 future.Result = future.result 4218 return nil 4219} 4220 4221// result is the default implementation for ServersRestartFuture.Result. 4222func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) { 4223 var done bool 4224 done, err = future.DoneWithContext(context.Background(), client) 4225 if err != nil { 4226 err = autorest.NewErrorWithError(err, "mysql.ServersRestartFuture", "Result", future.Response(), "Polling failure") 4227 return 4228 } 4229 if !done { 4230 ar.Response = future.Response() 4231 err = azure.NewAsyncOpIncompleteError("mysql.ServersRestartFuture") 4232 return 4233 } 4234 ar.Response = future.Response() 4235 return 4236} 4237 4238// ServersStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. 4239type ServersStartFuture struct { 4240 azure.FutureAPI 4241 // Result returns the result of the asynchronous operation. 4242 // If the operation has not completed it will return an error. 4243 Result func(ServersClient) (autorest.Response, error) 4244} 4245 4246// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4247func (future *ServersStartFuture) UnmarshalJSON(body []byte) error { 4248 var azFuture azure.Future 4249 if err := json.Unmarshal(body, &azFuture); err != nil { 4250 return err 4251 } 4252 future.FutureAPI = &azFuture 4253 future.Result = future.result 4254 return nil 4255} 4256 4257// result is the default implementation for ServersStartFuture.Result. 4258func (future *ServersStartFuture) result(client ServersClient) (ar autorest.Response, err error) { 4259 var done bool 4260 done, err = future.DoneWithContext(context.Background(), client) 4261 if err != nil { 4262 err = autorest.NewErrorWithError(err, "mysql.ServersStartFuture", "Result", future.Response(), "Polling failure") 4263 return 4264 } 4265 if !done { 4266 ar.Response = future.Response() 4267 err = azure.NewAsyncOpIncompleteError("mysql.ServersStartFuture") 4268 return 4269 } 4270 ar.Response = future.Response() 4271 return 4272} 4273 4274// ServersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. 4275type ServersStopFuture struct { 4276 azure.FutureAPI 4277 // Result returns the result of the asynchronous operation. 4278 // If the operation has not completed it will return an error. 4279 Result func(ServersClient) (autorest.Response, error) 4280} 4281 4282// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4283func (future *ServersStopFuture) UnmarshalJSON(body []byte) error { 4284 var azFuture azure.Future 4285 if err := json.Unmarshal(body, &azFuture); err != nil { 4286 return err 4287 } 4288 future.FutureAPI = &azFuture 4289 future.Result = future.result 4290 return nil 4291} 4292 4293// result is the default implementation for ServersStopFuture.Result. 4294func (future *ServersStopFuture) result(client ServersClient) (ar autorest.Response, err error) { 4295 var done bool 4296 done, err = future.DoneWithContext(context.Background(), client) 4297 if err != nil { 4298 err = autorest.NewErrorWithError(err, "mysql.ServersStopFuture", "Result", future.Response(), "Polling failure") 4299 return 4300 } 4301 if !done { 4302 ar.Response = future.Response() 4303 err = azure.NewAsyncOpIncompleteError("mysql.ServersStopFuture") 4304 return 4305 } 4306 ar.Response = future.Response() 4307 return 4308} 4309 4310// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 4311// operation. 4312type ServersUpdateFuture struct { 4313 azure.FutureAPI 4314 // Result returns the result of the asynchronous operation. 4315 // If the operation has not completed it will return an error. 4316 Result func(ServersClient) (Server, error) 4317} 4318 4319// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4320func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error { 4321 var azFuture azure.Future 4322 if err := json.Unmarshal(body, &azFuture); err != nil { 4323 return err 4324 } 4325 future.FutureAPI = &azFuture 4326 future.Result = future.result 4327 return nil 4328} 4329 4330// result is the default implementation for ServersUpdateFuture.Result. 4331func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { 4332 var done bool 4333 done, err = future.DoneWithContext(context.Background(), client) 4334 if err != nil { 4335 err = autorest.NewErrorWithError(err, "mysql.ServersUpdateFuture", "Result", future.Response(), "Polling failure") 4336 return 4337 } 4338 if !done { 4339 s.Response.Response = future.Response() 4340 err = azure.NewAsyncOpIncompleteError("mysql.ServersUpdateFuture") 4341 return 4342 } 4343 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4344 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 4345 s, err = client.UpdateResponder(s.Response.Response) 4346 if err != nil { 4347 err = autorest.NewErrorWithError(err, "mysql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") 4348 } 4349 } 4350 return 4351} 4352 4353// ServersUpgradeFuture an abstraction for monitoring and retrieving the results of a long-running 4354// operation. 4355type ServersUpgradeFuture struct { 4356 azure.FutureAPI 4357 // Result returns the result of the asynchronous operation. 4358 // If the operation has not completed it will return an error. 4359 Result func(ServersClient) (autorest.Response, error) 4360} 4361 4362// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4363func (future *ServersUpgradeFuture) UnmarshalJSON(body []byte) error { 4364 var azFuture azure.Future 4365 if err := json.Unmarshal(body, &azFuture); err != nil { 4366 return err 4367 } 4368 future.FutureAPI = &azFuture 4369 future.Result = future.result 4370 return nil 4371} 4372 4373// result is the default implementation for ServersUpgradeFuture.Result. 4374func (future *ServersUpgradeFuture) result(client ServersClient) (ar autorest.Response, err error) { 4375 var done bool 4376 done, err = future.DoneWithContext(context.Background(), client) 4377 if err != nil { 4378 err = autorest.NewErrorWithError(err, "mysql.ServersUpgradeFuture", "Result", future.Response(), "Polling failure") 4379 return 4380 } 4381 if !done { 4382 ar.Response = future.Response() 4383 err = azure.NewAsyncOpIncompleteError("mysql.ServersUpgradeFuture") 4384 return 4385 } 4386 ar.Response = future.Response() 4387 return 4388} 4389 4390// ServerUpdateParameters parameters allowed to update for a server. 4391type ServerUpdateParameters struct { 4392 // Identity - The Azure Active Directory identity of the server. 4393 Identity *ResourceIdentity `json:"identity,omitempty"` 4394 // Sku - The SKU (pricing tier) of the server. 4395 Sku *Sku `json:"sku,omitempty"` 4396 // ServerUpdateParametersProperties - The properties that can be updated for a server. 4397 *ServerUpdateParametersProperties `json:"properties,omitempty"` 4398 // Tags - Application-specific metadata in the form of key-value pairs. 4399 Tags map[string]*string `json:"tags"` 4400} 4401 4402// MarshalJSON is the custom marshaler for ServerUpdateParameters. 4403func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) { 4404 objectMap := make(map[string]interface{}) 4405 if sup.Identity != nil { 4406 objectMap["identity"] = sup.Identity 4407 } 4408 if sup.Sku != nil { 4409 objectMap["sku"] = sup.Sku 4410 } 4411 if sup.ServerUpdateParametersProperties != nil { 4412 objectMap["properties"] = sup.ServerUpdateParametersProperties 4413 } 4414 if sup.Tags != nil { 4415 objectMap["tags"] = sup.Tags 4416 } 4417 return json.Marshal(objectMap) 4418} 4419 4420// UnmarshalJSON is the custom unmarshaler for ServerUpdateParameters struct. 4421func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error { 4422 var m map[string]*json.RawMessage 4423 err := json.Unmarshal(body, &m) 4424 if err != nil { 4425 return err 4426 } 4427 for k, v := range m { 4428 switch k { 4429 case "identity": 4430 if v != nil { 4431 var identity ResourceIdentity 4432 err = json.Unmarshal(*v, &identity) 4433 if err != nil { 4434 return err 4435 } 4436 sup.Identity = &identity 4437 } 4438 case "sku": 4439 if v != nil { 4440 var sku Sku 4441 err = json.Unmarshal(*v, &sku) 4442 if err != nil { 4443 return err 4444 } 4445 sup.Sku = &sku 4446 } 4447 case "properties": 4448 if v != nil { 4449 var serverUpdateParametersProperties ServerUpdateParametersProperties 4450 err = json.Unmarshal(*v, &serverUpdateParametersProperties) 4451 if err != nil { 4452 return err 4453 } 4454 sup.ServerUpdateParametersProperties = &serverUpdateParametersProperties 4455 } 4456 case "tags": 4457 if v != nil { 4458 var tags map[string]*string 4459 err = json.Unmarshal(*v, &tags) 4460 if err != nil { 4461 return err 4462 } 4463 sup.Tags = tags 4464 } 4465 } 4466 } 4467 4468 return nil 4469} 4470 4471// ServerUpdateParametersProperties the properties that can be updated for a server. 4472type ServerUpdateParametersProperties struct { 4473 // StorageProfile - Storage profile of a server. 4474 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 4475 // AdministratorLoginPassword - The password of the administrator login. 4476 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` 4477 // Version - The version of a server. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven', 'EightFullStopZero' 4478 Version ServerVersion `json:"version,omitempty"` 4479 // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' 4480 SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` 4481 // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' 4482 MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` 4483 // PublicNetworkAccess - 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' 4484 PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` 4485 // ReplicationRole - The replication role of the server. 4486 ReplicationRole *string `json:"replicationRole,omitempty"` 4487} 4488 4489// ServerUpgradeParameters ... 4490type ServerUpgradeParameters struct { 4491 // ServerUpgradeParametersProperties - The properties that can be updated for a server. 4492 *ServerUpgradeParametersProperties `json:"properties,omitempty"` 4493} 4494 4495// MarshalJSON is the custom marshaler for ServerUpgradeParameters. 4496func (sup ServerUpgradeParameters) MarshalJSON() ([]byte, error) { 4497 objectMap := make(map[string]interface{}) 4498 if sup.ServerUpgradeParametersProperties != nil { 4499 objectMap["properties"] = sup.ServerUpgradeParametersProperties 4500 } 4501 return json.Marshal(objectMap) 4502} 4503 4504// UnmarshalJSON is the custom unmarshaler for ServerUpgradeParameters struct. 4505func (sup *ServerUpgradeParameters) UnmarshalJSON(body []byte) error { 4506 var m map[string]*json.RawMessage 4507 err := json.Unmarshal(body, &m) 4508 if err != nil { 4509 return err 4510 } 4511 for k, v := range m { 4512 switch k { 4513 case "properties": 4514 if v != nil { 4515 var serverUpgradeParametersProperties ServerUpgradeParametersProperties 4516 err = json.Unmarshal(*v, &serverUpgradeParametersProperties) 4517 if err != nil { 4518 return err 4519 } 4520 sup.ServerUpgradeParametersProperties = &serverUpgradeParametersProperties 4521 } 4522 } 4523 } 4524 4525 return nil 4526} 4527 4528// ServerUpgradeParametersProperties the properties that can be updated for a server. 4529type ServerUpgradeParametersProperties struct { 4530 // TargetServerVersion - Represents an server storage profile. 4531 TargetServerVersion *string `json:"targetServerVersion,omitempty"` 4532} 4533 4534// Sku billing information related properties of a server. 4535type Sku struct { 4536 // Name - The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. 4537 Name *string `json:"name,omitempty"` 4538 // Tier - The tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized' 4539 Tier SkuTier `json:"tier,omitempty"` 4540 // Capacity - The scale up/out capacity, representing server's compute units. 4541 Capacity *int32 `json:"capacity,omitempty"` 4542 // Size - The size code, to be interpreted by resource as appropriate. 4543 Size *string `json:"size,omitempty"` 4544 // Family - The family of hardware. 4545 Family *string `json:"family,omitempty"` 4546} 4547 4548// StorageProfile storage Profile properties of a server 4549type StorageProfile struct { 4550 // BackupRetentionDays - Backup retention days for the server. 4551 BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` 4552 // GeoRedundantBackup - Enable Geo-redundant or not for server backup. Possible values include: 'Enabled', 'Disabled' 4553 GeoRedundantBackup GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` 4554 // StorageMB - Max storage allowed for a server. 4555 StorageMB *int32 `json:"storageMB,omitempty"` 4556 // StorageAutogrow - Enable Storage Auto Grow. Possible values include: 'StorageAutogrowEnabled', 'StorageAutogrowDisabled' 4557 StorageAutogrow StorageAutogrow `json:"storageAutogrow,omitempty"` 4558} 4559 4560// TagsObject tags object for patch operations. 4561type TagsObject struct { 4562 // Tags - Resource tags. 4563 Tags map[string]*string `json:"tags"` 4564} 4565 4566// MarshalJSON is the custom marshaler for TagsObject. 4567func (toVar TagsObject) MarshalJSON() ([]byte, error) { 4568 objectMap := make(map[string]interface{}) 4569 if toVar.Tags != nil { 4570 objectMap["tags"] = toVar.Tags 4571 } 4572 return json.Marshal(objectMap) 4573} 4574 4575// TopQueryStatisticsInput input to get top query statistics 4576type TopQueryStatisticsInput struct { 4577 // TopQueryStatisticsInputProperties - The properties of a wait statistics input. 4578 *TopQueryStatisticsInputProperties `json:"properties,omitempty"` 4579} 4580 4581// MarshalJSON is the custom marshaler for TopQueryStatisticsInput. 4582func (tqsi TopQueryStatisticsInput) MarshalJSON() ([]byte, error) { 4583 objectMap := make(map[string]interface{}) 4584 if tqsi.TopQueryStatisticsInputProperties != nil { 4585 objectMap["properties"] = tqsi.TopQueryStatisticsInputProperties 4586 } 4587 return json.Marshal(objectMap) 4588} 4589 4590// UnmarshalJSON is the custom unmarshaler for TopQueryStatisticsInput struct. 4591func (tqsi *TopQueryStatisticsInput) UnmarshalJSON(body []byte) error { 4592 var m map[string]*json.RawMessage 4593 err := json.Unmarshal(body, &m) 4594 if err != nil { 4595 return err 4596 } 4597 for k, v := range m { 4598 switch k { 4599 case "properties": 4600 if v != nil { 4601 var topQueryStatisticsInputProperties TopQueryStatisticsInputProperties 4602 err = json.Unmarshal(*v, &topQueryStatisticsInputProperties) 4603 if err != nil { 4604 return err 4605 } 4606 tqsi.TopQueryStatisticsInputProperties = &topQueryStatisticsInputProperties 4607 } 4608 } 4609 } 4610 4611 return nil 4612} 4613 4614// TopQueryStatisticsInputProperties the properties for input to get top query statistics 4615type TopQueryStatisticsInputProperties struct { 4616 // NumberOfTopQueries - Max number of top queries to return. 4617 NumberOfTopQueries *int32 `json:"numberOfTopQueries,omitempty"` 4618 // AggregationFunction - Aggregation function name. 4619 AggregationFunction *string `json:"aggregationFunction,omitempty"` 4620 // ObservedMetric - Observed metric name. 4621 ObservedMetric *string `json:"observedMetric,omitempty"` 4622 // ObservationStartTime - Observation start time. 4623 ObservationStartTime *date.Time `json:"observationStartTime,omitempty"` 4624 // ObservationEndTime - Observation end time. 4625 ObservationEndTime *date.Time `json:"observationEndTime,omitempty"` 4626 // AggregationWindow - Aggregation interval type in ISO 8601 format. 4627 AggregationWindow *string `json:"aggregationWindow,omitempty"` 4628} 4629 4630// TopQueryStatisticsResultList a list of query statistics. 4631type TopQueryStatisticsResultList struct { 4632 autorest.Response `json:"-"` 4633 // Value - READ-ONLY; The list of top query statistics. 4634 Value *[]QueryStatistic `json:"value,omitempty"` 4635 // NextLink - READ-ONLY; Link to retrieve next page of results. 4636 NextLink *string `json:"nextLink,omitempty"` 4637} 4638 4639// MarshalJSON is the custom marshaler for TopQueryStatisticsResultList. 4640func (tqsrl TopQueryStatisticsResultList) MarshalJSON() ([]byte, error) { 4641 objectMap := make(map[string]interface{}) 4642 return json.Marshal(objectMap) 4643} 4644 4645// TopQueryStatisticsResultListIterator provides access to a complete listing of QueryStatistic values. 4646type TopQueryStatisticsResultListIterator struct { 4647 i int 4648 page TopQueryStatisticsResultListPage 4649} 4650 4651// NextWithContext advances to the next value. If there was an error making 4652// the request the iterator does not advance and the error is returned. 4653func (iter *TopQueryStatisticsResultListIterator) NextWithContext(ctx context.Context) (err error) { 4654 if tracing.IsEnabled() { 4655 ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsResultListIterator.NextWithContext") 4656 defer func() { 4657 sc := -1 4658 if iter.Response().Response.Response != nil { 4659 sc = iter.Response().Response.Response.StatusCode 4660 } 4661 tracing.EndSpan(ctx, sc, err) 4662 }() 4663 } 4664 iter.i++ 4665 if iter.i < len(iter.page.Values()) { 4666 return nil 4667 } 4668 err = iter.page.NextWithContext(ctx) 4669 if err != nil { 4670 iter.i-- 4671 return err 4672 } 4673 iter.i = 0 4674 return nil 4675} 4676 4677// Next advances to the next value. If there was an error making 4678// the request the iterator does not advance and the error is returned. 4679// Deprecated: Use NextWithContext() instead. 4680func (iter *TopQueryStatisticsResultListIterator) Next() error { 4681 return iter.NextWithContext(context.Background()) 4682} 4683 4684// NotDone returns true if the enumeration should be started or is not yet complete. 4685func (iter TopQueryStatisticsResultListIterator) NotDone() bool { 4686 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4687} 4688 4689// Response returns the raw server response from the last page request. 4690func (iter TopQueryStatisticsResultListIterator) Response() TopQueryStatisticsResultList { 4691 return iter.page.Response() 4692} 4693 4694// Value returns the current value or a zero-initialized value if the 4695// iterator has advanced beyond the end of the collection. 4696func (iter TopQueryStatisticsResultListIterator) Value() QueryStatistic { 4697 if !iter.page.NotDone() { 4698 return QueryStatistic{} 4699 } 4700 return iter.page.Values()[iter.i] 4701} 4702 4703// Creates a new instance of the TopQueryStatisticsResultListIterator type. 4704func NewTopQueryStatisticsResultListIterator(page TopQueryStatisticsResultListPage) TopQueryStatisticsResultListIterator { 4705 return TopQueryStatisticsResultListIterator{page: page} 4706} 4707 4708// IsEmpty returns true if the ListResult contains no values. 4709func (tqsrl TopQueryStatisticsResultList) IsEmpty() bool { 4710 return tqsrl.Value == nil || len(*tqsrl.Value) == 0 4711} 4712 4713// hasNextLink returns true if the NextLink is not empty. 4714func (tqsrl TopQueryStatisticsResultList) hasNextLink() bool { 4715 return tqsrl.NextLink != nil && len(*tqsrl.NextLink) != 0 4716} 4717 4718// topQueryStatisticsResultListPreparer prepares a request to retrieve the next set of results. 4719// It returns nil if no more results exist. 4720func (tqsrl TopQueryStatisticsResultList) topQueryStatisticsResultListPreparer(ctx context.Context) (*http.Request, error) { 4721 if !tqsrl.hasNextLink() { 4722 return nil, nil 4723 } 4724 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4725 autorest.AsJSON(), 4726 autorest.AsGet(), 4727 autorest.WithBaseURL(to.String(tqsrl.NextLink))) 4728} 4729 4730// TopQueryStatisticsResultListPage contains a page of QueryStatistic values. 4731type TopQueryStatisticsResultListPage struct { 4732 fn func(context.Context, TopQueryStatisticsResultList) (TopQueryStatisticsResultList, error) 4733 tqsrl TopQueryStatisticsResultList 4734} 4735 4736// NextWithContext advances to the next page of values. If there was an error making 4737// the request the page does not advance and the error is returned. 4738func (page *TopQueryStatisticsResultListPage) NextWithContext(ctx context.Context) (err error) { 4739 if tracing.IsEnabled() { 4740 ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsResultListPage.NextWithContext") 4741 defer func() { 4742 sc := -1 4743 if page.Response().Response.Response != nil { 4744 sc = page.Response().Response.Response.StatusCode 4745 } 4746 tracing.EndSpan(ctx, sc, err) 4747 }() 4748 } 4749 for { 4750 next, err := page.fn(ctx, page.tqsrl) 4751 if err != nil { 4752 return err 4753 } 4754 page.tqsrl = next 4755 if !next.hasNextLink() || !next.IsEmpty() { 4756 break 4757 } 4758 } 4759 return nil 4760} 4761 4762// Next advances to the next page of values. If there was an error making 4763// the request the page does not advance and the error is returned. 4764// Deprecated: Use NextWithContext() instead. 4765func (page *TopQueryStatisticsResultListPage) Next() error { 4766 return page.NextWithContext(context.Background()) 4767} 4768 4769// NotDone returns true if the page enumeration should be started or is not yet complete. 4770func (page TopQueryStatisticsResultListPage) NotDone() bool { 4771 return !page.tqsrl.IsEmpty() 4772} 4773 4774// Response returns the raw server response from the last page request. 4775func (page TopQueryStatisticsResultListPage) Response() TopQueryStatisticsResultList { 4776 return page.tqsrl 4777} 4778 4779// Values returns the slice of values for the current page or nil if there are no values. 4780func (page TopQueryStatisticsResultListPage) Values() []QueryStatistic { 4781 if page.tqsrl.IsEmpty() { 4782 return nil 4783 } 4784 return *page.tqsrl.Value 4785} 4786 4787// Creates a new instance of the TopQueryStatisticsResultListPage type. 4788func NewTopQueryStatisticsResultListPage(cur TopQueryStatisticsResultList, getNextPage func(context.Context, TopQueryStatisticsResultList) (TopQueryStatisticsResultList, error)) TopQueryStatisticsResultListPage { 4789 return TopQueryStatisticsResultListPage{ 4790 fn: getNextPage, 4791 tqsrl: cur, 4792 } 4793} 4794 4795// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource 4796// which has 'tags' and a 'location' 4797type TrackedResource struct { 4798 // Tags - Resource tags. 4799 Tags map[string]*string `json:"tags"` 4800 // Location - The geo-location where the resource lives 4801 Location *string `json:"location,omitempty"` 4802 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 4803 ID *string `json:"id,omitempty"` 4804 // Name - READ-ONLY; The name of the resource 4805 Name *string `json:"name,omitempty"` 4806 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 4807 Type *string `json:"type,omitempty"` 4808} 4809 4810// MarshalJSON is the custom marshaler for TrackedResource. 4811func (tr TrackedResource) MarshalJSON() ([]byte, error) { 4812 objectMap := make(map[string]interface{}) 4813 if tr.Tags != nil { 4814 objectMap["tags"] = tr.Tags 4815 } 4816 if tr.Location != nil { 4817 objectMap["location"] = tr.Location 4818 } 4819 return json.Marshal(objectMap) 4820} 4821 4822// VirtualNetworkRule a virtual network rule. 4823type VirtualNetworkRule struct { 4824 autorest.Response `json:"-"` 4825 // VirtualNetworkRuleProperties - Resource properties. 4826 *VirtualNetworkRuleProperties `json:"properties,omitempty"` 4827 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 4828 ID *string `json:"id,omitempty"` 4829 // Name - READ-ONLY; The name of the resource 4830 Name *string `json:"name,omitempty"` 4831 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 4832 Type *string `json:"type,omitempty"` 4833} 4834 4835// MarshalJSON is the custom marshaler for VirtualNetworkRule. 4836func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { 4837 objectMap := make(map[string]interface{}) 4838 if vnr.VirtualNetworkRuleProperties != nil { 4839 objectMap["properties"] = vnr.VirtualNetworkRuleProperties 4840 } 4841 return json.Marshal(objectMap) 4842} 4843 4844// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct. 4845func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error { 4846 var m map[string]*json.RawMessage 4847 err := json.Unmarshal(body, &m) 4848 if err != nil { 4849 return err 4850 } 4851 for k, v := range m { 4852 switch k { 4853 case "properties": 4854 if v != nil { 4855 var virtualNetworkRuleProperties VirtualNetworkRuleProperties 4856 err = json.Unmarshal(*v, &virtualNetworkRuleProperties) 4857 if err != nil { 4858 return err 4859 } 4860 vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties 4861 } 4862 case "id": 4863 if v != nil { 4864 var ID string 4865 err = json.Unmarshal(*v, &ID) 4866 if err != nil { 4867 return err 4868 } 4869 vnr.ID = &ID 4870 } 4871 case "name": 4872 if v != nil { 4873 var name string 4874 err = json.Unmarshal(*v, &name) 4875 if err != nil { 4876 return err 4877 } 4878 vnr.Name = &name 4879 } 4880 case "type": 4881 if v != nil { 4882 var typeVar string 4883 err = json.Unmarshal(*v, &typeVar) 4884 if err != nil { 4885 return err 4886 } 4887 vnr.Type = &typeVar 4888 } 4889 } 4890 } 4891 4892 return nil 4893} 4894 4895// VirtualNetworkRuleListResult a list of virtual network rules. 4896type VirtualNetworkRuleListResult struct { 4897 autorest.Response `json:"-"` 4898 // Value - READ-ONLY; Array of results. 4899 Value *[]VirtualNetworkRule `json:"value,omitempty"` 4900 // NextLink - READ-ONLY; Link to retrieve next page of results. 4901 NextLink *string `json:"nextLink,omitempty"` 4902} 4903 4904// MarshalJSON is the custom marshaler for VirtualNetworkRuleListResult. 4905func (vnrlr VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { 4906 objectMap := make(map[string]interface{}) 4907 return json.Marshal(objectMap) 4908} 4909 4910// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values. 4911type VirtualNetworkRuleListResultIterator struct { 4912 i int 4913 page VirtualNetworkRuleListResultPage 4914} 4915 4916// NextWithContext advances to the next value. If there was an error making 4917// the request the iterator does not advance and the error is returned. 4918func (iter *VirtualNetworkRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { 4919 if tracing.IsEnabled() { 4920 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultIterator.NextWithContext") 4921 defer func() { 4922 sc := -1 4923 if iter.Response().Response.Response != nil { 4924 sc = iter.Response().Response.Response.StatusCode 4925 } 4926 tracing.EndSpan(ctx, sc, err) 4927 }() 4928 } 4929 iter.i++ 4930 if iter.i < len(iter.page.Values()) { 4931 return nil 4932 } 4933 err = iter.page.NextWithContext(ctx) 4934 if err != nil { 4935 iter.i-- 4936 return err 4937 } 4938 iter.i = 0 4939 return nil 4940} 4941 4942// Next advances to the next value. If there was an error making 4943// the request the iterator does not advance and the error is returned. 4944// Deprecated: Use NextWithContext() instead. 4945func (iter *VirtualNetworkRuleListResultIterator) Next() error { 4946 return iter.NextWithContext(context.Background()) 4947} 4948 4949// NotDone returns true if the enumeration should be started or is not yet complete. 4950func (iter VirtualNetworkRuleListResultIterator) NotDone() bool { 4951 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4952} 4953 4954// Response returns the raw server response from the last page request. 4955func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult { 4956 return iter.page.Response() 4957} 4958 4959// Value returns the current value or a zero-initialized value if the 4960// iterator has advanced beyond the end of the collection. 4961func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { 4962 if !iter.page.NotDone() { 4963 return VirtualNetworkRule{} 4964 } 4965 return iter.page.Values()[iter.i] 4966} 4967 4968// Creates a new instance of the VirtualNetworkRuleListResultIterator type. 4969func NewVirtualNetworkRuleListResultIterator(page VirtualNetworkRuleListResultPage) VirtualNetworkRuleListResultIterator { 4970 return VirtualNetworkRuleListResultIterator{page: page} 4971} 4972 4973// IsEmpty returns true if the ListResult contains no values. 4974func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool { 4975 return vnrlr.Value == nil || len(*vnrlr.Value) == 0 4976} 4977 4978// hasNextLink returns true if the NextLink is not empty. 4979func (vnrlr VirtualNetworkRuleListResult) hasNextLink() bool { 4980 return vnrlr.NextLink != nil && len(*vnrlr.NextLink) != 0 4981} 4982 4983// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results. 4984// It returns nil if no more results exist. 4985func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer(ctx context.Context) (*http.Request, error) { 4986 if !vnrlr.hasNextLink() { 4987 return nil, nil 4988 } 4989 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4990 autorest.AsJSON(), 4991 autorest.AsGet(), 4992 autorest.WithBaseURL(to.String(vnrlr.NextLink))) 4993} 4994 4995// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values. 4996type VirtualNetworkRuleListResultPage struct { 4997 fn func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error) 4998 vnrlr VirtualNetworkRuleListResult 4999} 5000 5001// NextWithContext advances to the next page of values. If there was an error making 5002// the request the page does not advance and the error is returned. 5003func (page *VirtualNetworkRuleListResultPage) NextWithContext(ctx context.Context) (err error) { 5004 if tracing.IsEnabled() { 5005 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultPage.NextWithContext") 5006 defer func() { 5007 sc := -1 5008 if page.Response().Response.Response != nil { 5009 sc = page.Response().Response.Response.StatusCode 5010 } 5011 tracing.EndSpan(ctx, sc, err) 5012 }() 5013 } 5014 for { 5015 next, err := page.fn(ctx, page.vnrlr) 5016 if err != nil { 5017 return err 5018 } 5019 page.vnrlr = next 5020 if !next.hasNextLink() || !next.IsEmpty() { 5021 break 5022 } 5023 } 5024 return nil 5025} 5026 5027// Next advances to the next page of values. If there was an error making 5028// the request the page does not advance and the error is returned. 5029// Deprecated: Use NextWithContext() instead. 5030func (page *VirtualNetworkRuleListResultPage) Next() error { 5031 return page.NextWithContext(context.Background()) 5032} 5033 5034// NotDone returns true if the page enumeration should be started or is not yet complete. 5035func (page VirtualNetworkRuleListResultPage) NotDone() bool { 5036 return !page.vnrlr.IsEmpty() 5037} 5038 5039// Response returns the raw server response from the last page request. 5040func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult { 5041 return page.vnrlr 5042} 5043 5044// Values returns the slice of values for the current page or nil if there are no values. 5045func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { 5046 if page.vnrlr.IsEmpty() { 5047 return nil 5048 } 5049 return *page.vnrlr.Value 5050} 5051 5052// Creates a new instance of the VirtualNetworkRuleListResultPage type. 5053func NewVirtualNetworkRuleListResultPage(cur VirtualNetworkRuleListResult, getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage { 5054 return VirtualNetworkRuleListResultPage{ 5055 fn: getNextPage, 5056 vnrlr: cur, 5057 } 5058} 5059 5060// VirtualNetworkRuleProperties properties of a virtual network rule. 5061type VirtualNetworkRuleProperties struct { 5062 // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. 5063 VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` 5064 // IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. 5065 IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` 5066 // State - READ-ONLY; Virtual Network Rule State. Possible values include: 'VirtualNetworkRuleStateInitializing', 'VirtualNetworkRuleStateInProgress', 'VirtualNetworkRuleStateReady', 'VirtualNetworkRuleStateDeleting', 'VirtualNetworkRuleStateUnknown' 5067 State VirtualNetworkRuleState `json:"state,omitempty"` 5068} 5069 5070// MarshalJSON is the custom marshaler for VirtualNetworkRuleProperties. 5071func (vnrp VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) { 5072 objectMap := make(map[string]interface{}) 5073 if vnrp.VirtualNetworkSubnetID != nil { 5074 objectMap["virtualNetworkSubnetId"] = vnrp.VirtualNetworkSubnetID 5075 } 5076 if vnrp.IgnoreMissingVnetServiceEndpoint != nil { 5077 objectMap["ignoreMissingVnetServiceEndpoint"] = vnrp.IgnoreMissingVnetServiceEndpoint 5078 } 5079 return json.Marshal(objectMap) 5080} 5081 5082// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 5083// long-running operation. 5084type VirtualNetworkRulesCreateOrUpdateFuture struct { 5085 azure.FutureAPI 5086 // Result returns the result of the asynchronous operation. 5087 // If the operation has not completed it will return an error. 5088 Result func(VirtualNetworkRulesClient) (VirtualNetworkRule, error) 5089} 5090 5091// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5092func (future *VirtualNetworkRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 5093 var azFuture azure.Future 5094 if err := json.Unmarshal(body, &azFuture); err != nil { 5095 return err 5096 } 5097 future.FutureAPI = &azFuture 5098 future.Result = future.result 5099 return nil 5100} 5101 5102// result is the default implementation for VirtualNetworkRulesCreateOrUpdateFuture.Result. 5103func (future *VirtualNetworkRulesCreateOrUpdateFuture) result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { 5104 var done bool 5105 done, err = future.DoneWithContext(context.Background(), client) 5106 if err != nil { 5107 err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 5108 return 5109 } 5110 if !done { 5111 vnr.Response.Response = future.Response() 5112 err = azure.NewAsyncOpIncompleteError("mysql.VirtualNetworkRulesCreateOrUpdateFuture") 5113 return 5114 } 5115 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5116 if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent { 5117 vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response) 5118 if err != nil { 5119 err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request") 5120 } 5121 } 5122 return 5123} 5124 5125// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a 5126// long-running operation. 5127type VirtualNetworkRulesDeleteFuture struct { 5128 azure.FutureAPI 5129 // Result returns the result of the asynchronous operation. 5130 // If the operation has not completed it will return an error. 5131 Result func(VirtualNetworkRulesClient) (autorest.Response, error) 5132} 5133 5134// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5135func (future *VirtualNetworkRulesDeleteFuture) UnmarshalJSON(body []byte) error { 5136 var azFuture azure.Future 5137 if err := json.Unmarshal(body, &azFuture); err != nil { 5138 return err 5139 } 5140 future.FutureAPI = &azFuture 5141 future.Result = future.result 5142 return nil 5143} 5144 5145// result is the default implementation for VirtualNetworkRulesDeleteFuture.Result. 5146func (future *VirtualNetworkRulesDeleteFuture) result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { 5147 var done bool 5148 done, err = future.DoneWithContext(context.Background(), client) 5149 if err != nil { 5150 err = autorest.NewErrorWithError(err, "mysql.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure") 5151 return 5152 } 5153 if !done { 5154 ar.Response = future.Response() 5155 err = azure.NewAsyncOpIncompleteError("mysql.VirtualNetworkRulesDeleteFuture") 5156 return 5157 } 5158 ar.Response = future.Response() 5159 return 5160} 5161 5162// WaitStatistic represents a Wait Statistic. 5163type WaitStatistic struct { 5164 autorest.Response `json:"-"` 5165 // WaitStatisticProperties - The properties of a wait statistic. 5166 *WaitStatisticProperties `json:"properties,omitempty"` 5167 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 5168 ID *string `json:"id,omitempty"` 5169 // Name - READ-ONLY; The name of the resource 5170 Name *string `json:"name,omitempty"` 5171 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 5172 Type *string `json:"type,omitempty"` 5173} 5174 5175// MarshalJSON is the custom marshaler for WaitStatistic. 5176func (ws WaitStatistic) MarshalJSON() ([]byte, error) { 5177 objectMap := make(map[string]interface{}) 5178 if ws.WaitStatisticProperties != nil { 5179 objectMap["properties"] = ws.WaitStatisticProperties 5180 } 5181 return json.Marshal(objectMap) 5182} 5183 5184// UnmarshalJSON is the custom unmarshaler for WaitStatistic struct. 5185func (ws *WaitStatistic) UnmarshalJSON(body []byte) error { 5186 var m map[string]*json.RawMessage 5187 err := json.Unmarshal(body, &m) 5188 if err != nil { 5189 return err 5190 } 5191 for k, v := range m { 5192 switch k { 5193 case "properties": 5194 if v != nil { 5195 var waitStatisticProperties WaitStatisticProperties 5196 err = json.Unmarshal(*v, &waitStatisticProperties) 5197 if err != nil { 5198 return err 5199 } 5200 ws.WaitStatisticProperties = &waitStatisticProperties 5201 } 5202 case "id": 5203 if v != nil { 5204 var ID string 5205 err = json.Unmarshal(*v, &ID) 5206 if err != nil { 5207 return err 5208 } 5209 ws.ID = &ID 5210 } 5211 case "name": 5212 if v != nil { 5213 var name string 5214 err = json.Unmarshal(*v, &name) 5215 if err != nil { 5216 return err 5217 } 5218 ws.Name = &name 5219 } 5220 case "type": 5221 if v != nil { 5222 var typeVar string 5223 err = json.Unmarshal(*v, &typeVar) 5224 if err != nil { 5225 return err 5226 } 5227 ws.Type = &typeVar 5228 } 5229 } 5230 } 5231 5232 return nil 5233} 5234 5235// WaitStatisticProperties the properties of a wait statistic. 5236type WaitStatisticProperties struct { 5237 // StartTime - Observation start time. 5238 StartTime *date.Time `json:"startTime,omitempty"` 5239 // EndTime - Observation end time. 5240 EndTime *date.Time `json:"endTime,omitempty"` 5241 // EventName - Wait event name. 5242 EventName *string `json:"eventName,omitempty"` 5243 // EventTypeName - Wait event type name. 5244 EventTypeName *string `json:"eventTypeName,omitempty"` 5245 // QueryID - Database query identifier. 5246 QueryID *int64 `json:"queryId,omitempty"` 5247 // DatabaseName - Database Name. 5248 DatabaseName *string `json:"databaseName,omitempty"` 5249 // UserID - Database user identifier. 5250 UserID *int64 `json:"userId,omitempty"` 5251 // Count - Wait event count observed in this time interval. 5252 Count *int64 `json:"count,omitempty"` 5253 // TotalTimeInMs - Total time of wait in milliseconds in this time interval. 5254 TotalTimeInMs *float64 `json:"totalTimeInMs,omitempty"` 5255} 5256 5257// WaitStatisticsInput input to get wait statistics 5258type WaitStatisticsInput struct { 5259 // WaitStatisticsInputProperties - The properties of a wait statistics input. 5260 *WaitStatisticsInputProperties `json:"properties,omitempty"` 5261} 5262 5263// MarshalJSON is the custom marshaler for WaitStatisticsInput. 5264func (wsi WaitStatisticsInput) MarshalJSON() ([]byte, error) { 5265 objectMap := make(map[string]interface{}) 5266 if wsi.WaitStatisticsInputProperties != nil { 5267 objectMap["properties"] = wsi.WaitStatisticsInputProperties 5268 } 5269 return json.Marshal(objectMap) 5270} 5271 5272// UnmarshalJSON is the custom unmarshaler for WaitStatisticsInput struct. 5273func (wsi *WaitStatisticsInput) UnmarshalJSON(body []byte) error { 5274 var m map[string]*json.RawMessage 5275 err := json.Unmarshal(body, &m) 5276 if err != nil { 5277 return err 5278 } 5279 for k, v := range m { 5280 switch k { 5281 case "properties": 5282 if v != nil { 5283 var waitStatisticsInputProperties WaitStatisticsInputProperties 5284 err = json.Unmarshal(*v, &waitStatisticsInputProperties) 5285 if err != nil { 5286 return err 5287 } 5288 wsi.WaitStatisticsInputProperties = &waitStatisticsInputProperties 5289 } 5290 } 5291 } 5292 5293 return nil 5294} 5295 5296// WaitStatisticsInputProperties the properties for input to get wait statistics 5297type WaitStatisticsInputProperties struct { 5298 // ObservationStartTime - Observation start time. 5299 ObservationStartTime *date.Time `json:"observationStartTime,omitempty"` 5300 // ObservationEndTime - Observation end time. 5301 ObservationEndTime *date.Time `json:"observationEndTime,omitempty"` 5302 // AggregationWindow - Aggregation interval type in ISO 8601 format. 5303 AggregationWindow *string `json:"aggregationWindow,omitempty"` 5304} 5305 5306// WaitStatisticsResultList a list of wait statistics. 5307type WaitStatisticsResultList struct { 5308 autorest.Response `json:"-"` 5309 // Value - READ-ONLY; The list of wait statistics. 5310 Value *[]WaitStatistic `json:"value,omitempty"` 5311 // NextLink - READ-ONLY; Link to retrieve next page of results. 5312 NextLink *string `json:"nextLink,omitempty"` 5313} 5314 5315// MarshalJSON is the custom marshaler for WaitStatisticsResultList. 5316func (wsrl WaitStatisticsResultList) MarshalJSON() ([]byte, error) { 5317 objectMap := make(map[string]interface{}) 5318 return json.Marshal(objectMap) 5319} 5320 5321// WaitStatisticsResultListIterator provides access to a complete listing of WaitStatistic values. 5322type WaitStatisticsResultListIterator struct { 5323 i int 5324 page WaitStatisticsResultListPage 5325} 5326 5327// NextWithContext advances to the next value. If there was an error making 5328// the request the iterator does not advance and the error is returned. 5329func (iter *WaitStatisticsResultListIterator) NextWithContext(ctx context.Context) (err error) { 5330 if tracing.IsEnabled() { 5331 ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsResultListIterator.NextWithContext") 5332 defer func() { 5333 sc := -1 5334 if iter.Response().Response.Response != nil { 5335 sc = iter.Response().Response.Response.StatusCode 5336 } 5337 tracing.EndSpan(ctx, sc, err) 5338 }() 5339 } 5340 iter.i++ 5341 if iter.i < len(iter.page.Values()) { 5342 return nil 5343 } 5344 err = iter.page.NextWithContext(ctx) 5345 if err != nil { 5346 iter.i-- 5347 return err 5348 } 5349 iter.i = 0 5350 return nil 5351} 5352 5353// Next advances to the next value. If there was an error making 5354// the request the iterator does not advance and the error is returned. 5355// Deprecated: Use NextWithContext() instead. 5356func (iter *WaitStatisticsResultListIterator) Next() error { 5357 return iter.NextWithContext(context.Background()) 5358} 5359 5360// NotDone returns true if the enumeration should be started or is not yet complete. 5361func (iter WaitStatisticsResultListIterator) NotDone() bool { 5362 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5363} 5364 5365// Response returns the raw server response from the last page request. 5366func (iter WaitStatisticsResultListIterator) Response() WaitStatisticsResultList { 5367 return iter.page.Response() 5368} 5369 5370// Value returns the current value or a zero-initialized value if the 5371// iterator has advanced beyond the end of the collection. 5372func (iter WaitStatisticsResultListIterator) Value() WaitStatistic { 5373 if !iter.page.NotDone() { 5374 return WaitStatistic{} 5375 } 5376 return iter.page.Values()[iter.i] 5377} 5378 5379// Creates a new instance of the WaitStatisticsResultListIterator type. 5380func NewWaitStatisticsResultListIterator(page WaitStatisticsResultListPage) WaitStatisticsResultListIterator { 5381 return WaitStatisticsResultListIterator{page: page} 5382} 5383 5384// IsEmpty returns true if the ListResult contains no values. 5385func (wsrl WaitStatisticsResultList) IsEmpty() bool { 5386 return wsrl.Value == nil || len(*wsrl.Value) == 0 5387} 5388 5389// hasNextLink returns true if the NextLink is not empty. 5390func (wsrl WaitStatisticsResultList) hasNextLink() bool { 5391 return wsrl.NextLink != nil && len(*wsrl.NextLink) != 0 5392} 5393 5394// waitStatisticsResultListPreparer prepares a request to retrieve the next set of results. 5395// It returns nil if no more results exist. 5396func (wsrl WaitStatisticsResultList) waitStatisticsResultListPreparer(ctx context.Context) (*http.Request, error) { 5397 if !wsrl.hasNextLink() { 5398 return nil, nil 5399 } 5400 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5401 autorest.AsJSON(), 5402 autorest.AsGet(), 5403 autorest.WithBaseURL(to.String(wsrl.NextLink))) 5404} 5405 5406// WaitStatisticsResultListPage contains a page of WaitStatistic values. 5407type WaitStatisticsResultListPage struct { 5408 fn func(context.Context, WaitStatisticsResultList) (WaitStatisticsResultList, error) 5409 wsrl WaitStatisticsResultList 5410} 5411 5412// NextWithContext advances to the next page of values. If there was an error making 5413// the request the page does not advance and the error is returned. 5414func (page *WaitStatisticsResultListPage) NextWithContext(ctx context.Context) (err error) { 5415 if tracing.IsEnabled() { 5416 ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsResultListPage.NextWithContext") 5417 defer func() { 5418 sc := -1 5419 if page.Response().Response.Response != nil { 5420 sc = page.Response().Response.Response.StatusCode 5421 } 5422 tracing.EndSpan(ctx, sc, err) 5423 }() 5424 } 5425 for { 5426 next, err := page.fn(ctx, page.wsrl) 5427 if err != nil { 5428 return err 5429 } 5430 page.wsrl = next 5431 if !next.hasNextLink() || !next.IsEmpty() { 5432 break 5433 } 5434 } 5435 return nil 5436} 5437 5438// Next advances to the next page of values. If there was an error making 5439// the request the page does not advance and the error is returned. 5440// Deprecated: Use NextWithContext() instead. 5441func (page *WaitStatisticsResultListPage) Next() error { 5442 return page.NextWithContext(context.Background()) 5443} 5444 5445// NotDone returns true if the page enumeration should be started or is not yet complete. 5446func (page WaitStatisticsResultListPage) NotDone() bool { 5447 return !page.wsrl.IsEmpty() 5448} 5449 5450// Response returns the raw server response from the last page request. 5451func (page WaitStatisticsResultListPage) Response() WaitStatisticsResultList { 5452 return page.wsrl 5453} 5454 5455// Values returns the slice of values for the current page or nil if there are no values. 5456func (page WaitStatisticsResultListPage) Values() []WaitStatistic { 5457 if page.wsrl.IsEmpty() { 5458 return nil 5459 } 5460 return *page.wsrl.Value 5461} 5462 5463// Creates a new instance of the WaitStatisticsResultListPage type. 5464func NewWaitStatisticsResultListPage(cur WaitStatisticsResultList, getNextPage func(context.Context, WaitStatisticsResultList) (WaitStatisticsResultList, error)) WaitStatisticsResultListPage { 5465 return WaitStatisticsResultListPage{ 5466 fn: getNextPage, 5467 wsrl: cur, 5468 } 5469} 5470