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