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