1package sql 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "github.com/gofrs/uuid" 18 "net/http" 19) 20 21// The package's fully qualified name. 22const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-03-01-preview/sql" 23 24// AutomaticTuningOptions automatic tuning properties for individual advisors. 25type AutomaticTuningOptions struct { 26 // DesiredState - Automatic tuning option desired state. Possible values include: 'AutomaticTuningOptionModeDesiredOff', 'AutomaticTuningOptionModeDesiredOn', 'AutomaticTuningOptionModeDesiredDefault' 27 DesiredState AutomaticTuningOptionModeDesired `json:"desiredState,omitempty"` 28 // ActualState - READ-ONLY; Automatic tuning option actual state. Possible values include: 'Off', 'On' 29 ActualState AutomaticTuningOptionModeActual `json:"actualState,omitempty"` 30 // ReasonCode - READ-ONLY; Reason code if desired and actual state are different. 31 ReasonCode *int32 `json:"reasonCode,omitempty"` 32 // ReasonDesc - READ-ONLY; Reason description if desired and actual state are different. Possible values include: 'Default', 'Disabled', 'AutoConfigured', 'InheritedFromServer', 'QueryStoreOff', 'QueryStoreReadOnly', 'NotSupported' 33 ReasonDesc AutomaticTuningDisabledReason `json:"reasonDesc,omitempty"` 34} 35 36// MarshalJSON is the custom marshaler for AutomaticTuningOptions. 37func (ato AutomaticTuningOptions) MarshalJSON() ([]byte, error) { 38 objectMap := make(map[string]interface{}) 39 if ato.DesiredState != "" { 40 objectMap["desiredState"] = ato.DesiredState 41 } 42 return json.Marshal(objectMap) 43} 44 45// AutomaticTuningServerOptions automatic tuning properties for individual advisors. 46type AutomaticTuningServerOptions struct { 47 // DesiredState - Automatic tuning option desired state. Possible values include: 'AutomaticTuningOptionModeDesiredOff', 'AutomaticTuningOptionModeDesiredOn', 'AutomaticTuningOptionModeDesiredDefault' 48 DesiredState AutomaticTuningOptionModeDesired `json:"desiredState,omitempty"` 49 // ActualState - READ-ONLY; Automatic tuning option actual state. Possible values include: 'Off', 'On' 50 ActualState AutomaticTuningOptionModeActual `json:"actualState,omitempty"` 51 // ReasonCode - READ-ONLY; Reason code if desired and actual state are different. 52 ReasonCode *int32 `json:"reasonCode,omitempty"` 53 // ReasonDesc - READ-ONLY; Reason description if desired and actual state are different. Possible values include: 'AutomaticTuningServerReasonDefault', 'AutomaticTuningServerReasonDisabled', 'AutomaticTuningServerReasonAutoConfigured' 54 ReasonDesc AutomaticTuningServerReason `json:"reasonDesc,omitempty"` 55} 56 57// MarshalJSON is the custom marshaler for AutomaticTuningServerOptions. 58func (atso AutomaticTuningServerOptions) MarshalJSON() ([]byte, error) { 59 objectMap := make(map[string]interface{}) 60 if atso.DesiredState != "" { 61 objectMap["desiredState"] = atso.DesiredState 62 } 63 return json.Marshal(objectMap) 64} 65 66// AutomaticTuningServerProperties server-level Automatic Tuning properties. 67type AutomaticTuningServerProperties struct { 68 // DesiredState - Automatic tuning desired state. Possible values include: 'AutomaticTuningServerModeCustom', 'AutomaticTuningServerModeAuto', 'AutomaticTuningServerModeUnspecified' 69 DesiredState AutomaticTuningServerMode `json:"desiredState,omitempty"` 70 // ActualState - READ-ONLY; Automatic tuning actual state. Possible values include: 'AutomaticTuningServerModeCustom', 'AutomaticTuningServerModeAuto', 'AutomaticTuningServerModeUnspecified' 71 ActualState AutomaticTuningServerMode `json:"actualState,omitempty"` 72 // Options - Automatic tuning options definition. 73 Options map[string]*AutomaticTuningServerOptions `json:"options"` 74} 75 76// MarshalJSON is the custom marshaler for AutomaticTuningServerProperties. 77func (atsp AutomaticTuningServerProperties) MarshalJSON() ([]byte, error) { 78 objectMap := make(map[string]interface{}) 79 if atsp.DesiredState != "" { 80 objectMap["desiredState"] = atsp.DesiredState 81 } 82 if atsp.Options != nil { 83 objectMap["options"] = atsp.Options 84 } 85 return json.Marshal(objectMap) 86} 87 88// CheckNameAvailabilityRequest a request to check whether the specified name for a resource is available. 89type CheckNameAvailabilityRequest struct { 90 // Name - The name whose availability is to be checked. 91 Name *string `json:"name,omitempty"` 92 // Type - The type of resource that is used as the scope of the availability check. 93 Type *string `json:"type,omitempty"` 94} 95 96// CheckNameAvailabilityResponse a response indicating whether the specified name for a resource is 97// available. 98type CheckNameAvailabilityResponse struct { 99 autorest.Response `json:"-"` 100 // Available - READ-ONLY; True if the name is available, otherwise false. 101 Available *bool `json:"available,omitempty"` 102 // Message - READ-ONLY; A message explaining why the name is unavailable. Will be null if the name is available. 103 Message *string `json:"message,omitempty"` 104 // Name - READ-ONLY; The name whose availability was checked. 105 Name *string `json:"name,omitempty"` 106 // Reason - READ-ONLY; The reason code explaining why the name is unavailable. Will be null if the name is available. Possible values include: 'Invalid', 'AlreadyExists' 107 Reason CheckNameAvailabilityReason `json:"reason,omitempty"` 108} 109 110// MarshalJSON is the custom marshaler for CheckNameAvailabilityResponse. 111func (cnar CheckNameAvailabilityResponse) MarshalJSON() ([]byte, error) { 112 objectMap := make(map[string]interface{}) 113 return json.Marshal(objectMap) 114} 115 116// CompleteDatabaseRestoreDefinition contains the information necessary to perform a complete database 117// restore operation. 118type CompleteDatabaseRestoreDefinition struct { 119 // LastBackupName - The last backup name to apply 120 LastBackupName *string `json:"lastBackupName,omitempty"` 121} 122 123// CreateDatabaseRestorePointDefinition contains the information necessary to perform a create database 124// restore point operation. 125type CreateDatabaseRestorePointDefinition struct { 126 // RestorePointLabel - The restore point label to apply 127 RestorePointLabel *string `json:"restorePointLabel,omitempty"` 128} 129 130// Database represents a database. 131type Database struct { 132 autorest.Response `json:"-"` 133 // Kind - READ-ONLY; Kind of database. This is metadata used for the Azure portal experience. 134 Kind *string `json:"kind,omitempty"` 135 // DatabaseProperties - The properties representing the resource. 136 *DatabaseProperties `json:"properties,omitempty"` 137 // Location - Resource location. 138 Location *string `json:"location,omitempty"` 139 // Tags - Resource tags. 140 Tags map[string]*string `json:"tags"` 141 // ID - READ-ONLY; Resource ID. 142 ID *string `json:"id,omitempty"` 143 // Name - READ-ONLY; Resource name. 144 Name *string `json:"name,omitempty"` 145 // Type - READ-ONLY; Resource type. 146 Type *string `json:"type,omitempty"` 147} 148 149// MarshalJSON is the custom marshaler for Database. 150func (d Database) MarshalJSON() ([]byte, error) { 151 objectMap := make(map[string]interface{}) 152 if d.DatabaseProperties != nil { 153 objectMap["properties"] = d.DatabaseProperties 154 } 155 if d.Location != nil { 156 objectMap["location"] = d.Location 157 } 158 if d.Tags != nil { 159 objectMap["tags"] = d.Tags 160 } 161 return json.Marshal(objectMap) 162} 163 164// UnmarshalJSON is the custom unmarshaler for Database struct. 165func (d *Database) UnmarshalJSON(body []byte) error { 166 var m map[string]*json.RawMessage 167 err := json.Unmarshal(body, &m) 168 if err != nil { 169 return err 170 } 171 for k, v := range m { 172 switch k { 173 case "kind": 174 if v != nil { 175 var kind string 176 err = json.Unmarshal(*v, &kind) 177 if err != nil { 178 return err 179 } 180 d.Kind = &kind 181 } 182 case "properties": 183 if v != nil { 184 var databaseProperties DatabaseProperties 185 err = json.Unmarshal(*v, &databaseProperties) 186 if err != nil { 187 return err 188 } 189 d.DatabaseProperties = &databaseProperties 190 } 191 case "location": 192 if v != nil { 193 var location string 194 err = json.Unmarshal(*v, &location) 195 if err != nil { 196 return err 197 } 198 d.Location = &location 199 } 200 case "tags": 201 if v != nil { 202 var tags map[string]*string 203 err = json.Unmarshal(*v, &tags) 204 if err != nil { 205 return err 206 } 207 d.Tags = tags 208 } 209 case "id": 210 if v != nil { 211 var ID string 212 err = json.Unmarshal(*v, &ID) 213 if err != nil { 214 return err 215 } 216 d.ID = &ID 217 } 218 case "name": 219 if v != nil { 220 var name string 221 err = json.Unmarshal(*v, &name) 222 if err != nil { 223 return err 224 } 225 d.Name = &name 226 } 227 case "type": 228 if v != nil { 229 var typeVar string 230 err = json.Unmarshal(*v, &typeVar) 231 if err != nil { 232 return err 233 } 234 d.Type = &typeVar 235 } 236 } 237 } 238 239 return nil 240} 241 242// DatabaseAutomaticTuning database-level Automatic Tuning. 243type DatabaseAutomaticTuning struct { 244 autorest.Response `json:"-"` 245 // DatabaseAutomaticTuningProperties - Resource properties. 246 *DatabaseAutomaticTuningProperties `json:"properties,omitempty"` 247 // ID - READ-ONLY; Resource ID. 248 ID *string `json:"id,omitempty"` 249 // Name - READ-ONLY; Resource name. 250 Name *string `json:"name,omitempty"` 251 // Type - READ-ONLY; Resource type. 252 Type *string `json:"type,omitempty"` 253} 254 255// MarshalJSON is the custom marshaler for DatabaseAutomaticTuning. 256func (dat DatabaseAutomaticTuning) MarshalJSON() ([]byte, error) { 257 objectMap := make(map[string]interface{}) 258 if dat.DatabaseAutomaticTuningProperties != nil { 259 objectMap["properties"] = dat.DatabaseAutomaticTuningProperties 260 } 261 return json.Marshal(objectMap) 262} 263 264// UnmarshalJSON is the custom unmarshaler for DatabaseAutomaticTuning struct. 265func (dat *DatabaseAutomaticTuning) UnmarshalJSON(body []byte) error { 266 var m map[string]*json.RawMessage 267 err := json.Unmarshal(body, &m) 268 if err != nil { 269 return err 270 } 271 for k, v := range m { 272 switch k { 273 case "properties": 274 if v != nil { 275 var databaseAutomaticTuningProperties DatabaseAutomaticTuningProperties 276 err = json.Unmarshal(*v, &databaseAutomaticTuningProperties) 277 if err != nil { 278 return err 279 } 280 dat.DatabaseAutomaticTuningProperties = &databaseAutomaticTuningProperties 281 } 282 case "id": 283 if v != nil { 284 var ID string 285 err = json.Unmarshal(*v, &ID) 286 if err != nil { 287 return err 288 } 289 dat.ID = &ID 290 } 291 case "name": 292 if v != nil { 293 var name string 294 err = json.Unmarshal(*v, &name) 295 if err != nil { 296 return err 297 } 298 dat.Name = &name 299 } 300 case "type": 301 if v != nil { 302 var typeVar string 303 err = json.Unmarshal(*v, &typeVar) 304 if err != nil { 305 return err 306 } 307 dat.Type = &typeVar 308 } 309 } 310 } 311 312 return nil 313} 314 315// DatabaseAutomaticTuningProperties database-level Automatic Tuning properties. 316type DatabaseAutomaticTuningProperties struct { 317 // DesiredState - Automatic tuning desired state. Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' 318 DesiredState AutomaticTuningMode `json:"desiredState,omitempty"` 319 // ActualState - READ-ONLY; Automatic tuning actual state. Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' 320 ActualState AutomaticTuningMode `json:"actualState,omitempty"` 321 // Options - Automatic tuning options definition. 322 Options map[string]*AutomaticTuningOptions `json:"options"` 323} 324 325// MarshalJSON is the custom marshaler for DatabaseAutomaticTuningProperties. 326func (datp DatabaseAutomaticTuningProperties) MarshalJSON() ([]byte, error) { 327 objectMap := make(map[string]interface{}) 328 if datp.DesiredState != "" { 329 objectMap["desiredState"] = datp.DesiredState 330 } 331 if datp.Options != nil { 332 objectMap["options"] = datp.Options 333 } 334 return json.Marshal(objectMap) 335} 336 337// DatabaseBlobAuditingPolicy a database blob auditing policy. 338type DatabaseBlobAuditingPolicy struct { 339 autorest.Response `json:"-"` 340 // Kind - READ-ONLY; Resource kind. 341 Kind *string `json:"kind,omitempty"` 342 // DatabaseBlobAuditingPolicyProperties - Resource properties. 343 *DatabaseBlobAuditingPolicyProperties `json:"properties,omitempty"` 344 // ID - READ-ONLY; Resource ID. 345 ID *string `json:"id,omitempty"` 346 // Name - READ-ONLY; Resource name. 347 Name *string `json:"name,omitempty"` 348 // Type - READ-ONLY; Resource type. 349 Type *string `json:"type,omitempty"` 350} 351 352// MarshalJSON is the custom marshaler for DatabaseBlobAuditingPolicy. 353func (dbap DatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) { 354 objectMap := make(map[string]interface{}) 355 if dbap.DatabaseBlobAuditingPolicyProperties != nil { 356 objectMap["properties"] = dbap.DatabaseBlobAuditingPolicyProperties 357 } 358 return json.Marshal(objectMap) 359} 360 361// UnmarshalJSON is the custom unmarshaler for DatabaseBlobAuditingPolicy struct. 362func (dbap *DatabaseBlobAuditingPolicy) UnmarshalJSON(body []byte) error { 363 var m map[string]*json.RawMessage 364 err := json.Unmarshal(body, &m) 365 if err != nil { 366 return err 367 } 368 for k, v := range m { 369 switch k { 370 case "kind": 371 if v != nil { 372 var kind string 373 err = json.Unmarshal(*v, &kind) 374 if err != nil { 375 return err 376 } 377 dbap.Kind = &kind 378 } 379 case "properties": 380 if v != nil { 381 var databaseBlobAuditingPolicyProperties DatabaseBlobAuditingPolicyProperties 382 err = json.Unmarshal(*v, &databaseBlobAuditingPolicyProperties) 383 if err != nil { 384 return err 385 } 386 dbap.DatabaseBlobAuditingPolicyProperties = &databaseBlobAuditingPolicyProperties 387 } 388 case "id": 389 if v != nil { 390 var ID string 391 err = json.Unmarshal(*v, &ID) 392 if err != nil { 393 return err 394 } 395 dbap.ID = &ID 396 } 397 case "name": 398 if v != nil { 399 var name string 400 err = json.Unmarshal(*v, &name) 401 if err != nil { 402 return err 403 } 404 dbap.Name = &name 405 } 406 case "type": 407 if v != nil { 408 var typeVar string 409 err = json.Unmarshal(*v, &typeVar) 410 if err != nil { 411 return err 412 } 413 dbap.Type = &typeVar 414 } 415 } 416 } 417 418 return nil 419} 420 421// DatabaseBlobAuditingPolicyListResult a list of database auditing settings. 422type DatabaseBlobAuditingPolicyListResult struct { 423 autorest.Response `json:"-"` 424 // Value - READ-ONLY; Array of results. 425 Value *[]DatabaseBlobAuditingPolicy `json:"value,omitempty"` 426 // NextLink - READ-ONLY; Link to retrieve next page of results. 427 NextLink *string `json:"nextLink,omitempty"` 428} 429 430// MarshalJSON is the custom marshaler for DatabaseBlobAuditingPolicyListResult. 431func (dbaplr DatabaseBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { 432 objectMap := make(map[string]interface{}) 433 return json.Marshal(objectMap) 434} 435 436// DatabaseBlobAuditingPolicyListResultIterator provides access to a complete listing of 437// DatabaseBlobAuditingPolicy values. 438type DatabaseBlobAuditingPolicyListResultIterator struct { 439 i int 440 page DatabaseBlobAuditingPolicyListResultPage 441} 442 443// NextWithContext advances to the next value. If there was an error making 444// the request the iterator does not advance and the error is returned. 445func (iter *DatabaseBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { 446 if tracing.IsEnabled() { 447 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPolicyListResultIterator.NextWithContext") 448 defer func() { 449 sc := -1 450 if iter.Response().Response.Response != nil { 451 sc = iter.Response().Response.Response.StatusCode 452 } 453 tracing.EndSpan(ctx, sc, err) 454 }() 455 } 456 iter.i++ 457 if iter.i < len(iter.page.Values()) { 458 return nil 459 } 460 err = iter.page.NextWithContext(ctx) 461 if err != nil { 462 iter.i-- 463 return err 464 } 465 iter.i = 0 466 return nil 467} 468 469// Next advances to the next value. If there was an error making 470// the request the iterator does not advance and the error is returned. 471// Deprecated: Use NextWithContext() instead. 472func (iter *DatabaseBlobAuditingPolicyListResultIterator) Next() error { 473 return iter.NextWithContext(context.Background()) 474} 475 476// NotDone returns true if the enumeration should be started or is not yet complete. 477func (iter DatabaseBlobAuditingPolicyListResultIterator) NotDone() bool { 478 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 479} 480 481// Response returns the raw server response from the last page request. 482func (iter DatabaseBlobAuditingPolicyListResultIterator) Response() DatabaseBlobAuditingPolicyListResult { 483 return iter.page.Response() 484} 485 486// Value returns the current value or a zero-initialized value if the 487// iterator has advanced beyond the end of the collection. 488func (iter DatabaseBlobAuditingPolicyListResultIterator) Value() DatabaseBlobAuditingPolicy { 489 if !iter.page.NotDone() { 490 return DatabaseBlobAuditingPolicy{} 491 } 492 return iter.page.Values()[iter.i] 493} 494 495// Creates a new instance of the DatabaseBlobAuditingPolicyListResultIterator type. 496func NewDatabaseBlobAuditingPolicyListResultIterator(page DatabaseBlobAuditingPolicyListResultPage) DatabaseBlobAuditingPolicyListResultIterator { 497 return DatabaseBlobAuditingPolicyListResultIterator{page: page} 498} 499 500// IsEmpty returns true if the ListResult contains no values. 501func (dbaplr DatabaseBlobAuditingPolicyListResult) IsEmpty() bool { 502 return dbaplr.Value == nil || len(*dbaplr.Value) == 0 503} 504 505// hasNextLink returns true if the NextLink is not empty. 506func (dbaplr DatabaseBlobAuditingPolicyListResult) hasNextLink() bool { 507 return dbaplr.NextLink != nil && len(*dbaplr.NextLink) != 0 508} 509 510// databaseBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. 511// It returns nil if no more results exist. 512func (dbaplr DatabaseBlobAuditingPolicyListResult) databaseBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { 513 if !dbaplr.hasNextLink() { 514 return nil, nil 515 } 516 return autorest.Prepare((&http.Request{}).WithContext(ctx), 517 autorest.AsJSON(), 518 autorest.AsGet(), 519 autorest.WithBaseURL(to.String(dbaplr.NextLink))) 520} 521 522// DatabaseBlobAuditingPolicyListResultPage contains a page of DatabaseBlobAuditingPolicy values. 523type DatabaseBlobAuditingPolicyListResultPage struct { 524 fn func(context.Context, DatabaseBlobAuditingPolicyListResult) (DatabaseBlobAuditingPolicyListResult, error) 525 dbaplr DatabaseBlobAuditingPolicyListResult 526} 527 528// NextWithContext advances to the next page of values. If there was an error making 529// the request the page does not advance and the error is returned. 530func (page *DatabaseBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { 531 if tracing.IsEnabled() { 532 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseBlobAuditingPolicyListResultPage.NextWithContext") 533 defer func() { 534 sc := -1 535 if page.Response().Response.Response != nil { 536 sc = page.Response().Response.Response.StatusCode 537 } 538 tracing.EndSpan(ctx, sc, err) 539 }() 540 } 541 for { 542 next, err := page.fn(ctx, page.dbaplr) 543 if err != nil { 544 return err 545 } 546 page.dbaplr = next 547 if !next.hasNextLink() || !next.IsEmpty() { 548 break 549 } 550 } 551 return nil 552} 553 554// Next advances to the next page of values. If there was an error making 555// the request the page does not advance and the error is returned. 556// Deprecated: Use NextWithContext() instead. 557func (page *DatabaseBlobAuditingPolicyListResultPage) Next() error { 558 return page.NextWithContext(context.Background()) 559} 560 561// NotDone returns true if the page enumeration should be started or is not yet complete. 562func (page DatabaseBlobAuditingPolicyListResultPage) NotDone() bool { 563 return !page.dbaplr.IsEmpty() 564} 565 566// Response returns the raw server response from the last page request. 567func (page DatabaseBlobAuditingPolicyListResultPage) Response() DatabaseBlobAuditingPolicyListResult { 568 return page.dbaplr 569} 570 571// Values returns the slice of values for the current page or nil if there are no values. 572func (page DatabaseBlobAuditingPolicyListResultPage) Values() []DatabaseBlobAuditingPolicy { 573 if page.dbaplr.IsEmpty() { 574 return nil 575 } 576 return *page.dbaplr.Value 577} 578 579// Creates a new instance of the DatabaseBlobAuditingPolicyListResultPage type. 580func NewDatabaseBlobAuditingPolicyListResultPage(cur DatabaseBlobAuditingPolicyListResult, getNextPage func(context.Context, DatabaseBlobAuditingPolicyListResult) (DatabaseBlobAuditingPolicyListResult, error)) DatabaseBlobAuditingPolicyListResultPage { 581 return DatabaseBlobAuditingPolicyListResultPage{ 582 fn: getNextPage, 583 dbaplr: cur, 584 } 585} 586 587// DatabaseBlobAuditingPolicyProperties properties of a database blob auditing policy. 588type DatabaseBlobAuditingPolicyProperties struct { 589 // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' 590 State BlobAuditingPolicyState `json:"state,omitempty"` 591 // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. 592 StorageEndpoint *string `json:"storageEndpoint,omitempty"` 593 // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. 594 // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. 595 // Prerequisites for using managed identity authentication: 596 // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 597 // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. 598 // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) 599 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 600 // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. 601 RetentionDays *int32 `json:"retentionDays,omitempty"` 602 // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. 603 // 604 // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: 605 // 606 // BATCH_COMPLETED_GROUP, 607 // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, 608 // FAILED_DATABASE_AUTHENTICATION_GROUP. 609 // 610 // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. 611 // 612 // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): 613 // 614 // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP 615 // BACKUP_RESTORE_GROUP 616 // DATABASE_LOGOUT_GROUP 617 // DATABASE_OBJECT_CHANGE_GROUP 618 // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP 619 // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP 620 // DATABASE_OPERATION_GROUP 621 // DATABASE_PERMISSION_CHANGE_GROUP 622 // DATABASE_PRINCIPAL_CHANGE_GROUP 623 // DATABASE_PRINCIPAL_IMPERSONATION_GROUP 624 // DATABASE_ROLE_MEMBER_CHANGE_GROUP 625 // FAILED_DATABASE_AUTHENTICATION_GROUP 626 // SCHEMA_OBJECT_ACCESS_GROUP 627 // SCHEMA_OBJECT_CHANGE_GROUP 628 // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP 629 // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP 630 // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP 631 // USER_CHANGE_PASSWORD_GROUP 632 // BATCH_STARTED_GROUP 633 // BATCH_COMPLETED_GROUP 634 // 635 // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. 636 // 637 // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). 638 // 639 // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: 640 // SELECT 641 // UPDATE 642 // INSERT 643 // DELETE 644 // EXECUTE 645 // RECEIVE 646 // REFERENCES 647 // 648 // The general form for defining an action to be audited is: 649 // {action} ON {object} BY {principal} 650 // 651 // Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. 652 // 653 // For example: 654 // SELECT on dbo.myTable by public 655 // SELECT on DATABASE::myDatabase by public 656 // SELECT on SCHEMA::mySchema by public 657 // 658 // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) 659 AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` 660 // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. 661 StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` 662 // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. 663 IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` 664 // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. 665 // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. 666 // 667 // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. 668 // Note that for server level audit you should use the 'master' database as {databaseName}. 669 // 670 // Diagnostic Settings URI format: 671 // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview 672 // 673 // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) 674 // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) 675 IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` 676 // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. 677 // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. 678 QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` 679} 680 681// DatabaseListResult represents the response to a list database request. 682type DatabaseListResult struct { 683 autorest.Response `json:"-"` 684 // Value - The list of databases housed in the server. 685 Value *[]Database `json:"value,omitempty"` 686} 687 688// DatabaseOperation a database operation. 689type DatabaseOperation struct { 690 // DatabaseOperationProperties - Resource properties. 691 *DatabaseOperationProperties `json:"properties,omitempty"` 692 // ID - READ-ONLY; Resource ID. 693 ID *string `json:"id,omitempty"` 694 // Name - READ-ONLY; Resource name. 695 Name *string `json:"name,omitempty"` 696 // Type - READ-ONLY; Resource type. 697 Type *string `json:"type,omitempty"` 698} 699 700// MarshalJSON is the custom marshaler for DatabaseOperation. 701func (do DatabaseOperation) MarshalJSON() ([]byte, error) { 702 objectMap := make(map[string]interface{}) 703 if do.DatabaseOperationProperties != nil { 704 objectMap["properties"] = do.DatabaseOperationProperties 705 } 706 return json.Marshal(objectMap) 707} 708 709// UnmarshalJSON is the custom unmarshaler for DatabaseOperation struct. 710func (do *DatabaseOperation) UnmarshalJSON(body []byte) error { 711 var m map[string]*json.RawMessage 712 err := json.Unmarshal(body, &m) 713 if err != nil { 714 return err 715 } 716 for k, v := range m { 717 switch k { 718 case "properties": 719 if v != nil { 720 var databaseOperationProperties DatabaseOperationProperties 721 err = json.Unmarshal(*v, &databaseOperationProperties) 722 if err != nil { 723 return err 724 } 725 do.DatabaseOperationProperties = &databaseOperationProperties 726 } 727 case "id": 728 if v != nil { 729 var ID string 730 err = json.Unmarshal(*v, &ID) 731 if err != nil { 732 return err 733 } 734 do.ID = &ID 735 } 736 case "name": 737 if v != nil { 738 var name string 739 err = json.Unmarshal(*v, &name) 740 if err != nil { 741 return err 742 } 743 do.Name = &name 744 } 745 case "type": 746 if v != nil { 747 var typeVar string 748 err = json.Unmarshal(*v, &typeVar) 749 if err != nil { 750 return err 751 } 752 do.Type = &typeVar 753 } 754 } 755 } 756 757 return nil 758} 759 760// DatabaseOperationListResult the response to a list database operations request 761type DatabaseOperationListResult struct { 762 autorest.Response `json:"-"` 763 // Value - READ-ONLY; Array of results. 764 Value *[]DatabaseOperation `json:"value,omitempty"` 765 // NextLink - READ-ONLY; Link to retrieve next page of results. 766 NextLink *string `json:"nextLink,omitempty"` 767} 768 769// MarshalJSON is the custom marshaler for DatabaseOperationListResult. 770func (dolr DatabaseOperationListResult) MarshalJSON() ([]byte, error) { 771 objectMap := make(map[string]interface{}) 772 return json.Marshal(objectMap) 773} 774 775// DatabaseOperationListResultIterator provides access to a complete listing of DatabaseOperation values. 776type DatabaseOperationListResultIterator struct { 777 i int 778 page DatabaseOperationListResultPage 779} 780 781// NextWithContext advances to the next value. If there was an error making 782// the request the iterator does not advance and the error is returned. 783func (iter *DatabaseOperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 784 if tracing.IsEnabled() { 785 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationListResultIterator.NextWithContext") 786 defer func() { 787 sc := -1 788 if iter.Response().Response.Response != nil { 789 sc = iter.Response().Response.Response.StatusCode 790 } 791 tracing.EndSpan(ctx, sc, err) 792 }() 793 } 794 iter.i++ 795 if iter.i < len(iter.page.Values()) { 796 return nil 797 } 798 err = iter.page.NextWithContext(ctx) 799 if err != nil { 800 iter.i-- 801 return err 802 } 803 iter.i = 0 804 return nil 805} 806 807// Next advances to the next value. If there was an error making 808// the request the iterator does not advance and the error is returned. 809// Deprecated: Use NextWithContext() instead. 810func (iter *DatabaseOperationListResultIterator) Next() error { 811 return iter.NextWithContext(context.Background()) 812} 813 814// NotDone returns true if the enumeration should be started or is not yet complete. 815func (iter DatabaseOperationListResultIterator) NotDone() bool { 816 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 817} 818 819// Response returns the raw server response from the last page request. 820func (iter DatabaseOperationListResultIterator) Response() DatabaseOperationListResult { 821 return iter.page.Response() 822} 823 824// Value returns the current value or a zero-initialized value if the 825// iterator has advanced beyond the end of the collection. 826func (iter DatabaseOperationListResultIterator) Value() DatabaseOperation { 827 if !iter.page.NotDone() { 828 return DatabaseOperation{} 829 } 830 return iter.page.Values()[iter.i] 831} 832 833// Creates a new instance of the DatabaseOperationListResultIterator type. 834func NewDatabaseOperationListResultIterator(page DatabaseOperationListResultPage) DatabaseOperationListResultIterator { 835 return DatabaseOperationListResultIterator{page: page} 836} 837 838// IsEmpty returns true if the ListResult contains no values. 839func (dolr DatabaseOperationListResult) IsEmpty() bool { 840 return dolr.Value == nil || len(*dolr.Value) == 0 841} 842 843// hasNextLink returns true if the NextLink is not empty. 844func (dolr DatabaseOperationListResult) hasNextLink() bool { 845 return dolr.NextLink != nil && len(*dolr.NextLink) != 0 846} 847 848// databaseOperationListResultPreparer prepares a request to retrieve the next set of results. 849// It returns nil if no more results exist. 850func (dolr DatabaseOperationListResult) databaseOperationListResultPreparer(ctx context.Context) (*http.Request, error) { 851 if !dolr.hasNextLink() { 852 return nil, nil 853 } 854 return autorest.Prepare((&http.Request{}).WithContext(ctx), 855 autorest.AsJSON(), 856 autorest.AsGet(), 857 autorest.WithBaseURL(to.String(dolr.NextLink))) 858} 859 860// DatabaseOperationListResultPage contains a page of DatabaseOperation values. 861type DatabaseOperationListResultPage struct { 862 fn func(context.Context, DatabaseOperationListResult) (DatabaseOperationListResult, error) 863 dolr DatabaseOperationListResult 864} 865 866// NextWithContext advances to the next page of values. If there was an error making 867// the request the page does not advance and the error is returned. 868func (page *DatabaseOperationListResultPage) NextWithContext(ctx context.Context) (err error) { 869 if tracing.IsEnabled() { 870 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseOperationListResultPage.NextWithContext") 871 defer func() { 872 sc := -1 873 if page.Response().Response.Response != nil { 874 sc = page.Response().Response.Response.StatusCode 875 } 876 tracing.EndSpan(ctx, sc, err) 877 }() 878 } 879 for { 880 next, err := page.fn(ctx, page.dolr) 881 if err != nil { 882 return err 883 } 884 page.dolr = next 885 if !next.hasNextLink() || !next.IsEmpty() { 886 break 887 } 888 } 889 return nil 890} 891 892// Next advances to the next page of values. If there was an error making 893// the request the page does not advance and the error is returned. 894// Deprecated: Use NextWithContext() instead. 895func (page *DatabaseOperationListResultPage) Next() error { 896 return page.NextWithContext(context.Background()) 897} 898 899// NotDone returns true if the page enumeration should be started or is not yet complete. 900func (page DatabaseOperationListResultPage) NotDone() bool { 901 return !page.dolr.IsEmpty() 902} 903 904// Response returns the raw server response from the last page request. 905func (page DatabaseOperationListResultPage) Response() DatabaseOperationListResult { 906 return page.dolr 907} 908 909// Values returns the slice of values for the current page or nil if there are no values. 910func (page DatabaseOperationListResultPage) Values() []DatabaseOperation { 911 if page.dolr.IsEmpty() { 912 return nil 913 } 914 return *page.dolr.Value 915} 916 917// Creates a new instance of the DatabaseOperationListResultPage type. 918func NewDatabaseOperationListResultPage(cur DatabaseOperationListResult, getNextPage func(context.Context, DatabaseOperationListResult) (DatabaseOperationListResult, error)) DatabaseOperationListResultPage { 919 return DatabaseOperationListResultPage{ 920 fn: getNextPage, 921 dolr: cur, 922 } 923} 924 925// DatabaseOperationProperties the properties of a database operation. 926type DatabaseOperationProperties struct { 927 // DatabaseName - READ-ONLY; The name of the database the operation is being performed on. 928 DatabaseName *string `json:"databaseName,omitempty"` 929 // Operation - READ-ONLY; The name of operation. 930 Operation *string `json:"operation,omitempty"` 931 // OperationFriendlyName - READ-ONLY; The friendly name of operation. 932 OperationFriendlyName *string `json:"operationFriendlyName,omitempty"` 933 // PercentComplete - READ-ONLY; The percentage of the operation completed. 934 PercentComplete *int32 `json:"percentComplete,omitempty"` 935 // ServerName - READ-ONLY; The name of the server. 936 ServerName *string `json:"serverName,omitempty"` 937 // StartTime - READ-ONLY; The operation start time. 938 StartTime *date.Time `json:"startTime,omitempty"` 939 // State - READ-ONLY; The operation state. Possible values include: 'ManagementOperationStatePending', 'ManagementOperationStateInProgress', 'ManagementOperationStateSucceeded', 'ManagementOperationStateFailed', 'ManagementOperationStateCancelInProgress', 'ManagementOperationStateCancelled' 940 State ManagementOperationState `json:"state,omitempty"` 941 // ErrorCode - READ-ONLY; The operation error code. 942 ErrorCode *int32 `json:"errorCode,omitempty"` 943 // ErrorDescription - READ-ONLY; The operation error description. 944 ErrorDescription *string `json:"errorDescription,omitempty"` 945 // ErrorSeverity - READ-ONLY; The operation error severity. 946 ErrorSeverity *int32 `json:"errorSeverity,omitempty"` 947 // IsUserError - READ-ONLY; Whether or not the error is a user error. 948 IsUserError *bool `json:"isUserError,omitempty"` 949 // EstimatedCompletionTime - READ-ONLY; The estimated completion time of the operation. 950 EstimatedCompletionTime *date.Time `json:"estimatedCompletionTime,omitempty"` 951 // Description - READ-ONLY; The operation description. 952 Description *string `json:"description,omitempty"` 953 // IsCancellable - READ-ONLY; Whether the operation can be cancelled. 954 IsCancellable *bool `json:"isCancellable,omitempty"` 955} 956 957// MarshalJSON is the custom marshaler for DatabaseOperationProperties. 958func (dop DatabaseOperationProperties) MarshalJSON() ([]byte, error) { 959 objectMap := make(map[string]interface{}) 960 return json.Marshal(objectMap) 961} 962 963// DatabaseProperties represents the properties of a database. 964type DatabaseProperties struct { 965 // Collation - The collation of the database. If createMode is not Default, this value is ignored. 966 Collation *string `json:"collation,omitempty"` 967 // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). 968 CreationDate *date.Time `json:"creationDate,omitempty"` 969 // ContainmentState - READ-ONLY; The containment state of the database. 970 ContainmentState *int64 `json:"containmentState,omitempty"` 971 // CurrentServiceObjectiveID - READ-ONLY; The current service level objective ID of the database. This is the ID of the service level objective that is currently active. 972 CurrentServiceObjectiveID *uuid.UUID `json:"currentServiceObjectiveId,omitempty"` 973 // DatabaseID - READ-ONLY; The ID of the database. 974 DatabaseID *uuid.UUID `json:"databaseId,omitempty"` 975 // EarliestRestoreDate - READ-ONLY; This records the earliest start date and time that restore is available for this database (ISO8601 format). 976 EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` 977 // CreateMode - Specifies the mode of database creation. 978 // Default: regular database creation. 979 // Copy: creates a database as a copy of an existing database. sourceDatabaseId must be specified as the resource ID of the source database. 980 // OnlineSecondary/NonReadableSecondary: creates a database as a (readable or nonreadable) secondary replica of an existing database. sourceDatabaseId must be specified as the resource ID of the existing primary database. 981 // PointInTimeRestore: Creates a database by restoring a point in time backup of an existing database. sourceDatabaseId must be specified as the resource ID of the existing database, and restorePointInTime must be specified. 982 // Recovery: Creates a database by restoring a geo-replicated backup. sourceDatabaseId must be specified as the recoverable database resource ID to restore. 983 // Restore: Creates a database by restoring a backup of a deleted database. sourceDatabaseId must be specified. If sourceDatabaseId is the database's original resource ID, then sourceDatabaseDeletionDate must be specified. Otherwise sourceDatabaseId must be the restorable dropped database resource ID and sourceDatabaseDeletionDate is ignored. restorePointInTime may also be specified to restore from an earlier point in time. 984 // RestoreLongTermRetentionBackup: Creates a database by restoring from a long term retention vault. recoveryServicesRecoveryPointResourceId must be specified as the recovery point resource ID. 985 // Copy, NonReadableSecondary, OnlineSecondary and RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. Possible values include: 'CreateModeCopy', 'CreateModeDefault', 'CreateModeNonReadableSecondary', 'CreateModeOnlineSecondary', 'CreateModePointInTimeRestore', 'CreateModeRecovery', 'CreateModeRestore', 'CreateModeRestoreLongTermRetentionBackup' 986 CreateMode CreateMode `json:"createMode,omitempty"` 987 // SourceDatabaseID - Conditional. If createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore, then this value is required. Specifies the resource ID of the source database. If createMode is NonReadableSecondary or OnlineSecondary, the name of the source database must be the same as the new database being created. 988 SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` 989 // SourceDatabaseDeletionDate - Conditional. If createMode is Restore and sourceDatabaseId is the deleted database's original resource id when it existed (as opposed to its current restorable dropped database id), then this value is required. Specifies the time that the database was deleted. 990 SourceDatabaseDeletionDate *date.Time `json:"sourceDatabaseDeletionDate,omitempty"` 991 // RestorePointInTime - Conditional. If createMode is PointInTimeRestore, this value is required. If createMode is Restore, this value is optional. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. 992 RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` 993 // RecoveryServicesRecoveryPointResourceID - Conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. 994 RecoveryServicesRecoveryPointResourceID *string `json:"recoveryServicesRecoveryPointResourceId,omitempty"` 995 // Edition - The edition of the database. The DatabaseEditions enumeration contains all the valid editions. If createMode is NonReadableSecondary or OnlineSecondary, this value is ignored. 996 // 997 // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: 998 // 999 // ```azurecli 1000 // az sql db list-editions -l <location> -o table 1001 // ```` 1002 // 1003 // ```powershell 1004 // Get-AzSqlServerServiceObjective -Location <location> 1005 // ```` 1006 // . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' 1007 Edition DatabaseEdition `json:"edition,omitempty"` 1008 // MaxSizeBytes - The max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." 1009 MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` 1010 // RequestedServiceObjectiveID - The configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName. 1011 // 1012 // The list of SKUs may vary by region and support offer. To determine the service objective ids that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API. 1013 RequestedServiceObjectiveID *uuid.UUID `json:"requestedServiceObjectiveId,omitempty"` 1014 // RequestedServiceObjectiveName - The name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. 1015 // 1016 // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: 1017 // 1018 // ```azurecli 1019 // az sql db list-editions -l <location> -o table 1020 // ```` 1021 // 1022 // ```powershell 1023 // Get-AzSqlServerServiceObjective -Location <location> 1024 // ```` 1025 // . Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' 1026 RequestedServiceObjectiveName ServiceObjectiveName `json:"requestedServiceObjectiveName,omitempty"` 1027 // ServiceLevelObjective - READ-ONLY; The current service level objective of the database. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' 1028 ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` 1029 // Status - READ-ONLY; The status of the database. 1030 Status *string `json:"status,omitempty"` 1031 // ElasticPoolName - The name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. 1032 ElasticPoolName *string `json:"elasticPoolName,omitempty"` 1033 // DefaultSecondaryLocation - READ-ONLY; The default secondary region for this database. 1034 DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` 1035 // ServiceTierAdvisors - READ-ONLY; The list of service tier advisors for this database. Expanded property 1036 ServiceTierAdvisors *[]ServiceTierAdvisor `json:"serviceTierAdvisors,omitempty"` 1037 // TransparentDataEncryption - READ-ONLY; The transparent data encryption info for this database. 1038 TransparentDataEncryption *[]TransparentDataEncryption `json:"transparentDataEncryption,omitempty"` 1039 // RecommendedIndex - READ-ONLY; The recommended indices for this database. 1040 RecommendedIndex *[]RecommendedIndex `json:"recommendedIndex,omitempty"` 1041 // FailoverGroupID - READ-ONLY; The resource identifier of the failover group containing this database. 1042 FailoverGroupID *string `json:"failoverGroupId,omitempty"` 1043 // ReadScale - Conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. Possible values include: 'ReadScaleEnabled', 'ReadScaleDisabled' 1044 ReadScale ReadScale `json:"readScale,omitempty"` 1045 // SampleName - Indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. Possible values include: 'AdventureWorksLT' 1046 SampleName SampleName `json:"sampleName,omitempty"` 1047 // ZoneRedundant - Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. 1048 ZoneRedundant *bool `json:"zoneRedundant,omitempty"` 1049} 1050 1051// MarshalJSON is the custom marshaler for DatabaseProperties. 1052func (dp DatabaseProperties) MarshalJSON() ([]byte, error) { 1053 objectMap := make(map[string]interface{}) 1054 if dp.Collation != nil { 1055 objectMap["collation"] = dp.Collation 1056 } 1057 if dp.CreateMode != "" { 1058 objectMap["createMode"] = dp.CreateMode 1059 } 1060 if dp.SourceDatabaseID != nil { 1061 objectMap["sourceDatabaseId"] = dp.SourceDatabaseID 1062 } 1063 if dp.SourceDatabaseDeletionDate != nil { 1064 objectMap["sourceDatabaseDeletionDate"] = dp.SourceDatabaseDeletionDate 1065 } 1066 if dp.RestorePointInTime != nil { 1067 objectMap["restorePointInTime"] = dp.RestorePointInTime 1068 } 1069 if dp.RecoveryServicesRecoveryPointResourceID != nil { 1070 objectMap["recoveryServicesRecoveryPointResourceId"] = dp.RecoveryServicesRecoveryPointResourceID 1071 } 1072 if dp.Edition != "" { 1073 objectMap["edition"] = dp.Edition 1074 } 1075 if dp.MaxSizeBytes != nil { 1076 objectMap["maxSizeBytes"] = dp.MaxSizeBytes 1077 } 1078 if dp.RequestedServiceObjectiveID != nil { 1079 objectMap["requestedServiceObjectiveId"] = dp.RequestedServiceObjectiveID 1080 } 1081 if dp.RequestedServiceObjectiveName != "" { 1082 objectMap["requestedServiceObjectiveName"] = dp.RequestedServiceObjectiveName 1083 } 1084 if dp.ElasticPoolName != nil { 1085 objectMap["elasticPoolName"] = dp.ElasticPoolName 1086 } 1087 if dp.ReadScale != "" { 1088 objectMap["readScale"] = dp.ReadScale 1089 } 1090 if dp.SampleName != "" { 1091 objectMap["sampleName"] = dp.SampleName 1092 } 1093 if dp.ZoneRedundant != nil { 1094 objectMap["zoneRedundant"] = dp.ZoneRedundant 1095 } 1096 return json.Marshal(objectMap) 1097} 1098 1099// DatabasesCreateImportOperationFuture an abstraction for monitoring and retrieving the results of a 1100// long-running operation. 1101type DatabasesCreateImportOperationFuture struct { 1102 azure.FutureAPI 1103 // Result returns the result of the asynchronous operation. 1104 // If the operation has not completed it will return an error. 1105 Result func(DatabasesClient) (ImportExportResponse, error) 1106} 1107 1108// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1109func (future *DatabasesCreateImportOperationFuture) UnmarshalJSON(body []byte) error { 1110 var azFuture azure.Future 1111 if err := json.Unmarshal(body, &azFuture); err != nil { 1112 return err 1113 } 1114 future.FutureAPI = &azFuture 1115 future.Result = future.result 1116 return nil 1117} 1118 1119// result is the default implementation for DatabasesCreateImportOperationFuture.Result. 1120func (future *DatabasesCreateImportOperationFuture) result(client DatabasesClient) (ier ImportExportResponse, err error) { 1121 var done bool 1122 done, err = future.DoneWithContext(context.Background(), client) 1123 if err != nil { 1124 err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", future.Response(), "Polling failure") 1125 return 1126 } 1127 if !done { 1128 ier.Response.Response = future.Response() 1129 err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateImportOperationFuture") 1130 return 1131 } 1132 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1133 if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { 1134 ier, err = client.CreateImportOperationResponder(ier.Response.Response) 1135 if err != nil { 1136 err = autorest.NewErrorWithError(err, "sql.DatabasesCreateImportOperationFuture", "Result", ier.Response.Response, "Failure responding to request") 1137 } 1138 } 1139 return 1140} 1141 1142// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1143// operation. 1144type DatabasesCreateOrUpdateFuture struct { 1145 azure.FutureAPI 1146 // Result returns the result of the asynchronous operation. 1147 // If the operation has not completed it will return an error. 1148 Result func(DatabasesClient) (Database, error) 1149} 1150 1151// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1152func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1153 var azFuture azure.Future 1154 if err := json.Unmarshal(body, &azFuture); err != nil { 1155 return err 1156 } 1157 future.FutureAPI = &azFuture 1158 future.Result = future.result 1159 return nil 1160} 1161 1162// result is the default implementation for DatabasesCreateOrUpdateFuture.Result. 1163func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) { 1164 var done bool 1165 done, err = future.DoneWithContext(context.Background(), client) 1166 if err != nil { 1167 err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1168 return 1169 } 1170 if !done { 1171 d.Response.Response = future.Response() 1172 err = azure.NewAsyncOpIncompleteError("sql.DatabasesCreateOrUpdateFuture") 1173 return 1174 } 1175 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1176 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { 1177 d, err = client.CreateOrUpdateResponder(d.Response.Response) 1178 if err != nil { 1179 err = autorest.NewErrorWithError(err, "sql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") 1180 } 1181 } 1182 return 1183} 1184 1185// DatabaseSecurityAlertPolicy contains information about a database Threat Detection policy. 1186type DatabaseSecurityAlertPolicy struct { 1187 autorest.Response `json:"-"` 1188 // Location - The geo-location where the resource lives 1189 Location *string `json:"location,omitempty"` 1190 // Kind - READ-ONLY; Resource kind. 1191 Kind *string `json:"kind,omitempty"` 1192 // DatabaseSecurityAlertPolicyProperties - Properties of the security alert policy. 1193 *DatabaseSecurityAlertPolicyProperties `json:"properties,omitempty"` 1194 // ID - READ-ONLY; Resource ID. 1195 ID *string `json:"id,omitempty"` 1196 // Name - READ-ONLY; Resource name. 1197 Name *string `json:"name,omitempty"` 1198 // Type - READ-ONLY; Resource type. 1199 Type *string `json:"type,omitempty"` 1200} 1201 1202// MarshalJSON is the custom marshaler for DatabaseSecurityAlertPolicy. 1203func (dsap DatabaseSecurityAlertPolicy) MarshalJSON() ([]byte, error) { 1204 objectMap := make(map[string]interface{}) 1205 if dsap.Location != nil { 1206 objectMap["location"] = dsap.Location 1207 } 1208 if dsap.DatabaseSecurityAlertPolicyProperties != nil { 1209 objectMap["properties"] = dsap.DatabaseSecurityAlertPolicyProperties 1210 } 1211 return json.Marshal(objectMap) 1212} 1213 1214// UnmarshalJSON is the custom unmarshaler for DatabaseSecurityAlertPolicy struct. 1215func (dsap *DatabaseSecurityAlertPolicy) UnmarshalJSON(body []byte) error { 1216 var m map[string]*json.RawMessage 1217 err := json.Unmarshal(body, &m) 1218 if err != nil { 1219 return err 1220 } 1221 for k, v := range m { 1222 switch k { 1223 case "location": 1224 if v != nil { 1225 var location string 1226 err = json.Unmarshal(*v, &location) 1227 if err != nil { 1228 return err 1229 } 1230 dsap.Location = &location 1231 } 1232 case "kind": 1233 if v != nil { 1234 var kind string 1235 err = json.Unmarshal(*v, &kind) 1236 if err != nil { 1237 return err 1238 } 1239 dsap.Kind = &kind 1240 } 1241 case "properties": 1242 if v != nil { 1243 var databaseSecurityAlertPolicyProperties DatabaseSecurityAlertPolicyProperties 1244 err = json.Unmarshal(*v, &databaseSecurityAlertPolicyProperties) 1245 if err != nil { 1246 return err 1247 } 1248 dsap.DatabaseSecurityAlertPolicyProperties = &databaseSecurityAlertPolicyProperties 1249 } 1250 case "id": 1251 if v != nil { 1252 var ID string 1253 err = json.Unmarshal(*v, &ID) 1254 if err != nil { 1255 return err 1256 } 1257 dsap.ID = &ID 1258 } 1259 case "name": 1260 if v != nil { 1261 var name string 1262 err = json.Unmarshal(*v, &name) 1263 if err != nil { 1264 return err 1265 } 1266 dsap.Name = &name 1267 } 1268 case "type": 1269 if v != nil { 1270 var typeVar string 1271 err = json.Unmarshal(*v, &typeVar) 1272 if err != nil { 1273 return err 1274 } 1275 dsap.Type = &typeVar 1276 } 1277 } 1278 } 1279 1280 return nil 1281} 1282 1283// DatabaseSecurityAlertPolicyProperties properties for a database Threat Detection policy. 1284type DatabaseSecurityAlertPolicyProperties struct { 1285 // State - Specifies the state of the policy. If state is Enabled, storageEndpoint and storageAccountAccessKey are required. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' 1286 State SecurityAlertPolicyState `json:"state,omitempty"` 1287 // DisabledAlerts - Specifies the semicolon-separated list of alerts that are disabled, or empty string to disable no alerts. Possible values: Sql_Injection; Sql_Injection_Vulnerability; Access_Anomaly; Data_Exfiltration; Unsafe_Action. 1288 DisabledAlerts *string `json:"disabledAlerts,omitempty"` 1289 // EmailAddresses - Specifies the semicolon-separated list of e-mail addresses to which the alert is sent. 1290 EmailAddresses *string `json:"emailAddresses,omitempty"` 1291 // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. Possible values include: 'SecurityAlertPolicyEmailAccountAdminsEnabled', 'SecurityAlertPolicyEmailAccountAdminsDisabled' 1292 EmailAccountAdmins SecurityAlertPolicyEmailAccountAdmins `json:"emailAccountAdmins,omitempty"` 1293 // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. If state is Enabled, storageEndpoint is required. 1294 StorageEndpoint *string `json:"storageEndpoint,omitempty"` 1295 // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. If state is Enabled, storageAccountAccessKey is required. 1296 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 1297 // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. 1298 RetentionDays *int32 `json:"retentionDays,omitempty"` 1299 // UseServerDefault - Specifies whether to use the default server policy. Possible values include: 'SecurityAlertPolicyUseServerDefaultEnabled', 'SecurityAlertPolicyUseServerDefaultDisabled' 1300 UseServerDefault SecurityAlertPolicyUseServerDefault `json:"useServerDefault,omitempty"` 1301} 1302 1303// DatabasesExportFuture an abstraction for monitoring and retrieving the results of a long-running 1304// operation. 1305type DatabasesExportFuture struct { 1306 azure.FutureAPI 1307 // Result returns the result of the asynchronous operation. 1308 // If the operation has not completed it will return an error. 1309 Result func(DatabasesClient) (ImportExportResponse, error) 1310} 1311 1312// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1313func (future *DatabasesExportFuture) UnmarshalJSON(body []byte) error { 1314 var azFuture azure.Future 1315 if err := json.Unmarshal(body, &azFuture); err != nil { 1316 return err 1317 } 1318 future.FutureAPI = &azFuture 1319 future.Result = future.result 1320 return nil 1321} 1322 1323// result is the default implementation for DatabasesExportFuture.Result. 1324func (future *DatabasesExportFuture) result(client DatabasesClient) (ier ImportExportResponse, err error) { 1325 var done bool 1326 done, err = future.DoneWithContext(context.Background(), client) 1327 if err != nil { 1328 err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", future.Response(), "Polling failure") 1329 return 1330 } 1331 if !done { 1332 ier.Response.Response = future.Response() 1333 err = azure.NewAsyncOpIncompleteError("sql.DatabasesExportFuture") 1334 return 1335 } 1336 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1337 if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { 1338 ier, err = client.ExportResponder(ier.Response.Response) 1339 if err != nil { 1340 err = autorest.NewErrorWithError(err, "sql.DatabasesExportFuture", "Result", ier.Response.Response, "Failure responding to request") 1341 } 1342 } 1343 return 1344} 1345 1346// DatabasesImportFuture an abstraction for monitoring and retrieving the results of a long-running 1347// operation. 1348type DatabasesImportFuture struct { 1349 azure.FutureAPI 1350 // Result returns the result of the asynchronous operation. 1351 // If the operation has not completed it will return an error. 1352 Result func(DatabasesClient) (ImportExportResponse, error) 1353} 1354 1355// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1356func (future *DatabasesImportFuture) UnmarshalJSON(body []byte) error { 1357 var azFuture azure.Future 1358 if err := json.Unmarshal(body, &azFuture); err != nil { 1359 return err 1360 } 1361 future.FutureAPI = &azFuture 1362 future.Result = future.result 1363 return nil 1364} 1365 1366// result is the default implementation for DatabasesImportFuture.Result. 1367func (future *DatabasesImportFuture) result(client DatabasesClient) (ier ImportExportResponse, err error) { 1368 var done bool 1369 done, err = future.DoneWithContext(context.Background(), client) 1370 if err != nil { 1371 err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", future.Response(), "Polling failure") 1372 return 1373 } 1374 if !done { 1375 ier.Response.Response = future.Response() 1376 err = azure.NewAsyncOpIncompleteError("sql.DatabasesImportFuture") 1377 return 1378 } 1379 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1380 if ier.Response.Response, err = future.GetResult(sender); err == nil && ier.Response.Response.StatusCode != http.StatusNoContent { 1381 ier, err = client.ImportResponder(ier.Response.Response) 1382 if err != nil { 1383 err = autorest.NewErrorWithError(err, "sql.DatabasesImportFuture", "Result", ier.Response.Response, "Failure responding to request") 1384 } 1385 } 1386 return 1387} 1388 1389// DatabasesPauseFuture an abstraction for monitoring and retrieving the results of a long-running 1390// operation. 1391type DatabasesPauseFuture struct { 1392 azure.FutureAPI 1393 // Result returns the result of the asynchronous operation. 1394 // If the operation has not completed it will return an error. 1395 Result func(DatabasesClient) (autorest.Response, error) 1396} 1397 1398// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1399func (future *DatabasesPauseFuture) UnmarshalJSON(body []byte) error { 1400 var azFuture azure.Future 1401 if err := json.Unmarshal(body, &azFuture); err != nil { 1402 return err 1403 } 1404 future.FutureAPI = &azFuture 1405 future.Result = future.result 1406 return nil 1407} 1408 1409// result is the default implementation for DatabasesPauseFuture.Result. 1410func (future *DatabasesPauseFuture) result(client DatabasesClient) (ar autorest.Response, err error) { 1411 var done bool 1412 done, err = future.DoneWithContext(context.Background(), client) 1413 if err != nil { 1414 err = autorest.NewErrorWithError(err, "sql.DatabasesPauseFuture", "Result", future.Response(), "Polling failure") 1415 return 1416 } 1417 if !done { 1418 ar.Response = future.Response() 1419 err = azure.NewAsyncOpIncompleteError("sql.DatabasesPauseFuture") 1420 return 1421 } 1422 ar.Response = future.Response() 1423 return 1424} 1425 1426// DatabasesResumeFuture an abstraction for monitoring and retrieving the results of a long-running 1427// operation. 1428type DatabasesResumeFuture struct { 1429 azure.FutureAPI 1430 // Result returns the result of the asynchronous operation. 1431 // If the operation has not completed it will return an error. 1432 Result func(DatabasesClient) (autorest.Response, error) 1433} 1434 1435// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1436func (future *DatabasesResumeFuture) UnmarshalJSON(body []byte) error { 1437 var azFuture azure.Future 1438 if err := json.Unmarshal(body, &azFuture); err != nil { 1439 return err 1440 } 1441 future.FutureAPI = &azFuture 1442 future.Result = future.result 1443 return nil 1444} 1445 1446// result is the default implementation for DatabasesResumeFuture.Result. 1447func (future *DatabasesResumeFuture) result(client DatabasesClient) (ar autorest.Response, err error) { 1448 var done bool 1449 done, err = future.DoneWithContext(context.Background(), client) 1450 if err != nil { 1451 err = autorest.NewErrorWithError(err, "sql.DatabasesResumeFuture", "Result", future.Response(), "Polling failure") 1452 return 1453 } 1454 if !done { 1455 ar.Response = future.Response() 1456 err = azure.NewAsyncOpIncompleteError("sql.DatabasesResumeFuture") 1457 return 1458 } 1459 ar.Response = future.Response() 1460 return 1461} 1462 1463// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1464// operation. 1465type DatabasesUpdateFuture struct { 1466 azure.FutureAPI 1467 // Result returns the result of the asynchronous operation. 1468 // If the operation has not completed it will return an error. 1469 Result func(DatabasesClient) (Database, error) 1470} 1471 1472// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1473func (future *DatabasesUpdateFuture) UnmarshalJSON(body []byte) error { 1474 var azFuture azure.Future 1475 if err := json.Unmarshal(body, &azFuture); err != nil { 1476 return err 1477 } 1478 future.FutureAPI = &azFuture 1479 future.Result = future.result 1480 return nil 1481} 1482 1483// result is the default implementation for DatabasesUpdateFuture.Result. 1484func (future *DatabasesUpdateFuture) result(client DatabasesClient) (d Database, err error) { 1485 var done bool 1486 done, err = future.DoneWithContext(context.Background(), client) 1487 if err != nil { 1488 err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") 1489 return 1490 } 1491 if !done { 1492 d.Response.Response = future.Response() 1493 err = azure.NewAsyncOpIncompleteError("sql.DatabasesUpdateFuture") 1494 return 1495 } 1496 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1497 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { 1498 d, err = client.UpdateResponder(d.Response.Response) 1499 if err != nil { 1500 err = autorest.NewErrorWithError(err, "sql.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") 1501 } 1502 } 1503 return 1504} 1505 1506// DatabaseUpdate represents a database update. 1507type DatabaseUpdate struct { 1508 // Tags - Resource tags. 1509 Tags map[string]*string `json:"tags"` 1510 // DatabaseProperties - The properties representing the resource. 1511 *DatabaseProperties `json:"properties,omitempty"` 1512 // ID - READ-ONLY; Resource ID. 1513 ID *string `json:"id,omitempty"` 1514 // Name - READ-ONLY; Resource name. 1515 Name *string `json:"name,omitempty"` 1516 // Type - READ-ONLY; Resource type. 1517 Type *string `json:"type,omitempty"` 1518} 1519 1520// MarshalJSON is the custom marshaler for DatabaseUpdate. 1521func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { 1522 objectMap := make(map[string]interface{}) 1523 if du.Tags != nil { 1524 objectMap["tags"] = du.Tags 1525 } 1526 if du.DatabaseProperties != nil { 1527 objectMap["properties"] = du.DatabaseProperties 1528 } 1529 return json.Marshal(objectMap) 1530} 1531 1532// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. 1533func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { 1534 var m map[string]*json.RawMessage 1535 err := json.Unmarshal(body, &m) 1536 if err != nil { 1537 return err 1538 } 1539 for k, v := range m { 1540 switch k { 1541 case "tags": 1542 if v != nil { 1543 var tags map[string]*string 1544 err = json.Unmarshal(*v, &tags) 1545 if err != nil { 1546 return err 1547 } 1548 du.Tags = tags 1549 } 1550 case "properties": 1551 if v != nil { 1552 var databaseProperties DatabaseProperties 1553 err = json.Unmarshal(*v, &databaseProperties) 1554 if err != nil { 1555 return err 1556 } 1557 du.DatabaseProperties = &databaseProperties 1558 } 1559 case "id": 1560 if v != nil { 1561 var ID string 1562 err = json.Unmarshal(*v, &ID) 1563 if err != nil { 1564 return err 1565 } 1566 du.ID = &ID 1567 } 1568 case "name": 1569 if v != nil { 1570 var name string 1571 err = json.Unmarshal(*v, &name) 1572 if err != nil { 1573 return err 1574 } 1575 du.Name = &name 1576 } 1577 case "type": 1578 if v != nil { 1579 var typeVar string 1580 err = json.Unmarshal(*v, &typeVar) 1581 if err != nil { 1582 return err 1583 } 1584 du.Type = &typeVar 1585 } 1586 } 1587 } 1588 1589 return nil 1590} 1591 1592// DatabaseUsage the database usages. 1593type DatabaseUsage struct { 1594 // Name - READ-ONLY; The name of the usage metric. 1595 Name *string `json:"name,omitempty"` 1596 // ResourceName - READ-ONLY; The name of the resource. 1597 ResourceName *string `json:"resourceName,omitempty"` 1598 // DisplayName - READ-ONLY; The usage metric display name. 1599 DisplayName *string `json:"displayName,omitempty"` 1600 // CurrentValue - READ-ONLY; The current value of the usage metric. 1601 CurrentValue *float64 `json:"currentValue,omitempty"` 1602 // Limit - READ-ONLY; The current limit of the usage metric. 1603 Limit *float64 `json:"limit,omitempty"` 1604 // Unit - READ-ONLY; The units of the usage metric. 1605 Unit *string `json:"unit,omitempty"` 1606 // NextResetTime - READ-ONLY; The next reset time for the usage metric (ISO8601 format). 1607 NextResetTime *date.Time `json:"nextResetTime,omitempty"` 1608} 1609 1610// MarshalJSON is the custom marshaler for DatabaseUsage. 1611func (du DatabaseUsage) MarshalJSON() ([]byte, error) { 1612 objectMap := make(map[string]interface{}) 1613 return json.Marshal(objectMap) 1614} 1615 1616// DatabaseUsageListResult the response to a list database metrics request. 1617type DatabaseUsageListResult struct { 1618 autorest.Response `json:"-"` 1619 // Value - The list of database usages for the database. 1620 Value *[]DatabaseUsage `json:"value,omitempty"` 1621} 1622 1623// DatabaseVulnerabilityAssessment a database vulnerability assessment. 1624type DatabaseVulnerabilityAssessment struct { 1625 autorest.Response `json:"-"` 1626 // DatabaseVulnerabilityAssessmentProperties - Resource properties. 1627 *DatabaseVulnerabilityAssessmentProperties `json:"properties,omitempty"` 1628 // ID - READ-ONLY; Resource ID. 1629 ID *string `json:"id,omitempty"` 1630 // Name - READ-ONLY; Resource name. 1631 Name *string `json:"name,omitempty"` 1632 // Type - READ-ONLY; Resource type. 1633 Type *string `json:"type,omitempty"` 1634} 1635 1636// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessment. 1637func (dva DatabaseVulnerabilityAssessment) MarshalJSON() ([]byte, error) { 1638 objectMap := make(map[string]interface{}) 1639 if dva.DatabaseVulnerabilityAssessmentProperties != nil { 1640 objectMap["properties"] = dva.DatabaseVulnerabilityAssessmentProperties 1641 } 1642 return json.Marshal(objectMap) 1643} 1644 1645// UnmarshalJSON is the custom unmarshaler for DatabaseVulnerabilityAssessment struct. 1646func (dva *DatabaseVulnerabilityAssessment) UnmarshalJSON(body []byte) error { 1647 var m map[string]*json.RawMessage 1648 err := json.Unmarshal(body, &m) 1649 if err != nil { 1650 return err 1651 } 1652 for k, v := range m { 1653 switch k { 1654 case "properties": 1655 if v != nil { 1656 var databaseVulnerabilityAssessmentProperties DatabaseVulnerabilityAssessmentProperties 1657 err = json.Unmarshal(*v, &databaseVulnerabilityAssessmentProperties) 1658 if err != nil { 1659 return err 1660 } 1661 dva.DatabaseVulnerabilityAssessmentProperties = &databaseVulnerabilityAssessmentProperties 1662 } 1663 case "id": 1664 if v != nil { 1665 var ID string 1666 err = json.Unmarshal(*v, &ID) 1667 if err != nil { 1668 return err 1669 } 1670 dva.ID = &ID 1671 } 1672 case "name": 1673 if v != nil { 1674 var name string 1675 err = json.Unmarshal(*v, &name) 1676 if err != nil { 1677 return err 1678 } 1679 dva.Name = &name 1680 } 1681 case "type": 1682 if v != nil { 1683 var typeVar string 1684 err = json.Unmarshal(*v, &typeVar) 1685 if err != nil { 1686 return err 1687 } 1688 dva.Type = &typeVar 1689 } 1690 } 1691 } 1692 1693 return nil 1694} 1695 1696// DatabaseVulnerabilityAssessmentListResult a list of the database's vulnerability assessments. 1697type DatabaseVulnerabilityAssessmentListResult struct { 1698 autorest.Response `json:"-"` 1699 // Value - READ-ONLY; Array of results. 1700 Value *[]DatabaseVulnerabilityAssessment `json:"value,omitempty"` 1701 // NextLink - READ-ONLY; Link to retrieve next page of results. 1702 NextLink *string `json:"nextLink,omitempty"` 1703} 1704 1705// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessmentListResult. 1706func (dvalr DatabaseVulnerabilityAssessmentListResult) MarshalJSON() ([]byte, error) { 1707 objectMap := make(map[string]interface{}) 1708 return json.Marshal(objectMap) 1709} 1710 1711// DatabaseVulnerabilityAssessmentListResultIterator provides access to a complete listing of 1712// DatabaseVulnerabilityAssessment values. 1713type DatabaseVulnerabilityAssessmentListResultIterator struct { 1714 i int 1715 page DatabaseVulnerabilityAssessmentListResultPage 1716} 1717 1718// NextWithContext advances to the next value. If there was an error making 1719// the request the iterator does not advance and the error is returned. 1720func (iter *DatabaseVulnerabilityAssessmentListResultIterator) NextWithContext(ctx context.Context) (err error) { 1721 if tracing.IsEnabled() { 1722 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentListResultIterator.NextWithContext") 1723 defer func() { 1724 sc := -1 1725 if iter.Response().Response.Response != nil { 1726 sc = iter.Response().Response.Response.StatusCode 1727 } 1728 tracing.EndSpan(ctx, sc, err) 1729 }() 1730 } 1731 iter.i++ 1732 if iter.i < len(iter.page.Values()) { 1733 return nil 1734 } 1735 err = iter.page.NextWithContext(ctx) 1736 if err != nil { 1737 iter.i-- 1738 return err 1739 } 1740 iter.i = 0 1741 return nil 1742} 1743 1744// Next advances to the next value. If there was an error making 1745// the request the iterator does not advance and the error is returned. 1746// Deprecated: Use NextWithContext() instead. 1747func (iter *DatabaseVulnerabilityAssessmentListResultIterator) Next() error { 1748 return iter.NextWithContext(context.Background()) 1749} 1750 1751// NotDone returns true if the enumeration should be started or is not yet complete. 1752func (iter DatabaseVulnerabilityAssessmentListResultIterator) NotDone() bool { 1753 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1754} 1755 1756// Response returns the raw server response from the last page request. 1757func (iter DatabaseVulnerabilityAssessmentListResultIterator) Response() DatabaseVulnerabilityAssessmentListResult { 1758 return iter.page.Response() 1759} 1760 1761// Value returns the current value or a zero-initialized value if the 1762// iterator has advanced beyond the end of the collection. 1763func (iter DatabaseVulnerabilityAssessmentListResultIterator) Value() DatabaseVulnerabilityAssessment { 1764 if !iter.page.NotDone() { 1765 return DatabaseVulnerabilityAssessment{} 1766 } 1767 return iter.page.Values()[iter.i] 1768} 1769 1770// Creates a new instance of the DatabaseVulnerabilityAssessmentListResultIterator type. 1771func NewDatabaseVulnerabilityAssessmentListResultIterator(page DatabaseVulnerabilityAssessmentListResultPage) DatabaseVulnerabilityAssessmentListResultIterator { 1772 return DatabaseVulnerabilityAssessmentListResultIterator{page: page} 1773} 1774 1775// IsEmpty returns true if the ListResult contains no values. 1776func (dvalr DatabaseVulnerabilityAssessmentListResult) IsEmpty() bool { 1777 return dvalr.Value == nil || len(*dvalr.Value) == 0 1778} 1779 1780// hasNextLink returns true if the NextLink is not empty. 1781func (dvalr DatabaseVulnerabilityAssessmentListResult) hasNextLink() bool { 1782 return dvalr.NextLink != nil && len(*dvalr.NextLink) != 0 1783} 1784 1785// databaseVulnerabilityAssessmentListResultPreparer prepares a request to retrieve the next set of results. 1786// It returns nil if no more results exist. 1787func (dvalr DatabaseVulnerabilityAssessmentListResult) databaseVulnerabilityAssessmentListResultPreparer(ctx context.Context) (*http.Request, error) { 1788 if !dvalr.hasNextLink() { 1789 return nil, nil 1790 } 1791 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1792 autorest.AsJSON(), 1793 autorest.AsGet(), 1794 autorest.WithBaseURL(to.String(dvalr.NextLink))) 1795} 1796 1797// DatabaseVulnerabilityAssessmentListResultPage contains a page of DatabaseVulnerabilityAssessment values. 1798type DatabaseVulnerabilityAssessmentListResultPage struct { 1799 fn func(context.Context, DatabaseVulnerabilityAssessmentListResult) (DatabaseVulnerabilityAssessmentListResult, error) 1800 dvalr DatabaseVulnerabilityAssessmentListResult 1801} 1802 1803// NextWithContext advances to the next page of values. If there was an error making 1804// the request the page does not advance and the error is returned. 1805func (page *DatabaseVulnerabilityAssessmentListResultPage) NextWithContext(ctx context.Context) (err error) { 1806 if tracing.IsEnabled() { 1807 ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseVulnerabilityAssessmentListResultPage.NextWithContext") 1808 defer func() { 1809 sc := -1 1810 if page.Response().Response.Response != nil { 1811 sc = page.Response().Response.Response.StatusCode 1812 } 1813 tracing.EndSpan(ctx, sc, err) 1814 }() 1815 } 1816 for { 1817 next, err := page.fn(ctx, page.dvalr) 1818 if err != nil { 1819 return err 1820 } 1821 page.dvalr = next 1822 if !next.hasNextLink() || !next.IsEmpty() { 1823 break 1824 } 1825 } 1826 return nil 1827} 1828 1829// Next advances to the next page of values. If there was an error making 1830// the request the page does not advance and the error is returned. 1831// Deprecated: Use NextWithContext() instead. 1832func (page *DatabaseVulnerabilityAssessmentListResultPage) Next() error { 1833 return page.NextWithContext(context.Background()) 1834} 1835 1836// NotDone returns true if the page enumeration should be started or is not yet complete. 1837func (page DatabaseVulnerabilityAssessmentListResultPage) NotDone() bool { 1838 return !page.dvalr.IsEmpty() 1839} 1840 1841// Response returns the raw server response from the last page request. 1842func (page DatabaseVulnerabilityAssessmentListResultPage) Response() DatabaseVulnerabilityAssessmentListResult { 1843 return page.dvalr 1844} 1845 1846// Values returns the slice of values for the current page or nil if there are no values. 1847func (page DatabaseVulnerabilityAssessmentListResultPage) Values() []DatabaseVulnerabilityAssessment { 1848 if page.dvalr.IsEmpty() { 1849 return nil 1850 } 1851 return *page.dvalr.Value 1852} 1853 1854// Creates a new instance of the DatabaseVulnerabilityAssessmentListResultPage type. 1855func NewDatabaseVulnerabilityAssessmentListResultPage(cur DatabaseVulnerabilityAssessmentListResult, getNextPage func(context.Context, DatabaseVulnerabilityAssessmentListResult) (DatabaseVulnerabilityAssessmentListResult, error)) DatabaseVulnerabilityAssessmentListResultPage { 1856 return DatabaseVulnerabilityAssessmentListResultPage{ 1857 fn: getNextPage, 1858 dvalr: cur, 1859 } 1860} 1861 1862// DatabaseVulnerabilityAssessmentProperties properties of a database Vulnerability Assessment. 1863type DatabaseVulnerabilityAssessmentProperties struct { 1864 // StorageContainerPath - A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set 1865 StorageContainerPath *string `json:"storageContainerPath,omitempty"` 1866 // StorageContainerSasKey - A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. 1867 StorageContainerSasKey *string `json:"storageContainerSasKey,omitempty"` 1868 // StorageAccountAccessKey - Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. 1869 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 1870 // RecurringScans - The recurring scans settings 1871 RecurringScans *VulnerabilityAssessmentRecurringScansProperties `json:"recurringScans,omitempty"` 1872} 1873 1874// DatabaseVulnerabilityAssessmentRuleBaseline a database vulnerability assessment rule baseline. 1875type DatabaseVulnerabilityAssessmentRuleBaseline struct { 1876 autorest.Response `json:"-"` 1877 // DatabaseVulnerabilityAssessmentRuleBaselineProperties - Resource properties. 1878 *DatabaseVulnerabilityAssessmentRuleBaselineProperties `json:"properties,omitempty"` 1879 // ID - READ-ONLY; Resource ID. 1880 ID *string `json:"id,omitempty"` 1881 // Name - READ-ONLY; Resource name. 1882 Name *string `json:"name,omitempty"` 1883 // Type - READ-ONLY; Resource type. 1884 Type *string `json:"type,omitempty"` 1885} 1886 1887// MarshalJSON is the custom marshaler for DatabaseVulnerabilityAssessmentRuleBaseline. 1888func (dvarb DatabaseVulnerabilityAssessmentRuleBaseline) MarshalJSON() ([]byte, error) { 1889 objectMap := make(map[string]interface{}) 1890 if dvarb.DatabaseVulnerabilityAssessmentRuleBaselineProperties != nil { 1891 objectMap["properties"] = dvarb.DatabaseVulnerabilityAssessmentRuleBaselineProperties 1892 } 1893 return json.Marshal(objectMap) 1894} 1895 1896// UnmarshalJSON is the custom unmarshaler for DatabaseVulnerabilityAssessmentRuleBaseline struct. 1897func (dvarb *DatabaseVulnerabilityAssessmentRuleBaseline) UnmarshalJSON(body []byte) error { 1898 var m map[string]*json.RawMessage 1899 err := json.Unmarshal(body, &m) 1900 if err != nil { 1901 return err 1902 } 1903 for k, v := range m { 1904 switch k { 1905 case "properties": 1906 if v != nil { 1907 var databaseVulnerabilityAssessmentRuleBaselineProperties DatabaseVulnerabilityAssessmentRuleBaselineProperties 1908 err = json.Unmarshal(*v, &databaseVulnerabilityAssessmentRuleBaselineProperties) 1909 if err != nil { 1910 return err 1911 } 1912 dvarb.DatabaseVulnerabilityAssessmentRuleBaselineProperties = &databaseVulnerabilityAssessmentRuleBaselineProperties 1913 } 1914 case "id": 1915 if v != nil { 1916 var ID string 1917 err = json.Unmarshal(*v, &ID) 1918 if err != nil { 1919 return err 1920 } 1921 dvarb.ID = &ID 1922 } 1923 case "name": 1924 if v != nil { 1925 var name string 1926 err = json.Unmarshal(*v, &name) 1927 if err != nil { 1928 return err 1929 } 1930 dvarb.Name = &name 1931 } 1932 case "type": 1933 if v != nil { 1934 var typeVar string 1935 err = json.Unmarshal(*v, &typeVar) 1936 if err != nil { 1937 return err 1938 } 1939 dvarb.Type = &typeVar 1940 } 1941 } 1942 } 1943 1944 return nil 1945} 1946 1947// DatabaseVulnerabilityAssessmentRuleBaselineItem properties for an Azure SQL Database Vulnerability 1948// Assessment rule baseline's result. 1949type DatabaseVulnerabilityAssessmentRuleBaselineItem struct { 1950 // Result - The rule baseline result 1951 Result *[]string `json:"result,omitempty"` 1952} 1953 1954// DatabaseVulnerabilityAssessmentRuleBaselineProperties properties of a database Vulnerability Assessment 1955// rule baseline. 1956type DatabaseVulnerabilityAssessmentRuleBaselineProperties struct { 1957 // BaselineResults - The rule baseline result 1958 BaselineResults *[]DatabaseVulnerabilityAssessmentRuleBaselineItem `json:"baselineResults,omitempty"` 1959} 1960 1961// DataMaskingPolicy represents a database data masking policy. 1962type DataMaskingPolicy struct { 1963 autorest.Response `json:"-"` 1964 // DataMaskingPolicyProperties - The properties of the data masking policy. 1965 *DataMaskingPolicyProperties `json:"properties,omitempty"` 1966 // Location - READ-ONLY; The location of the data masking policy. 1967 Location *string `json:"location,omitempty"` 1968 // Kind - READ-ONLY; The kind of data masking policy. Metadata, used for Azure portal. 1969 Kind *string `json:"kind,omitempty"` 1970 // ID - READ-ONLY; Resource ID. 1971 ID *string `json:"id,omitempty"` 1972 // Name - READ-ONLY; Resource name. 1973 Name *string `json:"name,omitempty"` 1974 // Type - READ-ONLY; Resource type. 1975 Type *string `json:"type,omitempty"` 1976} 1977 1978// MarshalJSON is the custom marshaler for DataMaskingPolicy. 1979func (dmp DataMaskingPolicy) MarshalJSON() ([]byte, error) { 1980 objectMap := make(map[string]interface{}) 1981 if dmp.DataMaskingPolicyProperties != nil { 1982 objectMap["properties"] = dmp.DataMaskingPolicyProperties 1983 } 1984 return json.Marshal(objectMap) 1985} 1986 1987// UnmarshalJSON is the custom unmarshaler for DataMaskingPolicy struct. 1988func (dmp *DataMaskingPolicy) UnmarshalJSON(body []byte) error { 1989 var m map[string]*json.RawMessage 1990 err := json.Unmarshal(body, &m) 1991 if err != nil { 1992 return err 1993 } 1994 for k, v := range m { 1995 switch k { 1996 case "properties": 1997 if v != nil { 1998 var dataMaskingPolicyProperties DataMaskingPolicyProperties 1999 err = json.Unmarshal(*v, &dataMaskingPolicyProperties) 2000 if err != nil { 2001 return err 2002 } 2003 dmp.DataMaskingPolicyProperties = &dataMaskingPolicyProperties 2004 } 2005 case "location": 2006 if v != nil { 2007 var location string 2008 err = json.Unmarshal(*v, &location) 2009 if err != nil { 2010 return err 2011 } 2012 dmp.Location = &location 2013 } 2014 case "kind": 2015 if v != nil { 2016 var kind string 2017 err = json.Unmarshal(*v, &kind) 2018 if err != nil { 2019 return err 2020 } 2021 dmp.Kind = &kind 2022 } 2023 case "id": 2024 if v != nil { 2025 var ID string 2026 err = json.Unmarshal(*v, &ID) 2027 if err != nil { 2028 return err 2029 } 2030 dmp.ID = &ID 2031 } 2032 case "name": 2033 if v != nil { 2034 var name string 2035 err = json.Unmarshal(*v, &name) 2036 if err != nil { 2037 return err 2038 } 2039 dmp.Name = &name 2040 } 2041 case "type": 2042 if v != nil { 2043 var typeVar string 2044 err = json.Unmarshal(*v, &typeVar) 2045 if err != nil { 2046 return err 2047 } 2048 dmp.Type = &typeVar 2049 } 2050 } 2051 } 2052 2053 return nil 2054} 2055 2056// DataMaskingPolicyProperties the properties of a database data masking policy. 2057type DataMaskingPolicyProperties struct { 2058 // DataMaskingState - The state of the data masking policy. Possible values include: 'DataMaskingStateDisabled', 'DataMaskingStateEnabled' 2059 DataMaskingState DataMaskingState `json:"dataMaskingState,omitempty"` 2060 // ExemptPrincipals - The list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries. 2061 ExemptPrincipals *string `json:"exemptPrincipals,omitempty"` 2062 // ApplicationPrincipals - READ-ONLY; The list of the application principals. This is a legacy parameter and is no longer used. 2063 ApplicationPrincipals *string `json:"applicationPrincipals,omitempty"` 2064 // MaskingLevel - READ-ONLY; The masking level. This is a legacy parameter and is no longer used. 2065 MaskingLevel *string `json:"maskingLevel,omitempty"` 2066} 2067 2068// MarshalJSON is the custom marshaler for DataMaskingPolicyProperties. 2069func (dmpp DataMaskingPolicyProperties) MarshalJSON() ([]byte, error) { 2070 objectMap := make(map[string]interface{}) 2071 if dmpp.DataMaskingState != "" { 2072 objectMap["dataMaskingState"] = dmpp.DataMaskingState 2073 } 2074 if dmpp.ExemptPrincipals != nil { 2075 objectMap["exemptPrincipals"] = dmpp.ExemptPrincipals 2076 } 2077 return json.Marshal(objectMap) 2078} 2079 2080// DataMaskingRule represents a database data masking rule. 2081type DataMaskingRule struct { 2082 autorest.Response `json:"-"` 2083 // DataMaskingRuleProperties - The properties of the resource. 2084 *DataMaskingRuleProperties `json:"properties,omitempty"` 2085 // Location - READ-ONLY; The location of the data masking rule. 2086 Location *string `json:"location,omitempty"` 2087 // Kind - READ-ONLY; The kind of Data Masking Rule. Metadata, used for Azure portal. 2088 Kind *string `json:"kind,omitempty"` 2089 // ID - READ-ONLY; Resource ID. 2090 ID *string `json:"id,omitempty"` 2091 // Name - READ-ONLY; Resource name. 2092 Name *string `json:"name,omitempty"` 2093 // Type - READ-ONLY; Resource type. 2094 Type *string `json:"type,omitempty"` 2095} 2096 2097// MarshalJSON is the custom marshaler for DataMaskingRule. 2098func (dmr DataMaskingRule) MarshalJSON() ([]byte, error) { 2099 objectMap := make(map[string]interface{}) 2100 if dmr.DataMaskingRuleProperties != nil { 2101 objectMap["properties"] = dmr.DataMaskingRuleProperties 2102 } 2103 return json.Marshal(objectMap) 2104} 2105 2106// UnmarshalJSON is the custom unmarshaler for DataMaskingRule struct. 2107func (dmr *DataMaskingRule) UnmarshalJSON(body []byte) error { 2108 var m map[string]*json.RawMessage 2109 err := json.Unmarshal(body, &m) 2110 if err != nil { 2111 return err 2112 } 2113 for k, v := range m { 2114 switch k { 2115 case "properties": 2116 if v != nil { 2117 var dataMaskingRuleProperties DataMaskingRuleProperties 2118 err = json.Unmarshal(*v, &dataMaskingRuleProperties) 2119 if err != nil { 2120 return err 2121 } 2122 dmr.DataMaskingRuleProperties = &dataMaskingRuleProperties 2123 } 2124 case "location": 2125 if v != nil { 2126 var location string 2127 err = json.Unmarshal(*v, &location) 2128 if err != nil { 2129 return err 2130 } 2131 dmr.Location = &location 2132 } 2133 case "kind": 2134 if v != nil { 2135 var kind string 2136 err = json.Unmarshal(*v, &kind) 2137 if err != nil { 2138 return err 2139 } 2140 dmr.Kind = &kind 2141 } 2142 case "id": 2143 if v != nil { 2144 var ID string 2145 err = json.Unmarshal(*v, &ID) 2146 if err != nil { 2147 return err 2148 } 2149 dmr.ID = &ID 2150 } 2151 case "name": 2152 if v != nil { 2153 var name string 2154 err = json.Unmarshal(*v, &name) 2155 if err != nil { 2156 return err 2157 } 2158 dmr.Name = &name 2159 } 2160 case "type": 2161 if v != nil { 2162 var typeVar string 2163 err = json.Unmarshal(*v, &typeVar) 2164 if err != nil { 2165 return err 2166 } 2167 dmr.Type = &typeVar 2168 } 2169 } 2170 } 2171 2172 return nil 2173} 2174 2175// DataMaskingRuleListResult the response to a list data masking rules request. 2176type DataMaskingRuleListResult struct { 2177 autorest.Response `json:"-"` 2178 // Value - The list of database data masking rules. 2179 Value *[]DataMaskingRule `json:"value,omitempty"` 2180} 2181 2182// DataMaskingRuleProperties the properties of a database data masking rule. 2183type DataMaskingRuleProperties struct { 2184 // ID - READ-ONLY; The rule Id. 2185 ID *string `json:"id,omitempty"` 2186 // AliasName - The alias name. This is a legacy parameter and is no longer used. 2187 AliasName *string `json:"aliasName,omitempty"` 2188 // RuleState - The rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. Possible values include: 'DataMaskingRuleStateDisabled', 'DataMaskingRuleStateEnabled' 2189 RuleState DataMaskingRuleState `json:"ruleState,omitempty"` 2190 // SchemaName - The schema name on which the data masking rule is applied. 2191 SchemaName *string `json:"schemaName,omitempty"` 2192 // TableName - The table name on which the data masking rule is applied. 2193 TableName *string `json:"tableName,omitempty"` 2194 // ColumnName - The column name on which the data masking rule is applied. 2195 ColumnName *string `json:"columnName,omitempty"` 2196 // MaskingFunction - The masking function that is used for the data masking rule. Possible values include: 'DataMaskingFunctionDefault', 'DataMaskingFunctionCCN', 'DataMaskingFunctionEmail', 'DataMaskingFunctionNumber', 'DataMaskingFunctionSSN', 'DataMaskingFunctionText' 2197 MaskingFunction DataMaskingFunction `json:"maskingFunction,omitempty"` 2198 // NumberFrom - The numberFrom property of the masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. 2199 NumberFrom *string `json:"numberFrom,omitempty"` 2200 // NumberTo - The numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. 2201 NumberTo *string `json:"numberTo,omitempty"` 2202 // PrefixSize - If maskingFunction is set to Text, the number of characters to show unmasked in the beginning of the string. Otherwise, this parameter will be ignored. 2203 PrefixSize *string `json:"prefixSize,omitempty"` 2204 // SuffixSize - If maskingFunction is set to Text, the number of characters to show unmasked at the end of the string. Otherwise, this parameter will be ignored. 2205 SuffixSize *string `json:"suffixSize,omitempty"` 2206 // ReplacementString - If maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter will be ignored. 2207 ReplacementString *string `json:"replacementString,omitempty"` 2208} 2209 2210// MarshalJSON is the custom marshaler for DataMaskingRuleProperties. 2211func (dmrp DataMaskingRuleProperties) MarshalJSON() ([]byte, error) { 2212 objectMap := make(map[string]interface{}) 2213 if dmrp.AliasName != nil { 2214 objectMap["aliasName"] = dmrp.AliasName 2215 } 2216 if dmrp.RuleState != "" { 2217 objectMap["ruleState"] = dmrp.RuleState 2218 } 2219 if dmrp.SchemaName != nil { 2220 objectMap["schemaName"] = dmrp.SchemaName 2221 } 2222 if dmrp.TableName != nil { 2223 objectMap["tableName"] = dmrp.TableName 2224 } 2225 if dmrp.ColumnName != nil { 2226 objectMap["columnName"] = dmrp.ColumnName 2227 } 2228 if dmrp.MaskingFunction != "" { 2229 objectMap["maskingFunction"] = dmrp.MaskingFunction 2230 } 2231 if dmrp.NumberFrom != nil { 2232 objectMap["numberFrom"] = dmrp.NumberFrom 2233 } 2234 if dmrp.NumberTo != nil { 2235 objectMap["numberTo"] = dmrp.NumberTo 2236 } 2237 if dmrp.PrefixSize != nil { 2238 objectMap["prefixSize"] = dmrp.PrefixSize 2239 } 2240 if dmrp.SuffixSize != nil { 2241 objectMap["suffixSize"] = dmrp.SuffixSize 2242 } 2243 if dmrp.ReplacementString != nil { 2244 objectMap["replacementString"] = dmrp.ReplacementString 2245 } 2246 return json.Marshal(objectMap) 2247} 2248 2249// DataWarehouseUserActivities user activities of a data warehouse 2250type DataWarehouseUserActivities struct { 2251 autorest.Response `json:"-"` 2252 // DataWarehouseUserActivitiesProperties - Resource properties. 2253 *DataWarehouseUserActivitiesProperties `json:"properties,omitempty"` 2254 // ID - READ-ONLY; Resource ID. 2255 ID *string `json:"id,omitempty"` 2256 // Name - READ-ONLY; Resource name. 2257 Name *string `json:"name,omitempty"` 2258 // Type - READ-ONLY; Resource type. 2259 Type *string `json:"type,omitempty"` 2260} 2261 2262// MarshalJSON is the custom marshaler for DataWarehouseUserActivities. 2263func (dwua DataWarehouseUserActivities) MarshalJSON() ([]byte, error) { 2264 objectMap := make(map[string]interface{}) 2265 if dwua.DataWarehouseUserActivitiesProperties != nil { 2266 objectMap["properties"] = dwua.DataWarehouseUserActivitiesProperties 2267 } 2268 return json.Marshal(objectMap) 2269} 2270 2271// UnmarshalJSON is the custom unmarshaler for DataWarehouseUserActivities struct. 2272func (dwua *DataWarehouseUserActivities) UnmarshalJSON(body []byte) error { 2273 var m map[string]*json.RawMessage 2274 err := json.Unmarshal(body, &m) 2275 if err != nil { 2276 return err 2277 } 2278 for k, v := range m { 2279 switch k { 2280 case "properties": 2281 if v != nil { 2282 var dataWarehouseUserActivitiesProperties DataWarehouseUserActivitiesProperties 2283 err = json.Unmarshal(*v, &dataWarehouseUserActivitiesProperties) 2284 if err != nil { 2285 return err 2286 } 2287 dwua.DataWarehouseUserActivitiesProperties = &dataWarehouseUserActivitiesProperties 2288 } 2289 case "id": 2290 if v != nil { 2291 var ID string 2292 err = json.Unmarshal(*v, &ID) 2293 if err != nil { 2294 return err 2295 } 2296 dwua.ID = &ID 2297 } 2298 case "name": 2299 if v != nil { 2300 var name string 2301 err = json.Unmarshal(*v, &name) 2302 if err != nil { 2303 return err 2304 } 2305 dwua.Name = &name 2306 } 2307 case "type": 2308 if v != nil { 2309 var typeVar string 2310 err = json.Unmarshal(*v, &typeVar) 2311 if err != nil { 2312 return err 2313 } 2314 dwua.Type = &typeVar 2315 } 2316 } 2317 } 2318 2319 return nil 2320} 2321 2322// DataWarehouseUserActivitiesProperties user activities of a data warehouse. This currently includes the 2323// count of running or suspended queries. For more information, please view the sys.dm_pdw_exec_requests 2324// dynamic management view (DMV). 2325type DataWarehouseUserActivitiesProperties struct { 2326 // ActiveQueriesCount - READ-ONLY; Count of running and suspended queries. 2327 ActiveQueriesCount *int32 `json:"activeQueriesCount,omitempty"` 2328} 2329 2330// MarshalJSON is the custom marshaler for DataWarehouseUserActivitiesProperties. 2331func (dwuap DataWarehouseUserActivitiesProperties) MarshalJSON() ([]byte, error) { 2332 objectMap := make(map[string]interface{}) 2333 return json.Marshal(objectMap) 2334} 2335 2336// EditionCapability the database edition capabilities. 2337type EditionCapability struct { 2338 // Name - READ-ONLY; The edition name. 2339 Name *string `json:"name,omitempty"` 2340 // Status - READ-ONLY; The status of the edition. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' 2341 Status CapabilityStatus `json:"status,omitempty"` 2342 // SupportedServiceLevelObjectives - READ-ONLY; The list of supported service objectives for the edition. 2343 SupportedServiceLevelObjectives *[]ServiceObjectiveCapability `json:"supportedServiceLevelObjectives,omitempty"` 2344 // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. 2345 ZoneRedundant *bool `json:"zoneRedundant,omitempty"` 2346} 2347 2348// MarshalJSON is the custom marshaler for EditionCapability. 2349func (ec EditionCapability) MarshalJSON() ([]byte, error) { 2350 objectMap := make(map[string]interface{}) 2351 return json.Marshal(objectMap) 2352} 2353 2354// ElasticPool represents a database elastic pool. 2355type ElasticPool struct { 2356 autorest.Response `json:"-"` 2357 // ElasticPoolProperties - The properties representing the resource. 2358 *ElasticPoolProperties `json:"properties,omitempty"` 2359 // Kind - READ-ONLY; Kind of elastic pool. This is metadata used for the Azure portal experience. 2360 Kind *string `json:"kind,omitempty"` 2361 // Location - Resource location. 2362 Location *string `json:"location,omitempty"` 2363 // Tags - Resource tags. 2364 Tags map[string]*string `json:"tags"` 2365 // ID - READ-ONLY; Resource ID. 2366 ID *string `json:"id,omitempty"` 2367 // Name - READ-ONLY; Resource name. 2368 Name *string `json:"name,omitempty"` 2369 // Type - READ-ONLY; Resource type. 2370 Type *string `json:"type,omitempty"` 2371} 2372 2373// MarshalJSON is the custom marshaler for ElasticPool. 2374func (ep ElasticPool) MarshalJSON() ([]byte, error) { 2375 objectMap := make(map[string]interface{}) 2376 if ep.ElasticPoolProperties != nil { 2377 objectMap["properties"] = ep.ElasticPoolProperties 2378 } 2379 if ep.Location != nil { 2380 objectMap["location"] = ep.Location 2381 } 2382 if ep.Tags != nil { 2383 objectMap["tags"] = ep.Tags 2384 } 2385 return json.Marshal(objectMap) 2386} 2387 2388// UnmarshalJSON is the custom unmarshaler for ElasticPool struct. 2389func (ep *ElasticPool) UnmarshalJSON(body []byte) error { 2390 var m map[string]*json.RawMessage 2391 err := json.Unmarshal(body, &m) 2392 if err != nil { 2393 return err 2394 } 2395 for k, v := range m { 2396 switch k { 2397 case "properties": 2398 if v != nil { 2399 var elasticPoolProperties ElasticPoolProperties 2400 err = json.Unmarshal(*v, &elasticPoolProperties) 2401 if err != nil { 2402 return err 2403 } 2404 ep.ElasticPoolProperties = &elasticPoolProperties 2405 } 2406 case "kind": 2407 if v != nil { 2408 var kind string 2409 err = json.Unmarshal(*v, &kind) 2410 if err != nil { 2411 return err 2412 } 2413 ep.Kind = &kind 2414 } 2415 case "location": 2416 if v != nil { 2417 var location string 2418 err = json.Unmarshal(*v, &location) 2419 if err != nil { 2420 return err 2421 } 2422 ep.Location = &location 2423 } 2424 case "tags": 2425 if v != nil { 2426 var tags map[string]*string 2427 err = json.Unmarshal(*v, &tags) 2428 if err != nil { 2429 return err 2430 } 2431 ep.Tags = tags 2432 } 2433 case "id": 2434 if v != nil { 2435 var ID string 2436 err = json.Unmarshal(*v, &ID) 2437 if err != nil { 2438 return err 2439 } 2440 ep.ID = &ID 2441 } 2442 case "name": 2443 if v != nil { 2444 var name string 2445 err = json.Unmarshal(*v, &name) 2446 if err != nil { 2447 return err 2448 } 2449 ep.Name = &name 2450 } 2451 case "type": 2452 if v != nil { 2453 var typeVar string 2454 err = json.Unmarshal(*v, &typeVar) 2455 if err != nil { 2456 return err 2457 } 2458 ep.Type = &typeVar 2459 } 2460 } 2461 } 2462 2463 return nil 2464} 2465 2466// ElasticPoolActivity represents the activity on an elastic pool. 2467type ElasticPoolActivity struct { 2468 // Location - The geo-location where the resource lives 2469 Location *string `json:"location,omitempty"` 2470 // ElasticPoolActivityProperties - The properties representing the resource. 2471 *ElasticPoolActivityProperties `json:"properties,omitempty"` 2472 // ID - READ-ONLY; Resource ID. 2473 ID *string `json:"id,omitempty"` 2474 // Name - READ-ONLY; Resource name. 2475 Name *string `json:"name,omitempty"` 2476 // Type - READ-ONLY; Resource type. 2477 Type *string `json:"type,omitempty"` 2478} 2479 2480// MarshalJSON is the custom marshaler for ElasticPoolActivity. 2481func (epa ElasticPoolActivity) MarshalJSON() ([]byte, error) { 2482 objectMap := make(map[string]interface{}) 2483 if epa.Location != nil { 2484 objectMap["location"] = epa.Location 2485 } 2486 if epa.ElasticPoolActivityProperties != nil { 2487 objectMap["properties"] = epa.ElasticPoolActivityProperties 2488 } 2489 return json.Marshal(objectMap) 2490} 2491 2492// UnmarshalJSON is the custom unmarshaler for ElasticPoolActivity struct. 2493func (epa *ElasticPoolActivity) UnmarshalJSON(body []byte) error { 2494 var m map[string]*json.RawMessage 2495 err := json.Unmarshal(body, &m) 2496 if err != nil { 2497 return err 2498 } 2499 for k, v := range m { 2500 switch k { 2501 case "location": 2502 if v != nil { 2503 var location string 2504 err = json.Unmarshal(*v, &location) 2505 if err != nil { 2506 return err 2507 } 2508 epa.Location = &location 2509 } 2510 case "properties": 2511 if v != nil { 2512 var elasticPoolActivityProperties ElasticPoolActivityProperties 2513 err = json.Unmarshal(*v, &elasticPoolActivityProperties) 2514 if err != nil { 2515 return err 2516 } 2517 epa.ElasticPoolActivityProperties = &elasticPoolActivityProperties 2518 } 2519 case "id": 2520 if v != nil { 2521 var ID string 2522 err = json.Unmarshal(*v, &ID) 2523 if err != nil { 2524 return err 2525 } 2526 epa.ID = &ID 2527 } 2528 case "name": 2529 if v != nil { 2530 var name string 2531 err = json.Unmarshal(*v, &name) 2532 if err != nil { 2533 return err 2534 } 2535 epa.Name = &name 2536 } 2537 case "type": 2538 if v != nil { 2539 var typeVar string 2540 err = json.Unmarshal(*v, &typeVar) 2541 if err != nil { 2542 return err 2543 } 2544 epa.Type = &typeVar 2545 } 2546 } 2547 } 2548 2549 return nil 2550} 2551 2552// ElasticPoolActivityListResult represents the response to a list elastic pool activity request. 2553type ElasticPoolActivityListResult struct { 2554 autorest.Response `json:"-"` 2555 // Value - The list of elastic pool activities. 2556 Value *[]ElasticPoolActivity `json:"value,omitempty"` 2557} 2558 2559// ElasticPoolActivityProperties represents the properties of an elastic pool. 2560type ElasticPoolActivityProperties struct { 2561 // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). 2562 EndTime *date.Time `json:"endTime,omitempty"` 2563 // ErrorCode - READ-ONLY; The error code if available. 2564 ErrorCode *int32 `json:"errorCode,omitempty"` 2565 // ErrorMessage - READ-ONLY; The error message if available. 2566 ErrorMessage *string `json:"errorMessage,omitempty"` 2567 // ErrorSeverity - READ-ONLY; The error severity if available. 2568 ErrorSeverity *int32 `json:"errorSeverity,omitempty"` 2569 // Operation - READ-ONLY; The operation name. 2570 Operation *string `json:"operation,omitempty"` 2571 // OperationID - READ-ONLY; The unique operation ID. 2572 OperationID *uuid.UUID `json:"operationId,omitempty"` 2573 // PercentComplete - READ-ONLY; The percentage complete if available. 2574 PercentComplete *int32 `json:"percentComplete,omitempty"` 2575 // RequestedDatabaseDtuMax - READ-ONLY; The requested max DTU per database if available. 2576 RequestedDatabaseDtuMax *int32 `json:"requestedDatabaseDtuMax,omitempty"` 2577 // RequestedDatabaseDtuMin - READ-ONLY; The requested min DTU per database if available. 2578 RequestedDatabaseDtuMin *int32 `json:"requestedDatabaseDtuMin,omitempty"` 2579 // RequestedDtu - READ-ONLY; The requested DTU for the pool if available. 2580 RequestedDtu *int32 `json:"requestedDtu,omitempty"` 2581 // RequestedElasticPoolName - READ-ONLY; The requested name for the elastic pool if available. 2582 RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` 2583 // RequestedStorageLimitInGB - READ-ONLY; The requested storage limit for the pool in GB if available. 2584 RequestedStorageLimitInGB *int64 `json:"requestedStorageLimitInGB,omitempty"` 2585 // ElasticPoolName - READ-ONLY; The name of the elastic pool. 2586 ElasticPoolName *string `json:"elasticPoolName,omitempty"` 2587 // ServerName - READ-ONLY; The name of the server the elastic pool is in. 2588 ServerName *string `json:"serverName,omitempty"` 2589 // StartTime - READ-ONLY; The time the operation started (ISO8601 format). 2590 StartTime *date.Time `json:"startTime,omitempty"` 2591 // State - READ-ONLY; The current state of the operation. 2592 State *string `json:"state,omitempty"` 2593 // RequestedStorageLimitInMB - READ-ONLY; The requested storage limit in MB. 2594 RequestedStorageLimitInMB *int32 `json:"requestedStorageLimitInMB,omitempty"` 2595 // RequestedDatabaseDtuGuarantee - READ-ONLY; The requested per database DTU guarantee. 2596 RequestedDatabaseDtuGuarantee *int32 `json:"requestedDatabaseDtuGuarantee,omitempty"` 2597 // RequestedDatabaseDtuCap - READ-ONLY; The requested per database DTU cap. 2598 RequestedDatabaseDtuCap *int32 `json:"requestedDatabaseDtuCap,omitempty"` 2599 // RequestedDtuGuarantee - READ-ONLY; The requested DTU guarantee. 2600 RequestedDtuGuarantee *int32 `json:"requestedDtuGuarantee,omitempty"` 2601} 2602 2603// MarshalJSON is the custom marshaler for ElasticPoolActivityProperties. 2604func (epap ElasticPoolActivityProperties) MarshalJSON() ([]byte, error) { 2605 objectMap := make(map[string]interface{}) 2606 return json.Marshal(objectMap) 2607} 2608 2609// ElasticPoolDatabaseActivity represents the activity on an elastic pool. 2610type ElasticPoolDatabaseActivity struct { 2611 // Location - The geo-location where the resource lives 2612 Location *string `json:"location,omitempty"` 2613 // ElasticPoolDatabaseActivityProperties - The properties representing the resource. 2614 *ElasticPoolDatabaseActivityProperties `json:"properties,omitempty"` 2615 // ID - READ-ONLY; Resource ID. 2616 ID *string `json:"id,omitempty"` 2617 // Name - READ-ONLY; Resource name. 2618 Name *string `json:"name,omitempty"` 2619 // Type - READ-ONLY; Resource type. 2620 Type *string `json:"type,omitempty"` 2621} 2622 2623// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivity. 2624func (epda ElasticPoolDatabaseActivity) MarshalJSON() ([]byte, error) { 2625 objectMap := make(map[string]interface{}) 2626 if epda.Location != nil { 2627 objectMap["location"] = epda.Location 2628 } 2629 if epda.ElasticPoolDatabaseActivityProperties != nil { 2630 objectMap["properties"] = epda.ElasticPoolDatabaseActivityProperties 2631 } 2632 return json.Marshal(objectMap) 2633} 2634 2635// UnmarshalJSON is the custom unmarshaler for ElasticPoolDatabaseActivity struct. 2636func (epda *ElasticPoolDatabaseActivity) UnmarshalJSON(body []byte) error { 2637 var m map[string]*json.RawMessage 2638 err := json.Unmarshal(body, &m) 2639 if err != nil { 2640 return err 2641 } 2642 for k, v := range m { 2643 switch k { 2644 case "location": 2645 if v != nil { 2646 var location string 2647 err = json.Unmarshal(*v, &location) 2648 if err != nil { 2649 return err 2650 } 2651 epda.Location = &location 2652 } 2653 case "properties": 2654 if v != nil { 2655 var elasticPoolDatabaseActivityProperties ElasticPoolDatabaseActivityProperties 2656 err = json.Unmarshal(*v, &elasticPoolDatabaseActivityProperties) 2657 if err != nil { 2658 return err 2659 } 2660 epda.ElasticPoolDatabaseActivityProperties = &elasticPoolDatabaseActivityProperties 2661 } 2662 case "id": 2663 if v != nil { 2664 var ID string 2665 err = json.Unmarshal(*v, &ID) 2666 if err != nil { 2667 return err 2668 } 2669 epda.ID = &ID 2670 } 2671 case "name": 2672 if v != nil { 2673 var name string 2674 err = json.Unmarshal(*v, &name) 2675 if err != nil { 2676 return err 2677 } 2678 epda.Name = &name 2679 } 2680 case "type": 2681 if v != nil { 2682 var typeVar string 2683 err = json.Unmarshal(*v, &typeVar) 2684 if err != nil { 2685 return err 2686 } 2687 epda.Type = &typeVar 2688 } 2689 } 2690 } 2691 2692 return nil 2693} 2694 2695// ElasticPoolDatabaseActivityListResult represents the response to a list elastic pool database activity 2696// request. 2697type ElasticPoolDatabaseActivityListResult struct { 2698 autorest.Response `json:"-"` 2699 // Value - The list of elastic pool database activities. 2700 Value *[]ElasticPoolDatabaseActivity `json:"value,omitempty"` 2701} 2702 2703// ElasticPoolDatabaseActivityProperties represents the properties of an elastic pool database activity. 2704type ElasticPoolDatabaseActivityProperties struct { 2705 // DatabaseName - READ-ONLY; The database name. 2706 DatabaseName *string `json:"databaseName,omitempty"` 2707 // EndTime - READ-ONLY; The time the operation finished (ISO8601 format). 2708 EndTime *date.Time `json:"endTime,omitempty"` 2709 // ErrorCode - READ-ONLY; The error code if available. 2710 ErrorCode *int32 `json:"errorCode,omitempty"` 2711 // ErrorMessage - READ-ONLY; The error message if available. 2712 ErrorMessage *string `json:"errorMessage,omitempty"` 2713 // ErrorSeverity - READ-ONLY; The error severity if available. 2714 ErrorSeverity *int32 `json:"errorSeverity,omitempty"` 2715 // Operation - READ-ONLY; The operation name. 2716 Operation *string `json:"operation,omitempty"` 2717 // OperationID - READ-ONLY; The unique operation ID. 2718 OperationID *uuid.UUID `json:"operationId,omitempty"` 2719 // PercentComplete - READ-ONLY; The percentage complete if available. 2720 PercentComplete *int32 `json:"percentComplete,omitempty"` 2721 // RequestedElasticPoolName - READ-ONLY; The name for the elastic pool the database is moving into if available. 2722 RequestedElasticPoolName *string `json:"requestedElasticPoolName,omitempty"` 2723 // CurrentElasticPoolName - READ-ONLY; The name of the current elastic pool the database is in if available. 2724 CurrentElasticPoolName *string `json:"currentElasticPoolName,omitempty"` 2725 // CurrentServiceObjective - READ-ONLY; The name of the current service objective if available. 2726 CurrentServiceObjective *string `json:"currentServiceObjective,omitempty"` 2727 // RequestedServiceObjective - READ-ONLY; The name of the requested service objective if available. 2728 RequestedServiceObjective *string `json:"requestedServiceObjective,omitempty"` 2729 // ServerName - READ-ONLY; The name of the server the elastic pool is in. 2730 ServerName *string `json:"serverName,omitempty"` 2731 // StartTime - READ-ONLY; The time the operation started (ISO8601 format). 2732 StartTime *date.Time `json:"startTime,omitempty"` 2733 // State - READ-ONLY; The current state of the operation. 2734 State *string `json:"state,omitempty"` 2735} 2736 2737// MarshalJSON is the custom marshaler for ElasticPoolDatabaseActivityProperties. 2738func (epdap ElasticPoolDatabaseActivityProperties) MarshalJSON() ([]byte, error) { 2739 objectMap := make(map[string]interface{}) 2740 return json.Marshal(objectMap) 2741} 2742 2743// ElasticPoolDtuCapability the Elastic Pool DTU capability. 2744type ElasticPoolDtuCapability struct { 2745 // Limit - READ-ONLY; The maximum size of the database (see 'unit' for the units). 2746 Limit *int64 `json:"limit,omitempty"` 2747 // MaxDatabaseCount - READ-ONLY; The maximum number of databases supported. 2748 MaxDatabaseCount *int64 `json:"maxDatabaseCount,omitempty"` 2749 // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' 2750 Status CapabilityStatus `json:"status,omitempty"` 2751 // SupportedMaxSizes - READ-ONLY; The list of supported max sizes. 2752 SupportedMaxSizes *[]MaxSizeCapability `json:"supportedMaxSizes,omitempty"` 2753 // IncludedMaxSize - READ-ONLY; The included (free) max size for this service level objective. 2754 IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` 2755 // SupportedPerDatabaseMaxSizes - READ-ONLY; The list of supported max database sizes. 2756 SupportedPerDatabaseMaxSizes *[]MaxSizeCapability `json:"supportedPerDatabaseMaxSizes,omitempty"` 2757 // SupportedPerDatabaseMaxDtus - READ-ONLY; The list of supported max database DTUs. 2758 SupportedPerDatabaseMaxDtus *[]ElasticPoolPerDatabaseMaxDtuCapability `json:"supportedPerDatabaseMaxDtus,omitempty"` 2759} 2760 2761// MarshalJSON is the custom marshaler for ElasticPoolDtuCapability. 2762func (epdc ElasticPoolDtuCapability) MarshalJSON() ([]byte, error) { 2763 objectMap := make(map[string]interface{}) 2764 return json.Marshal(objectMap) 2765} 2766 2767// ElasticPoolEditionCapability the elastic pool edition capabilities. 2768type ElasticPoolEditionCapability struct { 2769 // Name - READ-ONLY; The elastic pool edition name. 2770 Name *string `json:"name,omitempty"` 2771 // Status - READ-ONLY; The status of the elastic pool edition. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' 2772 Status CapabilityStatus `json:"status,omitempty"` 2773 // SupportedElasticPoolDtus - READ-ONLY; The list of supported elastic pool DTU levels for the edition. 2774 SupportedElasticPoolDtus *[]ElasticPoolDtuCapability `json:"supportedElasticPoolDtus,omitempty"` 2775 // ZoneRedundant - READ-ONLY; Whether or not zone redundancy is supported for the edition. 2776 ZoneRedundant *bool `json:"zoneRedundant,omitempty"` 2777} 2778 2779// MarshalJSON is the custom marshaler for ElasticPoolEditionCapability. 2780func (epec ElasticPoolEditionCapability) MarshalJSON() ([]byte, error) { 2781 objectMap := make(map[string]interface{}) 2782 return json.Marshal(objectMap) 2783} 2784 2785// ElasticPoolListResult represents the response to a list elastic pool request. 2786type ElasticPoolListResult struct { 2787 autorest.Response `json:"-"` 2788 // Value - The list of elastic pools hosted in the server. 2789 Value *[]ElasticPool `json:"value,omitempty"` 2790} 2791 2792// ElasticPoolPerDatabaseMaxDtuCapability the max per-database DTU capability. 2793type ElasticPoolPerDatabaseMaxDtuCapability struct { 2794 // Limit - READ-ONLY; The maximum DTUs per database. 2795 Limit *int64 `json:"limit,omitempty"` 2796 // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' 2797 Status CapabilityStatus `json:"status,omitempty"` 2798 // SupportedPerDatabaseMinDtus - READ-ONLY; The list of supported min database DTUs. 2799 SupportedPerDatabaseMinDtus *[]ElasticPoolPerDatabaseMinDtuCapability `json:"supportedPerDatabaseMinDtus,omitempty"` 2800} 2801 2802// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMaxDtuCapability. 2803func (eppdmdc ElasticPoolPerDatabaseMaxDtuCapability) MarshalJSON() ([]byte, error) { 2804 objectMap := make(map[string]interface{}) 2805 return json.Marshal(objectMap) 2806} 2807 2808// ElasticPoolPerDatabaseMinDtuCapability the minimum per-database DTU capability. 2809type ElasticPoolPerDatabaseMinDtuCapability struct { 2810 // Limit - READ-ONLY; The maximum DTUs per database. 2811 Limit *int64 `json:"limit,omitempty"` 2812 // Status - READ-ONLY; The status of the capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' 2813 Status CapabilityStatus `json:"status,omitempty"` 2814} 2815 2816// MarshalJSON is the custom marshaler for ElasticPoolPerDatabaseMinDtuCapability. 2817func (eppdmdc ElasticPoolPerDatabaseMinDtuCapability) MarshalJSON() ([]byte, error) { 2818 objectMap := make(map[string]interface{}) 2819 return json.Marshal(objectMap) 2820} 2821 2822// ElasticPoolProperties represents the properties of an elastic pool. 2823type ElasticPoolProperties struct { 2824 // CreationDate - READ-ONLY; The creation date of the elastic pool (ISO8601 format). 2825 CreationDate *date.Time `json:"creationDate,omitempty"` 2826 // State - READ-ONLY; The state of the elastic pool. Possible values include: 'ElasticPoolStateCreating', 'ElasticPoolStateReady', 'ElasticPoolStateDisabled' 2827 State ElasticPoolState `json:"state,omitempty"` 2828 // Edition - The edition of the elastic pool. Possible values include: 'ElasticPoolEditionBasic', 'ElasticPoolEditionStandard', 'ElasticPoolEditionPremium', 'ElasticPoolEditionGeneralPurpose', 'ElasticPoolEditionBusinessCritical' 2829 Edition ElasticPoolEdition `json:"edition,omitempty"` 2830 // Dtu - The total shared DTU for the database elastic pool. 2831 Dtu *int32 `json:"dtu,omitempty"` 2832 // DatabaseDtuMax - The maximum DTU any one database can consume. 2833 DatabaseDtuMax *int32 `json:"databaseDtuMax,omitempty"` 2834 // DatabaseDtuMin - The minimum DTU all databases are guaranteed. 2835 DatabaseDtuMin *int32 `json:"databaseDtuMin,omitempty"` 2836 // StorageMB - Gets storage limit for the database elastic pool in MB. 2837 StorageMB *int32 `json:"storageMB,omitempty"` 2838 // ZoneRedundant - Whether or not this database elastic pool is zone redundant, which means the replicas of this database will be spread across multiple availability zones. 2839 ZoneRedundant *bool `json:"zoneRedundant,omitempty"` 2840} 2841 2842// MarshalJSON is the custom marshaler for ElasticPoolProperties. 2843func (epp ElasticPoolProperties) MarshalJSON() ([]byte, error) { 2844 objectMap := make(map[string]interface{}) 2845 if epp.Edition != "" { 2846 objectMap["edition"] = epp.Edition 2847 } 2848 if epp.Dtu != nil { 2849 objectMap["dtu"] = epp.Dtu 2850 } 2851 if epp.DatabaseDtuMax != nil { 2852 objectMap["databaseDtuMax"] = epp.DatabaseDtuMax 2853 } 2854 if epp.DatabaseDtuMin != nil { 2855 objectMap["databaseDtuMin"] = epp.DatabaseDtuMin 2856 } 2857 if epp.StorageMB != nil { 2858 objectMap["storageMB"] = epp.StorageMB 2859 } 2860 if epp.ZoneRedundant != nil { 2861 objectMap["zoneRedundant"] = epp.ZoneRedundant 2862 } 2863 return json.Marshal(objectMap) 2864} 2865 2866// ElasticPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 2867// long-running operation. 2868type ElasticPoolsCreateOrUpdateFuture struct { 2869 azure.FutureAPI 2870 // Result returns the result of the asynchronous operation. 2871 // If the operation has not completed it will return an error. 2872 Result func(ElasticPoolsClient) (ElasticPool, error) 2873} 2874 2875// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2876func (future *ElasticPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 2877 var azFuture azure.Future 2878 if err := json.Unmarshal(body, &azFuture); err != nil { 2879 return err 2880 } 2881 future.FutureAPI = &azFuture 2882 future.Result = future.result 2883 return nil 2884} 2885 2886// result is the default implementation for ElasticPoolsCreateOrUpdateFuture.Result. 2887func (future *ElasticPoolsCreateOrUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { 2888 var done bool 2889 done, err = future.DoneWithContext(context.Background(), client) 2890 if err != nil { 2891 err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 2892 return 2893 } 2894 if !done { 2895 ep.Response.Response = future.Response() 2896 err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsCreateOrUpdateFuture") 2897 return 2898 } 2899 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2900 if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { 2901 ep, err = client.CreateOrUpdateResponder(ep.Response.Response) 2902 if err != nil { 2903 err = autorest.NewErrorWithError(err, "sql.ElasticPoolsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") 2904 } 2905 } 2906 return 2907} 2908 2909// ElasticPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 2910// operation. 2911type ElasticPoolsUpdateFuture struct { 2912 azure.FutureAPI 2913 // Result returns the result of the asynchronous operation. 2914 // If the operation has not completed it will return an error. 2915 Result func(ElasticPoolsClient) (ElasticPool, error) 2916} 2917 2918// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2919func (future *ElasticPoolsUpdateFuture) UnmarshalJSON(body []byte) error { 2920 var azFuture azure.Future 2921 if err := json.Unmarshal(body, &azFuture); err != nil { 2922 return err 2923 } 2924 future.FutureAPI = &azFuture 2925 future.Result = future.result 2926 return nil 2927} 2928 2929// result is the default implementation for ElasticPoolsUpdateFuture.Result. 2930func (future *ElasticPoolsUpdateFuture) result(client ElasticPoolsClient) (ep ElasticPool, err error) { 2931 var done bool 2932 done, err = future.DoneWithContext(context.Background(), client) 2933 if err != nil { 2934 err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", future.Response(), "Polling failure") 2935 return 2936 } 2937 if !done { 2938 ep.Response.Response = future.Response() 2939 err = azure.NewAsyncOpIncompleteError("sql.ElasticPoolsUpdateFuture") 2940 return 2941 } 2942 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2943 if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { 2944 ep, err = client.UpdateResponder(ep.Response.Response) 2945 if err != nil { 2946 err = autorest.NewErrorWithError(err, "sql.ElasticPoolsUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") 2947 } 2948 } 2949 return 2950} 2951 2952// ElasticPoolUpdate represents an elastic pool update. 2953type ElasticPoolUpdate struct { 2954 // Tags - Resource tags. 2955 Tags map[string]*string `json:"tags"` 2956 // ElasticPoolProperties - The properties representing the resource. 2957 *ElasticPoolProperties `json:"properties,omitempty"` 2958 // ID - READ-ONLY; Resource ID. 2959 ID *string `json:"id,omitempty"` 2960 // Name - READ-ONLY; Resource name. 2961 Name *string `json:"name,omitempty"` 2962 // Type - READ-ONLY; Resource type. 2963 Type *string `json:"type,omitempty"` 2964} 2965 2966// MarshalJSON is the custom marshaler for ElasticPoolUpdate. 2967func (epu ElasticPoolUpdate) MarshalJSON() ([]byte, error) { 2968 objectMap := make(map[string]interface{}) 2969 if epu.Tags != nil { 2970 objectMap["tags"] = epu.Tags 2971 } 2972 if epu.ElasticPoolProperties != nil { 2973 objectMap["properties"] = epu.ElasticPoolProperties 2974 } 2975 return json.Marshal(objectMap) 2976} 2977 2978// UnmarshalJSON is the custom unmarshaler for ElasticPoolUpdate struct. 2979func (epu *ElasticPoolUpdate) UnmarshalJSON(body []byte) error { 2980 var m map[string]*json.RawMessage 2981 err := json.Unmarshal(body, &m) 2982 if err != nil { 2983 return err 2984 } 2985 for k, v := range m { 2986 switch k { 2987 case "tags": 2988 if v != nil { 2989 var tags map[string]*string 2990 err = json.Unmarshal(*v, &tags) 2991 if err != nil { 2992 return err 2993 } 2994 epu.Tags = tags 2995 } 2996 case "properties": 2997 if v != nil { 2998 var elasticPoolProperties ElasticPoolProperties 2999 err = json.Unmarshal(*v, &elasticPoolProperties) 3000 if err != nil { 3001 return err 3002 } 3003 epu.ElasticPoolProperties = &elasticPoolProperties 3004 } 3005 case "id": 3006 if v != nil { 3007 var ID string 3008 err = json.Unmarshal(*v, &ID) 3009 if err != nil { 3010 return err 3011 } 3012 epu.ID = &ID 3013 } 3014 case "name": 3015 if v != nil { 3016 var name string 3017 err = json.Unmarshal(*v, &name) 3018 if err != nil { 3019 return err 3020 } 3021 epu.Name = &name 3022 } 3023 case "type": 3024 if v != nil { 3025 var typeVar string 3026 err = json.Unmarshal(*v, &typeVar) 3027 if err != nil { 3028 return err 3029 } 3030 epu.Type = &typeVar 3031 } 3032 } 3033 } 3034 3035 return nil 3036} 3037 3038// EncryptionProtector the server encryption protector. 3039type EncryptionProtector struct { 3040 autorest.Response `json:"-"` 3041 // Kind - READ-ONLY; Kind of encryption protector. This is metadata used for the Azure portal experience. 3042 Kind *string `json:"kind,omitempty"` 3043 // Location - READ-ONLY; Resource location. 3044 Location *string `json:"location,omitempty"` 3045 // EncryptionProtectorProperties - Resource properties. 3046 *EncryptionProtectorProperties `json:"properties,omitempty"` 3047 // ID - READ-ONLY; Resource ID. 3048 ID *string `json:"id,omitempty"` 3049 // Name - READ-ONLY; Resource name. 3050 Name *string `json:"name,omitempty"` 3051 // Type - READ-ONLY; Resource type. 3052 Type *string `json:"type,omitempty"` 3053} 3054 3055// MarshalJSON is the custom marshaler for EncryptionProtector. 3056func (ep EncryptionProtector) MarshalJSON() ([]byte, error) { 3057 objectMap := make(map[string]interface{}) 3058 if ep.EncryptionProtectorProperties != nil { 3059 objectMap["properties"] = ep.EncryptionProtectorProperties 3060 } 3061 return json.Marshal(objectMap) 3062} 3063 3064// UnmarshalJSON is the custom unmarshaler for EncryptionProtector struct. 3065func (ep *EncryptionProtector) UnmarshalJSON(body []byte) error { 3066 var m map[string]*json.RawMessage 3067 err := json.Unmarshal(body, &m) 3068 if err != nil { 3069 return err 3070 } 3071 for k, v := range m { 3072 switch k { 3073 case "kind": 3074 if v != nil { 3075 var kind string 3076 err = json.Unmarshal(*v, &kind) 3077 if err != nil { 3078 return err 3079 } 3080 ep.Kind = &kind 3081 } 3082 case "location": 3083 if v != nil { 3084 var location string 3085 err = json.Unmarshal(*v, &location) 3086 if err != nil { 3087 return err 3088 } 3089 ep.Location = &location 3090 } 3091 case "properties": 3092 if v != nil { 3093 var encryptionProtectorProperties EncryptionProtectorProperties 3094 err = json.Unmarshal(*v, &encryptionProtectorProperties) 3095 if err != nil { 3096 return err 3097 } 3098 ep.EncryptionProtectorProperties = &encryptionProtectorProperties 3099 } 3100 case "id": 3101 if v != nil { 3102 var ID string 3103 err = json.Unmarshal(*v, &ID) 3104 if err != nil { 3105 return err 3106 } 3107 ep.ID = &ID 3108 } 3109 case "name": 3110 if v != nil { 3111 var name string 3112 err = json.Unmarshal(*v, &name) 3113 if err != nil { 3114 return err 3115 } 3116 ep.Name = &name 3117 } 3118 case "type": 3119 if v != nil { 3120 var typeVar string 3121 err = json.Unmarshal(*v, &typeVar) 3122 if err != nil { 3123 return err 3124 } 3125 ep.Type = &typeVar 3126 } 3127 } 3128 } 3129 3130 return nil 3131} 3132 3133// EncryptionProtectorListResult a list of server encryption protectors. 3134type EncryptionProtectorListResult struct { 3135 autorest.Response `json:"-"` 3136 // Value - READ-ONLY; Array of results. 3137 Value *[]EncryptionProtector `json:"value,omitempty"` 3138 // NextLink - READ-ONLY; Link to retrieve next page of results. 3139 NextLink *string `json:"nextLink,omitempty"` 3140} 3141 3142// MarshalJSON is the custom marshaler for EncryptionProtectorListResult. 3143func (eplr EncryptionProtectorListResult) MarshalJSON() ([]byte, error) { 3144 objectMap := make(map[string]interface{}) 3145 return json.Marshal(objectMap) 3146} 3147 3148// EncryptionProtectorListResultIterator provides access to a complete listing of EncryptionProtector 3149// values. 3150type EncryptionProtectorListResultIterator struct { 3151 i int 3152 page EncryptionProtectorListResultPage 3153} 3154 3155// NextWithContext advances to the next value. If there was an error making 3156// the request the iterator does not advance and the error is returned. 3157func (iter *EncryptionProtectorListResultIterator) NextWithContext(ctx context.Context) (err error) { 3158 if tracing.IsEnabled() { 3159 ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultIterator.NextWithContext") 3160 defer func() { 3161 sc := -1 3162 if iter.Response().Response.Response != nil { 3163 sc = iter.Response().Response.Response.StatusCode 3164 } 3165 tracing.EndSpan(ctx, sc, err) 3166 }() 3167 } 3168 iter.i++ 3169 if iter.i < len(iter.page.Values()) { 3170 return nil 3171 } 3172 err = iter.page.NextWithContext(ctx) 3173 if err != nil { 3174 iter.i-- 3175 return err 3176 } 3177 iter.i = 0 3178 return nil 3179} 3180 3181// Next advances to the next value. If there was an error making 3182// the request the iterator does not advance and the error is returned. 3183// Deprecated: Use NextWithContext() instead. 3184func (iter *EncryptionProtectorListResultIterator) Next() error { 3185 return iter.NextWithContext(context.Background()) 3186} 3187 3188// NotDone returns true if the enumeration should be started or is not yet complete. 3189func (iter EncryptionProtectorListResultIterator) NotDone() bool { 3190 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3191} 3192 3193// Response returns the raw server response from the last page request. 3194func (iter EncryptionProtectorListResultIterator) Response() EncryptionProtectorListResult { 3195 return iter.page.Response() 3196} 3197 3198// Value returns the current value or a zero-initialized value if the 3199// iterator has advanced beyond the end of the collection. 3200func (iter EncryptionProtectorListResultIterator) Value() EncryptionProtector { 3201 if !iter.page.NotDone() { 3202 return EncryptionProtector{} 3203 } 3204 return iter.page.Values()[iter.i] 3205} 3206 3207// Creates a new instance of the EncryptionProtectorListResultIterator type. 3208func NewEncryptionProtectorListResultIterator(page EncryptionProtectorListResultPage) EncryptionProtectorListResultIterator { 3209 return EncryptionProtectorListResultIterator{page: page} 3210} 3211 3212// IsEmpty returns true if the ListResult contains no values. 3213func (eplr EncryptionProtectorListResult) IsEmpty() bool { 3214 return eplr.Value == nil || len(*eplr.Value) == 0 3215} 3216 3217// hasNextLink returns true if the NextLink is not empty. 3218func (eplr EncryptionProtectorListResult) hasNextLink() bool { 3219 return eplr.NextLink != nil && len(*eplr.NextLink) != 0 3220} 3221 3222// encryptionProtectorListResultPreparer prepares a request to retrieve the next set of results. 3223// It returns nil if no more results exist. 3224func (eplr EncryptionProtectorListResult) encryptionProtectorListResultPreparer(ctx context.Context) (*http.Request, error) { 3225 if !eplr.hasNextLink() { 3226 return nil, nil 3227 } 3228 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3229 autorest.AsJSON(), 3230 autorest.AsGet(), 3231 autorest.WithBaseURL(to.String(eplr.NextLink))) 3232} 3233 3234// EncryptionProtectorListResultPage contains a page of EncryptionProtector values. 3235type EncryptionProtectorListResultPage struct { 3236 fn func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error) 3237 eplr EncryptionProtectorListResult 3238} 3239 3240// NextWithContext advances to the next page of values. If there was an error making 3241// the request the page does not advance and the error is returned. 3242func (page *EncryptionProtectorListResultPage) NextWithContext(ctx context.Context) (err error) { 3243 if tracing.IsEnabled() { 3244 ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionProtectorListResultPage.NextWithContext") 3245 defer func() { 3246 sc := -1 3247 if page.Response().Response.Response != nil { 3248 sc = page.Response().Response.Response.StatusCode 3249 } 3250 tracing.EndSpan(ctx, sc, err) 3251 }() 3252 } 3253 for { 3254 next, err := page.fn(ctx, page.eplr) 3255 if err != nil { 3256 return err 3257 } 3258 page.eplr = next 3259 if !next.hasNextLink() || !next.IsEmpty() { 3260 break 3261 } 3262 } 3263 return nil 3264} 3265 3266// Next advances to the next page of values. If there was an error making 3267// the request the page does not advance and the error is returned. 3268// Deprecated: Use NextWithContext() instead. 3269func (page *EncryptionProtectorListResultPage) Next() error { 3270 return page.NextWithContext(context.Background()) 3271} 3272 3273// NotDone returns true if the page enumeration should be started or is not yet complete. 3274func (page EncryptionProtectorListResultPage) NotDone() bool { 3275 return !page.eplr.IsEmpty() 3276} 3277 3278// Response returns the raw server response from the last page request. 3279func (page EncryptionProtectorListResultPage) Response() EncryptionProtectorListResult { 3280 return page.eplr 3281} 3282 3283// Values returns the slice of values for the current page or nil if there are no values. 3284func (page EncryptionProtectorListResultPage) Values() []EncryptionProtector { 3285 if page.eplr.IsEmpty() { 3286 return nil 3287 } 3288 return *page.eplr.Value 3289} 3290 3291// Creates a new instance of the EncryptionProtectorListResultPage type. 3292func NewEncryptionProtectorListResultPage(cur EncryptionProtectorListResult, getNextPage func(context.Context, EncryptionProtectorListResult) (EncryptionProtectorListResult, error)) EncryptionProtectorListResultPage { 3293 return EncryptionProtectorListResultPage{ 3294 fn: getNextPage, 3295 eplr: cur, 3296 } 3297} 3298 3299// EncryptionProtectorProperties properties for an encryption protector execution. 3300type EncryptionProtectorProperties struct { 3301 // Subregion - READ-ONLY; Subregion of the encryption protector. 3302 Subregion *string `json:"subregion,omitempty"` 3303 // ServerKeyName - The name of the server key. 3304 ServerKeyName *string `json:"serverKeyName,omitempty"` 3305 // ServerKeyType - The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' 3306 ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` 3307 // URI - READ-ONLY; The URI of the server key. 3308 URI *string `json:"uri,omitempty"` 3309 // Thumbprint - READ-ONLY; Thumbprint of the server key. 3310 Thumbprint *string `json:"thumbprint,omitempty"` 3311} 3312 3313// MarshalJSON is the custom marshaler for EncryptionProtectorProperties. 3314func (epp EncryptionProtectorProperties) MarshalJSON() ([]byte, error) { 3315 objectMap := make(map[string]interface{}) 3316 if epp.ServerKeyName != nil { 3317 objectMap["serverKeyName"] = epp.ServerKeyName 3318 } 3319 if epp.ServerKeyType != "" { 3320 objectMap["serverKeyType"] = epp.ServerKeyType 3321 } 3322 return json.Marshal(objectMap) 3323} 3324 3325// EncryptionProtectorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 3326// long-running operation. 3327type EncryptionProtectorsCreateOrUpdateFuture struct { 3328 azure.FutureAPI 3329 // Result returns the result of the asynchronous operation. 3330 // If the operation has not completed it will return an error. 3331 Result func(EncryptionProtectorsClient) (EncryptionProtector, error) 3332} 3333 3334// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3335func (future *EncryptionProtectorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 3336 var azFuture azure.Future 3337 if err := json.Unmarshal(body, &azFuture); err != nil { 3338 return err 3339 } 3340 future.FutureAPI = &azFuture 3341 future.Result = future.result 3342 return nil 3343} 3344 3345// result is the default implementation for EncryptionProtectorsCreateOrUpdateFuture.Result. 3346func (future *EncryptionProtectorsCreateOrUpdateFuture) result(client EncryptionProtectorsClient) (ep EncryptionProtector, err error) { 3347 var done bool 3348 done, err = future.DoneWithContext(context.Background(), client) 3349 if err != nil { 3350 err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 3351 return 3352 } 3353 if !done { 3354 ep.Response.Response = future.Response() 3355 err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsCreateOrUpdateFuture") 3356 return 3357 } 3358 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3359 if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { 3360 ep, err = client.CreateOrUpdateResponder(ep.Response.Response) 3361 if err != nil { 3362 err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsCreateOrUpdateFuture", "Result", ep.Response.Response, "Failure responding to request") 3363 } 3364 } 3365 return 3366} 3367 3368// EncryptionProtectorsRevalidateFuture an abstraction for monitoring and retrieving the results of a 3369// long-running operation. 3370type EncryptionProtectorsRevalidateFuture struct { 3371 azure.FutureAPI 3372 // Result returns the result of the asynchronous operation. 3373 // If the operation has not completed it will return an error. 3374 Result func(EncryptionProtectorsClient) (autorest.Response, error) 3375} 3376 3377// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3378func (future *EncryptionProtectorsRevalidateFuture) UnmarshalJSON(body []byte) error { 3379 var azFuture azure.Future 3380 if err := json.Unmarshal(body, &azFuture); err != nil { 3381 return err 3382 } 3383 future.FutureAPI = &azFuture 3384 future.Result = future.result 3385 return nil 3386} 3387 3388// result is the default implementation for EncryptionProtectorsRevalidateFuture.Result. 3389func (future *EncryptionProtectorsRevalidateFuture) result(client EncryptionProtectorsClient) (ar autorest.Response, err error) { 3390 var done bool 3391 done, err = future.DoneWithContext(context.Background(), client) 3392 if err != nil { 3393 err = autorest.NewErrorWithError(err, "sql.EncryptionProtectorsRevalidateFuture", "Result", future.Response(), "Polling failure") 3394 return 3395 } 3396 if !done { 3397 ar.Response = future.Response() 3398 err = azure.NewAsyncOpIncompleteError("sql.EncryptionProtectorsRevalidateFuture") 3399 return 3400 } 3401 ar.Response = future.Response() 3402 return 3403} 3404 3405// ExportRequest export database parameters. 3406type ExportRequest struct { 3407 // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' 3408 StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` 3409 // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." 3410 StorageKey *string `json:"storageKey,omitempty"` 3411 // StorageURI - The storage uri to use. 3412 StorageURI *string `json:"storageUri,omitempty"` 3413 // AdministratorLogin - The name of the SQL administrator. 3414 AdministratorLogin *string `json:"administratorLogin,omitempty"` 3415 // AdministratorLoginPassword - The password of the SQL administrator. 3416 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` 3417 // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' 3418 AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` 3419} 3420 3421// ExtendedDatabaseBlobAuditingPolicy an extended database blob auditing policy. 3422type ExtendedDatabaseBlobAuditingPolicy struct { 3423 autorest.Response `json:"-"` 3424 // ExtendedDatabaseBlobAuditingPolicyProperties - Resource properties. 3425 *ExtendedDatabaseBlobAuditingPolicyProperties `json:"properties,omitempty"` 3426 // ID - READ-ONLY; Resource ID. 3427 ID *string `json:"id,omitempty"` 3428 // Name - READ-ONLY; Resource name. 3429 Name *string `json:"name,omitempty"` 3430 // Type - READ-ONLY; Resource type. 3431 Type *string `json:"type,omitempty"` 3432} 3433 3434// MarshalJSON is the custom marshaler for ExtendedDatabaseBlobAuditingPolicy. 3435func (edbap ExtendedDatabaseBlobAuditingPolicy) MarshalJSON() ([]byte, error) { 3436 objectMap := make(map[string]interface{}) 3437 if edbap.ExtendedDatabaseBlobAuditingPolicyProperties != nil { 3438 objectMap["properties"] = edbap.ExtendedDatabaseBlobAuditingPolicyProperties 3439 } 3440 return json.Marshal(objectMap) 3441} 3442 3443// UnmarshalJSON is the custom unmarshaler for ExtendedDatabaseBlobAuditingPolicy struct. 3444func (edbap *ExtendedDatabaseBlobAuditingPolicy) UnmarshalJSON(body []byte) error { 3445 var m map[string]*json.RawMessage 3446 err := json.Unmarshal(body, &m) 3447 if err != nil { 3448 return err 3449 } 3450 for k, v := range m { 3451 switch k { 3452 case "properties": 3453 if v != nil { 3454 var extendedDatabaseBlobAuditingPolicyProperties ExtendedDatabaseBlobAuditingPolicyProperties 3455 err = json.Unmarshal(*v, &extendedDatabaseBlobAuditingPolicyProperties) 3456 if err != nil { 3457 return err 3458 } 3459 edbap.ExtendedDatabaseBlobAuditingPolicyProperties = &extendedDatabaseBlobAuditingPolicyProperties 3460 } 3461 case "id": 3462 if v != nil { 3463 var ID string 3464 err = json.Unmarshal(*v, &ID) 3465 if err != nil { 3466 return err 3467 } 3468 edbap.ID = &ID 3469 } 3470 case "name": 3471 if v != nil { 3472 var name string 3473 err = json.Unmarshal(*v, &name) 3474 if err != nil { 3475 return err 3476 } 3477 edbap.Name = &name 3478 } 3479 case "type": 3480 if v != nil { 3481 var typeVar string 3482 err = json.Unmarshal(*v, &typeVar) 3483 if err != nil { 3484 return err 3485 } 3486 edbap.Type = &typeVar 3487 } 3488 } 3489 } 3490 3491 return nil 3492} 3493 3494// ExtendedDatabaseBlobAuditingPolicyListResult a list of database extended auditing settings. 3495type ExtendedDatabaseBlobAuditingPolicyListResult struct { 3496 autorest.Response `json:"-"` 3497 // Value - READ-ONLY; Array of results. 3498 Value *[]ExtendedDatabaseBlobAuditingPolicy `json:"value,omitempty"` 3499 // NextLink - READ-ONLY; Link to retrieve next page of results. 3500 NextLink *string `json:"nextLink,omitempty"` 3501} 3502 3503// MarshalJSON is the custom marshaler for ExtendedDatabaseBlobAuditingPolicyListResult. 3504func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { 3505 objectMap := make(map[string]interface{}) 3506 return json.Marshal(objectMap) 3507} 3508 3509// ExtendedDatabaseBlobAuditingPolicyListResultIterator provides access to a complete listing of 3510// ExtendedDatabaseBlobAuditingPolicy values. 3511type ExtendedDatabaseBlobAuditingPolicyListResultIterator struct { 3512 i int 3513 page ExtendedDatabaseBlobAuditingPolicyListResultPage 3514} 3515 3516// NextWithContext advances to the next value. If there was an error making 3517// the request the iterator does not advance and the error is returned. 3518func (iter *ExtendedDatabaseBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { 3519 if tracing.IsEnabled() { 3520 ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPolicyListResultIterator.NextWithContext") 3521 defer func() { 3522 sc := -1 3523 if iter.Response().Response.Response != nil { 3524 sc = iter.Response().Response.Response.StatusCode 3525 } 3526 tracing.EndSpan(ctx, sc, err) 3527 }() 3528 } 3529 iter.i++ 3530 if iter.i < len(iter.page.Values()) { 3531 return nil 3532 } 3533 err = iter.page.NextWithContext(ctx) 3534 if err != nil { 3535 iter.i-- 3536 return err 3537 } 3538 iter.i = 0 3539 return nil 3540} 3541 3542// Next advances to the next value. If there was an error making 3543// the request the iterator does not advance and the error is returned. 3544// Deprecated: Use NextWithContext() instead. 3545func (iter *ExtendedDatabaseBlobAuditingPolicyListResultIterator) Next() error { 3546 return iter.NextWithContext(context.Background()) 3547} 3548 3549// NotDone returns true if the enumeration should be started or is not yet complete. 3550func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) NotDone() bool { 3551 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3552} 3553 3554// Response returns the raw server response from the last page request. 3555func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) Response() ExtendedDatabaseBlobAuditingPolicyListResult { 3556 return iter.page.Response() 3557} 3558 3559// Value returns the current value or a zero-initialized value if the 3560// iterator has advanced beyond the end of the collection. 3561func (iter ExtendedDatabaseBlobAuditingPolicyListResultIterator) Value() ExtendedDatabaseBlobAuditingPolicy { 3562 if !iter.page.NotDone() { 3563 return ExtendedDatabaseBlobAuditingPolicy{} 3564 } 3565 return iter.page.Values()[iter.i] 3566} 3567 3568// Creates a new instance of the ExtendedDatabaseBlobAuditingPolicyListResultIterator type. 3569func NewExtendedDatabaseBlobAuditingPolicyListResultIterator(page ExtendedDatabaseBlobAuditingPolicyListResultPage) ExtendedDatabaseBlobAuditingPolicyListResultIterator { 3570 return ExtendedDatabaseBlobAuditingPolicyListResultIterator{page: page} 3571} 3572 3573// IsEmpty returns true if the ListResult contains no values. 3574func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) IsEmpty() bool { 3575 return edbaplr.Value == nil || len(*edbaplr.Value) == 0 3576} 3577 3578// hasNextLink returns true if the NextLink is not empty. 3579func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) hasNextLink() bool { 3580 return edbaplr.NextLink != nil && len(*edbaplr.NextLink) != 0 3581} 3582 3583// extendedDatabaseBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. 3584// It returns nil if no more results exist. 3585func (edbaplr ExtendedDatabaseBlobAuditingPolicyListResult) extendedDatabaseBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { 3586 if !edbaplr.hasNextLink() { 3587 return nil, nil 3588 } 3589 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3590 autorest.AsJSON(), 3591 autorest.AsGet(), 3592 autorest.WithBaseURL(to.String(edbaplr.NextLink))) 3593} 3594 3595// ExtendedDatabaseBlobAuditingPolicyListResultPage contains a page of ExtendedDatabaseBlobAuditingPolicy 3596// values. 3597type ExtendedDatabaseBlobAuditingPolicyListResultPage struct { 3598 fn func(context.Context, ExtendedDatabaseBlobAuditingPolicyListResult) (ExtendedDatabaseBlobAuditingPolicyListResult, error) 3599 edbaplr ExtendedDatabaseBlobAuditingPolicyListResult 3600} 3601 3602// NextWithContext advances to the next page of values. If there was an error making 3603// the request the page does not advance and the error is returned. 3604func (page *ExtendedDatabaseBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { 3605 if tracing.IsEnabled() { 3606 ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedDatabaseBlobAuditingPolicyListResultPage.NextWithContext") 3607 defer func() { 3608 sc := -1 3609 if page.Response().Response.Response != nil { 3610 sc = page.Response().Response.Response.StatusCode 3611 } 3612 tracing.EndSpan(ctx, sc, err) 3613 }() 3614 } 3615 for { 3616 next, err := page.fn(ctx, page.edbaplr) 3617 if err != nil { 3618 return err 3619 } 3620 page.edbaplr = next 3621 if !next.hasNextLink() || !next.IsEmpty() { 3622 break 3623 } 3624 } 3625 return nil 3626} 3627 3628// Next advances to the next page of values. If there was an error making 3629// the request the page does not advance and the error is returned. 3630// Deprecated: Use NextWithContext() instead. 3631func (page *ExtendedDatabaseBlobAuditingPolicyListResultPage) Next() error { 3632 return page.NextWithContext(context.Background()) 3633} 3634 3635// NotDone returns true if the page enumeration should be started or is not yet complete. 3636func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) NotDone() bool { 3637 return !page.edbaplr.IsEmpty() 3638} 3639 3640// Response returns the raw server response from the last page request. 3641func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) Response() ExtendedDatabaseBlobAuditingPolicyListResult { 3642 return page.edbaplr 3643} 3644 3645// Values returns the slice of values for the current page or nil if there are no values. 3646func (page ExtendedDatabaseBlobAuditingPolicyListResultPage) Values() []ExtendedDatabaseBlobAuditingPolicy { 3647 if page.edbaplr.IsEmpty() { 3648 return nil 3649 } 3650 return *page.edbaplr.Value 3651} 3652 3653// Creates a new instance of the ExtendedDatabaseBlobAuditingPolicyListResultPage type. 3654func NewExtendedDatabaseBlobAuditingPolicyListResultPage(cur ExtendedDatabaseBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedDatabaseBlobAuditingPolicyListResult) (ExtendedDatabaseBlobAuditingPolicyListResult, error)) ExtendedDatabaseBlobAuditingPolicyListResultPage { 3655 return ExtendedDatabaseBlobAuditingPolicyListResultPage{ 3656 fn: getNextPage, 3657 edbaplr: cur, 3658 } 3659} 3660 3661// ExtendedDatabaseBlobAuditingPolicyProperties properties of an extended database blob auditing policy. 3662type ExtendedDatabaseBlobAuditingPolicyProperties struct { 3663 // PredicateExpression - Specifies condition of where clause when creating an audit. 3664 PredicateExpression *string `json:"predicateExpression,omitempty"` 3665 // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' 3666 State BlobAuditingPolicyState `json:"state,omitempty"` 3667 // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. 3668 StorageEndpoint *string `json:"storageEndpoint,omitempty"` 3669 // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. 3670 // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. 3671 // Prerequisites for using managed identity authentication: 3672 // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 3673 // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. 3674 // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) 3675 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 3676 // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. 3677 RetentionDays *int32 `json:"retentionDays,omitempty"` 3678 // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. 3679 // 3680 // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: 3681 // 3682 // BATCH_COMPLETED_GROUP, 3683 // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, 3684 // FAILED_DATABASE_AUTHENTICATION_GROUP. 3685 // 3686 // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. 3687 // 3688 // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): 3689 // 3690 // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP 3691 // BACKUP_RESTORE_GROUP 3692 // DATABASE_LOGOUT_GROUP 3693 // DATABASE_OBJECT_CHANGE_GROUP 3694 // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP 3695 // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP 3696 // DATABASE_OPERATION_GROUP 3697 // DATABASE_PERMISSION_CHANGE_GROUP 3698 // DATABASE_PRINCIPAL_CHANGE_GROUP 3699 // DATABASE_PRINCIPAL_IMPERSONATION_GROUP 3700 // DATABASE_ROLE_MEMBER_CHANGE_GROUP 3701 // FAILED_DATABASE_AUTHENTICATION_GROUP 3702 // SCHEMA_OBJECT_ACCESS_GROUP 3703 // SCHEMA_OBJECT_CHANGE_GROUP 3704 // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP 3705 // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP 3706 // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP 3707 // USER_CHANGE_PASSWORD_GROUP 3708 // BATCH_STARTED_GROUP 3709 // BATCH_COMPLETED_GROUP 3710 // 3711 // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. 3712 // 3713 // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). 3714 // 3715 // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: 3716 // SELECT 3717 // UPDATE 3718 // INSERT 3719 // DELETE 3720 // EXECUTE 3721 // RECEIVE 3722 // REFERENCES 3723 // 3724 // The general form for defining an action to be audited is: 3725 // {action} ON {object} BY {principal} 3726 // 3727 // Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. 3728 // 3729 // For example: 3730 // SELECT on dbo.myTable by public 3731 // SELECT on DATABASE::myDatabase by public 3732 // SELECT on SCHEMA::mySchema by public 3733 // 3734 // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) 3735 AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` 3736 // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. 3737 StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` 3738 // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. 3739 IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` 3740 // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. 3741 // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. 3742 // 3743 // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. 3744 // Note that for server level audit you should use the 'master' database as {databaseName}. 3745 // 3746 // Diagnostic Settings URI format: 3747 // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview 3748 // 3749 // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) 3750 // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) 3751 IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` 3752 // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. 3753 // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. 3754 QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` 3755} 3756 3757// ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the 3758// results of a long-running operation. 3759type ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture struct { 3760 azure.FutureAPI 3761 // Result returns the result of the asynchronous operation. 3762 // If the operation has not completed it will return an error. 3763 Result func(ExtendedServerBlobAuditingPoliciesClient) (ExtendedServerBlobAuditingPolicy, error) 3764} 3765 3766// UnmarshalJSON is the custom unmarshaller for CreateFuture. 3767func (future *ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 3768 var azFuture azure.Future 3769 if err := json.Unmarshal(body, &azFuture); err != nil { 3770 return err 3771 } 3772 future.FutureAPI = &azFuture 3773 future.Result = future.result 3774 return nil 3775} 3776 3777// result is the default implementation for ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture.Result. 3778func (future *ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture) result(client ExtendedServerBlobAuditingPoliciesClient) (esbap ExtendedServerBlobAuditingPolicy, err error) { 3779 var done bool 3780 done, err = future.DoneWithContext(context.Background(), client) 3781 if err != nil { 3782 err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 3783 return 3784 } 3785 if !done { 3786 esbap.Response.Response = future.Response() 3787 err = azure.NewAsyncOpIncompleteError("sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture") 3788 return 3789 } 3790 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3791 if esbap.Response.Response, err = future.GetResult(sender); err == nil && esbap.Response.Response.StatusCode != http.StatusNoContent { 3792 esbap, err = client.CreateOrUpdateResponder(esbap.Response.Response) 3793 if err != nil { 3794 err = autorest.NewErrorWithError(err, "sql.ExtendedServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", esbap.Response.Response, "Failure responding to request") 3795 } 3796 } 3797 return 3798} 3799 3800// ExtendedServerBlobAuditingPolicy an extended server blob auditing policy. 3801type ExtendedServerBlobAuditingPolicy struct { 3802 autorest.Response `json:"-"` 3803 // ExtendedServerBlobAuditingPolicyProperties - Resource properties. 3804 *ExtendedServerBlobAuditingPolicyProperties `json:"properties,omitempty"` 3805 // ID - READ-ONLY; Resource ID. 3806 ID *string `json:"id,omitempty"` 3807 // Name - READ-ONLY; Resource name. 3808 Name *string `json:"name,omitempty"` 3809 // Type - READ-ONLY; Resource type. 3810 Type *string `json:"type,omitempty"` 3811} 3812 3813// MarshalJSON is the custom marshaler for ExtendedServerBlobAuditingPolicy. 3814func (esbap ExtendedServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { 3815 objectMap := make(map[string]interface{}) 3816 if esbap.ExtendedServerBlobAuditingPolicyProperties != nil { 3817 objectMap["properties"] = esbap.ExtendedServerBlobAuditingPolicyProperties 3818 } 3819 return json.Marshal(objectMap) 3820} 3821 3822// UnmarshalJSON is the custom unmarshaler for ExtendedServerBlobAuditingPolicy struct. 3823func (esbap *ExtendedServerBlobAuditingPolicy) UnmarshalJSON(body []byte) error { 3824 var m map[string]*json.RawMessage 3825 err := json.Unmarshal(body, &m) 3826 if err != nil { 3827 return err 3828 } 3829 for k, v := range m { 3830 switch k { 3831 case "properties": 3832 if v != nil { 3833 var extendedServerBlobAuditingPolicyProperties ExtendedServerBlobAuditingPolicyProperties 3834 err = json.Unmarshal(*v, &extendedServerBlobAuditingPolicyProperties) 3835 if err != nil { 3836 return err 3837 } 3838 esbap.ExtendedServerBlobAuditingPolicyProperties = &extendedServerBlobAuditingPolicyProperties 3839 } 3840 case "id": 3841 if v != nil { 3842 var ID string 3843 err = json.Unmarshal(*v, &ID) 3844 if err != nil { 3845 return err 3846 } 3847 esbap.ID = &ID 3848 } 3849 case "name": 3850 if v != nil { 3851 var name string 3852 err = json.Unmarshal(*v, &name) 3853 if err != nil { 3854 return err 3855 } 3856 esbap.Name = &name 3857 } 3858 case "type": 3859 if v != nil { 3860 var typeVar string 3861 err = json.Unmarshal(*v, &typeVar) 3862 if err != nil { 3863 return err 3864 } 3865 esbap.Type = &typeVar 3866 } 3867 } 3868 } 3869 3870 return nil 3871} 3872 3873// ExtendedServerBlobAuditingPolicyListResult a list of server extended auditing settings. 3874type ExtendedServerBlobAuditingPolicyListResult struct { 3875 autorest.Response `json:"-"` 3876 // Value - READ-ONLY; Array of results. 3877 Value *[]ExtendedServerBlobAuditingPolicy `json:"value,omitempty"` 3878 // NextLink - READ-ONLY; Link to retrieve next page of results. 3879 NextLink *string `json:"nextLink,omitempty"` 3880} 3881 3882// MarshalJSON is the custom marshaler for ExtendedServerBlobAuditingPolicyListResult. 3883func (esbaplr ExtendedServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { 3884 objectMap := make(map[string]interface{}) 3885 return json.Marshal(objectMap) 3886} 3887 3888// ExtendedServerBlobAuditingPolicyListResultIterator provides access to a complete listing of 3889// ExtendedServerBlobAuditingPolicy values. 3890type ExtendedServerBlobAuditingPolicyListResultIterator struct { 3891 i int 3892 page ExtendedServerBlobAuditingPolicyListResultPage 3893} 3894 3895// NextWithContext advances to the next value. If there was an error making 3896// the request the iterator does not advance and the error is returned. 3897func (iter *ExtendedServerBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { 3898 if tracing.IsEnabled() { 3899 ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultIterator.NextWithContext") 3900 defer func() { 3901 sc := -1 3902 if iter.Response().Response.Response != nil { 3903 sc = iter.Response().Response.Response.StatusCode 3904 } 3905 tracing.EndSpan(ctx, sc, err) 3906 }() 3907 } 3908 iter.i++ 3909 if iter.i < len(iter.page.Values()) { 3910 return nil 3911 } 3912 err = iter.page.NextWithContext(ctx) 3913 if err != nil { 3914 iter.i-- 3915 return err 3916 } 3917 iter.i = 0 3918 return nil 3919} 3920 3921// Next advances to the next value. If there was an error making 3922// the request the iterator does not advance and the error is returned. 3923// Deprecated: Use NextWithContext() instead. 3924func (iter *ExtendedServerBlobAuditingPolicyListResultIterator) Next() error { 3925 return iter.NextWithContext(context.Background()) 3926} 3927 3928// NotDone returns true if the enumeration should be started or is not yet complete. 3929func (iter ExtendedServerBlobAuditingPolicyListResultIterator) NotDone() bool { 3930 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3931} 3932 3933// Response returns the raw server response from the last page request. 3934func (iter ExtendedServerBlobAuditingPolicyListResultIterator) Response() ExtendedServerBlobAuditingPolicyListResult { 3935 return iter.page.Response() 3936} 3937 3938// Value returns the current value or a zero-initialized value if the 3939// iterator has advanced beyond the end of the collection. 3940func (iter ExtendedServerBlobAuditingPolicyListResultIterator) Value() ExtendedServerBlobAuditingPolicy { 3941 if !iter.page.NotDone() { 3942 return ExtendedServerBlobAuditingPolicy{} 3943 } 3944 return iter.page.Values()[iter.i] 3945} 3946 3947// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultIterator type. 3948func NewExtendedServerBlobAuditingPolicyListResultIterator(page ExtendedServerBlobAuditingPolicyListResultPage) ExtendedServerBlobAuditingPolicyListResultIterator { 3949 return ExtendedServerBlobAuditingPolicyListResultIterator{page: page} 3950} 3951 3952// IsEmpty returns true if the ListResult contains no values. 3953func (esbaplr ExtendedServerBlobAuditingPolicyListResult) IsEmpty() bool { 3954 return esbaplr.Value == nil || len(*esbaplr.Value) == 0 3955} 3956 3957// hasNextLink returns true if the NextLink is not empty. 3958func (esbaplr ExtendedServerBlobAuditingPolicyListResult) hasNextLink() bool { 3959 return esbaplr.NextLink != nil && len(*esbaplr.NextLink) != 0 3960} 3961 3962// extendedServerBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. 3963// It returns nil if no more results exist. 3964func (esbaplr ExtendedServerBlobAuditingPolicyListResult) extendedServerBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { 3965 if !esbaplr.hasNextLink() { 3966 return nil, nil 3967 } 3968 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3969 autorest.AsJSON(), 3970 autorest.AsGet(), 3971 autorest.WithBaseURL(to.String(esbaplr.NextLink))) 3972} 3973 3974// ExtendedServerBlobAuditingPolicyListResultPage contains a page of ExtendedServerBlobAuditingPolicy 3975// values. 3976type ExtendedServerBlobAuditingPolicyListResultPage struct { 3977 fn func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error) 3978 esbaplr ExtendedServerBlobAuditingPolicyListResult 3979} 3980 3981// NextWithContext advances to the next page of values. If there was an error making 3982// the request the page does not advance and the error is returned. 3983func (page *ExtendedServerBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { 3984 if tracing.IsEnabled() { 3985 ctx = tracing.StartSpan(ctx, fqdn+"/ExtendedServerBlobAuditingPolicyListResultPage.NextWithContext") 3986 defer func() { 3987 sc := -1 3988 if page.Response().Response.Response != nil { 3989 sc = page.Response().Response.Response.StatusCode 3990 } 3991 tracing.EndSpan(ctx, sc, err) 3992 }() 3993 } 3994 for { 3995 next, err := page.fn(ctx, page.esbaplr) 3996 if err != nil { 3997 return err 3998 } 3999 page.esbaplr = next 4000 if !next.hasNextLink() || !next.IsEmpty() { 4001 break 4002 } 4003 } 4004 return nil 4005} 4006 4007// Next advances to the next page of values. If there was an error making 4008// the request the page does not advance and the error is returned. 4009// Deprecated: Use NextWithContext() instead. 4010func (page *ExtendedServerBlobAuditingPolicyListResultPage) Next() error { 4011 return page.NextWithContext(context.Background()) 4012} 4013 4014// NotDone returns true if the page enumeration should be started or is not yet complete. 4015func (page ExtendedServerBlobAuditingPolicyListResultPage) NotDone() bool { 4016 return !page.esbaplr.IsEmpty() 4017} 4018 4019// Response returns the raw server response from the last page request. 4020func (page ExtendedServerBlobAuditingPolicyListResultPage) Response() ExtendedServerBlobAuditingPolicyListResult { 4021 return page.esbaplr 4022} 4023 4024// Values returns the slice of values for the current page or nil if there are no values. 4025func (page ExtendedServerBlobAuditingPolicyListResultPage) Values() []ExtendedServerBlobAuditingPolicy { 4026 if page.esbaplr.IsEmpty() { 4027 return nil 4028 } 4029 return *page.esbaplr.Value 4030} 4031 4032// Creates a new instance of the ExtendedServerBlobAuditingPolicyListResultPage type. 4033func NewExtendedServerBlobAuditingPolicyListResultPage(cur ExtendedServerBlobAuditingPolicyListResult, getNextPage func(context.Context, ExtendedServerBlobAuditingPolicyListResult) (ExtendedServerBlobAuditingPolicyListResult, error)) ExtendedServerBlobAuditingPolicyListResultPage { 4034 return ExtendedServerBlobAuditingPolicyListResultPage{ 4035 fn: getNextPage, 4036 esbaplr: cur, 4037 } 4038} 4039 4040// ExtendedServerBlobAuditingPolicyProperties properties of an extended server blob auditing policy. 4041type ExtendedServerBlobAuditingPolicyProperties struct { 4042 // PredicateExpression - Specifies condition of where clause when creating an audit. 4043 PredicateExpression *string `json:"predicateExpression,omitempty"` 4044 // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' 4045 State BlobAuditingPolicyState `json:"state,omitempty"` 4046 // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. 4047 StorageEndpoint *string `json:"storageEndpoint,omitempty"` 4048 // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. 4049 // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. 4050 // Prerequisites for using managed identity authentication: 4051 // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 4052 // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. 4053 // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) 4054 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 4055 // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. 4056 RetentionDays *int32 `json:"retentionDays,omitempty"` 4057 // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. 4058 // 4059 // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: 4060 // 4061 // BATCH_COMPLETED_GROUP, 4062 // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, 4063 // FAILED_DATABASE_AUTHENTICATION_GROUP. 4064 // 4065 // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. 4066 // 4067 // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): 4068 // 4069 // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP 4070 // BACKUP_RESTORE_GROUP 4071 // DATABASE_LOGOUT_GROUP 4072 // DATABASE_OBJECT_CHANGE_GROUP 4073 // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP 4074 // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP 4075 // DATABASE_OPERATION_GROUP 4076 // DATABASE_PERMISSION_CHANGE_GROUP 4077 // DATABASE_PRINCIPAL_CHANGE_GROUP 4078 // DATABASE_PRINCIPAL_IMPERSONATION_GROUP 4079 // DATABASE_ROLE_MEMBER_CHANGE_GROUP 4080 // FAILED_DATABASE_AUTHENTICATION_GROUP 4081 // SCHEMA_OBJECT_ACCESS_GROUP 4082 // SCHEMA_OBJECT_CHANGE_GROUP 4083 // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP 4084 // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP 4085 // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP 4086 // USER_CHANGE_PASSWORD_GROUP 4087 // BATCH_STARTED_GROUP 4088 // BATCH_COMPLETED_GROUP 4089 // 4090 // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. 4091 // 4092 // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). 4093 // 4094 // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: 4095 // SELECT 4096 // UPDATE 4097 // INSERT 4098 // DELETE 4099 // EXECUTE 4100 // RECEIVE 4101 // REFERENCES 4102 // 4103 // The general form for defining an action to be audited is: 4104 // {action} ON {object} BY {principal} 4105 // 4106 // Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. 4107 // 4108 // For example: 4109 // SELECT on dbo.myTable by public 4110 // SELECT on DATABASE::myDatabase by public 4111 // SELECT on SCHEMA::mySchema by public 4112 // 4113 // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) 4114 AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` 4115 // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. 4116 StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` 4117 // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. 4118 IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` 4119 // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. 4120 // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. 4121 // 4122 // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. 4123 // Note that for server level audit you should use the 'master' database as {databaseName}. 4124 // 4125 // Diagnostic Settings URI format: 4126 // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview 4127 // 4128 // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) 4129 // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) 4130 IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` 4131 // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. 4132 // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. 4133 QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` 4134} 4135 4136// FailoverGroup a failover group. 4137type FailoverGroup struct { 4138 autorest.Response `json:"-"` 4139 // Location - READ-ONLY; Resource location. 4140 Location *string `json:"location,omitempty"` 4141 // Tags - Resource tags. 4142 Tags map[string]*string `json:"tags"` 4143 // FailoverGroupProperties - Resource properties. 4144 *FailoverGroupProperties `json:"properties,omitempty"` 4145 // ID - READ-ONLY; Resource ID. 4146 ID *string `json:"id,omitempty"` 4147 // Name - READ-ONLY; Resource name. 4148 Name *string `json:"name,omitempty"` 4149 // Type - READ-ONLY; Resource type. 4150 Type *string `json:"type,omitempty"` 4151} 4152 4153// MarshalJSON is the custom marshaler for FailoverGroup. 4154func (fg FailoverGroup) MarshalJSON() ([]byte, error) { 4155 objectMap := make(map[string]interface{}) 4156 if fg.Tags != nil { 4157 objectMap["tags"] = fg.Tags 4158 } 4159 if fg.FailoverGroupProperties != nil { 4160 objectMap["properties"] = fg.FailoverGroupProperties 4161 } 4162 return json.Marshal(objectMap) 4163} 4164 4165// UnmarshalJSON is the custom unmarshaler for FailoverGroup struct. 4166func (fg *FailoverGroup) UnmarshalJSON(body []byte) error { 4167 var m map[string]*json.RawMessage 4168 err := json.Unmarshal(body, &m) 4169 if err != nil { 4170 return err 4171 } 4172 for k, v := range m { 4173 switch k { 4174 case "location": 4175 if v != nil { 4176 var location string 4177 err = json.Unmarshal(*v, &location) 4178 if err != nil { 4179 return err 4180 } 4181 fg.Location = &location 4182 } 4183 case "tags": 4184 if v != nil { 4185 var tags map[string]*string 4186 err = json.Unmarshal(*v, &tags) 4187 if err != nil { 4188 return err 4189 } 4190 fg.Tags = tags 4191 } 4192 case "properties": 4193 if v != nil { 4194 var failoverGroupProperties FailoverGroupProperties 4195 err = json.Unmarshal(*v, &failoverGroupProperties) 4196 if err != nil { 4197 return err 4198 } 4199 fg.FailoverGroupProperties = &failoverGroupProperties 4200 } 4201 case "id": 4202 if v != nil { 4203 var ID string 4204 err = json.Unmarshal(*v, &ID) 4205 if err != nil { 4206 return err 4207 } 4208 fg.ID = &ID 4209 } 4210 case "name": 4211 if v != nil { 4212 var name string 4213 err = json.Unmarshal(*v, &name) 4214 if err != nil { 4215 return err 4216 } 4217 fg.Name = &name 4218 } 4219 case "type": 4220 if v != nil { 4221 var typeVar string 4222 err = json.Unmarshal(*v, &typeVar) 4223 if err != nil { 4224 return err 4225 } 4226 fg.Type = &typeVar 4227 } 4228 } 4229 } 4230 4231 return nil 4232} 4233 4234// FailoverGroupListResult a list of failover groups. 4235type FailoverGroupListResult struct { 4236 autorest.Response `json:"-"` 4237 // Value - READ-ONLY; Array of results. 4238 Value *[]FailoverGroup `json:"value,omitempty"` 4239 // NextLink - READ-ONLY; Link to retrieve next page of results. 4240 NextLink *string `json:"nextLink,omitempty"` 4241} 4242 4243// MarshalJSON is the custom marshaler for FailoverGroupListResult. 4244func (fglr FailoverGroupListResult) MarshalJSON() ([]byte, error) { 4245 objectMap := make(map[string]interface{}) 4246 return json.Marshal(objectMap) 4247} 4248 4249// FailoverGroupListResultIterator provides access to a complete listing of FailoverGroup values. 4250type FailoverGroupListResultIterator struct { 4251 i int 4252 page FailoverGroupListResultPage 4253} 4254 4255// NextWithContext advances to the next value. If there was an error making 4256// the request the iterator does not advance and the error is returned. 4257func (iter *FailoverGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { 4258 if tracing.IsEnabled() { 4259 ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupListResultIterator.NextWithContext") 4260 defer func() { 4261 sc := -1 4262 if iter.Response().Response.Response != nil { 4263 sc = iter.Response().Response.Response.StatusCode 4264 } 4265 tracing.EndSpan(ctx, sc, err) 4266 }() 4267 } 4268 iter.i++ 4269 if iter.i < len(iter.page.Values()) { 4270 return nil 4271 } 4272 err = iter.page.NextWithContext(ctx) 4273 if err != nil { 4274 iter.i-- 4275 return err 4276 } 4277 iter.i = 0 4278 return nil 4279} 4280 4281// Next advances to the next value. If there was an error making 4282// the request the iterator does not advance and the error is returned. 4283// Deprecated: Use NextWithContext() instead. 4284func (iter *FailoverGroupListResultIterator) Next() error { 4285 return iter.NextWithContext(context.Background()) 4286} 4287 4288// NotDone returns true if the enumeration should be started or is not yet complete. 4289func (iter FailoverGroupListResultIterator) NotDone() bool { 4290 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4291} 4292 4293// Response returns the raw server response from the last page request. 4294func (iter FailoverGroupListResultIterator) Response() FailoverGroupListResult { 4295 return iter.page.Response() 4296} 4297 4298// Value returns the current value or a zero-initialized value if the 4299// iterator has advanced beyond the end of the collection. 4300func (iter FailoverGroupListResultIterator) Value() FailoverGroup { 4301 if !iter.page.NotDone() { 4302 return FailoverGroup{} 4303 } 4304 return iter.page.Values()[iter.i] 4305} 4306 4307// Creates a new instance of the FailoverGroupListResultIterator type. 4308func NewFailoverGroupListResultIterator(page FailoverGroupListResultPage) FailoverGroupListResultIterator { 4309 return FailoverGroupListResultIterator{page: page} 4310} 4311 4312// IsEmpty returns true if the ListResult contains no values. 4313func (fglr FailoverGroupListResult) IsEmpty() bool { 4314 return fglr.Value == nil || len(*fglr.Value) == 0 4315} 4316 4317// hasNextLink returns true if the NextLink is not empty. 4318func (fglr FailoverGroupListResult) hasNextLink() bool { 4319 return fglr.NextLink != nil && len(*fglr.NextLink) != 0 4320} 4321 4322// failoverGroupListResultPreparer prepares a request to retrieve the next set of results. 4323// It returns nil if no more results exist. 4324func (fglr FailoverGroupListResult) failoverGroupListResultPreparer(ctx context.Context) (*http.Request, error) { 4325 if !fglr.hasNextLink() { 4326 return nil, nil 4327 } 4328 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4329 autorest.AsJSON(), 4330 autorest.AsGet(), 4331 autorest.WithBaseURL(to.String(fglr.NextLink))) 4332} 4333 4334// FailoverGroupListResultPage contains a page of FailoverGroup values. 4335type FailoverGroupListResultPage struct { 4336 fn func(context.Context, FailoverGroupListResult) (FailoverGroupListResult, error) 4337 fglr FailoverGroupListResult 4338} 4339 4340// NextWithContext advances to the next page of values. If there was an error making 4341// the request the page does not advance and the error is returned. 4342func (page *FailoverGroupListResultPage) NextWithContext(ctx context.Context) (err error) { 4343 if tracing.IsEnabled() { 4344 ctx = tracing.StartSpan(ctx, fqdn+"/FailoverGroupListResultPage.NextWithContext") 4345 defer func() { 4346 sc := -1 4347 if page.Response().Response.Response != nil { 4348 sc = page.Response().Response.Response.StatusCode 4349 } 4350 tracing.EndSpan(ctx, sc, err) 4351 }() 4352 } 4353 for { 4354 next, err := page.fn(ctx, page.fglr) 4355 if err != nil { 4356 return err 4357 } 4358 page.fglr = next 4359 if !next.hasNextLink() || !next.IsEmpty() { 4360 break 4361 } 4362 } 4363 return nil 4364} 4365 4366// Next advances to the next page of values. If there was an error making 4367// the request the page does not advance and the error is returned. 4368// Deprecated: Use NextWithContext() instead. 4369func (page *FailoverGroupListResultPage) Next() error { 4370 return page.NextWithContext(context.Background()) 4371} 4372 4373// NotDone returns true if the page enumeration should be started or is not yet complete. 4374func (page FailoverGroupListResultPage) NotDone() bool { 4375 return !page.fglr.IsEmpty() 4376} 4377 4378// Response returns the raw server response from the last page request. 4379func (page FailoverGroupListResultPage) Response() FailoverGroupListResult { 4380 return page.fglr 4381} 4382 4383// Values returns the slice of values for the current page or nil if there are no values. 4384func (page FailoverGroupListResultPage) Values() []FailoverGroup { 4385 if page.fglr.IsEmpty() { 4386 return nil 4387 } 4388 return *page.fglr.Value 4389} 4390 4391// Creates a new instance of the FailoverGroupListResultPage type. 4392func NewFailoverGroupListResultPage(cur FailoverGroupListResult, getNextPage func(context.Context, FailoverGroupListResult) (FailoverGroupListResult, error)) FailoverGroupListResultPage { 4393 return FailoverGroupListResultPage{ 4394 fn: getNextPage, 4395 fglr: cur, 4396 } 4397} 4398 4399// FailoverGroupProperties properties of a failover group. 4400type FailoverGroupProperties struct { 4401 // ReadWriteEndpoint - Read-write endpoint of the failover group instance. 4402 ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` 4403 // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. 4404 ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` 4405 // ReplicationRole - READ-ONLY; Local replication role of the failover group instance. Possible values include: 'Primary', 'Secondary' 4406 ReplicationRole FailoverGroupReplicationRole `json:"replicationRole,omitempty"` 4407 // ReplicationState - READ-ONLY; Replication state of the failover group instance. 4408 ReplicationState *string `json:"replicationState,omitempty"` 4409 // PartnerServers - List of partner server information for the failover group. 4410 PartnerServers *[]PartnerInfo `json:"partnerServers,omitempty"` 4411 // Databases - List of databases in the failover group. 4412 Databases *[]string `json:"databases,omitempty"` 4413} 4414 4415// MarshalJSON is the custom marshaler for FailoverGroupProperties. 4416func (fgp FailoverGroupProperties) MarshalJSON() ([]byte, error) { 4417 objectMap := make(map[string]interface{}) 4418 if fgp.ReadWriteEndpoint != nil { 4419 objectMap["readWriteEndpoint"] = fgp.ReadWriteEndpoint 4420 } 4421 if fgp.ReadOnlyEndpoint != nil { 4422 objectMap["readOnlyEndpoint"] = fgp.ReadOnlyEndpoint 4423 } 4424 if fgp.PartnerServers != nil { 4425 objectMap["partnerServers"] = fgp.PartnerServers 4426 } 4427 if fgp.Databases != nil { 4428 objectMap["databases"] = fgp.Databases 4429 } 4430 return json.Marshal(objectMap) 4431} 4432 4433// FailoverGroupReadOnlyEndpoint read-only endpoint of the failover group instance. 4434type FailoverGroupReadOnlyEndpoint struct { 4435 // FailoverPolicy - Failover policy of the read-only endpoint for the failover group. Possible values include: 'ReadOnlyEndpointFailoverPolicyDisabled', 'ReadOnlyEndpointFailoverPolicyEnabled' 4436 FailoverPolicy ReadOnlyEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` 4437} 4438 4439// FailoverGroupReadWriteEndpoint read-write endpoint of the failover group instance. 4440type FailoverGroupReadWriteEndpoint struct { 4441 // FailoverPolicy - Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible values include: 'Manual', 'Automatic' 4442 FailoverPolicy ReadWriteEndpointFailoverPolicy `json:"failoverPolicy,omitempty"` 4443 // FailoverWithDataLossGracePeriodMinutes - Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. 4444 FailoverWithDataLossGracePeriodMinutes *int32 `json:"failoverWithDataLossGracePeriodMinutes,omitempty"` 4445} 4446 4447// FailoverGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 4448// long-running operation. 4449type FailoverGroupsCreateOrUpdateFuture struct { 4450 azure.FutureAPI 4451 // Result returns the result of the asynchronous operation. 4452 // If the operation has not completed it will return an error. 4453 Result func(FailoverGroupsClient) (FailoverGroup, error) 4454} 4455 4456// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4457func (future *FailoverGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 4458 var azFuture azure.Future 4459 if err := json.Unmarshal(body, &azFuture); err != nil { 4460 return err 4461 } 4462 future.FutureAPI = &azFuture 4463 future.Result = future.result 4464 return nil 4465} 4466 4467// result is the default implementation for FailoverGroupsCreateOrUpdateFuture.Result. 4468func (future *FailoverGroupsCreateOrUpdateFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { 4469 var done bool 4470 done, err = future.DoneWithContext(context.Background(), client) 4471 if err != nil { 4472 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 4473 return 4474 } 4475 if !done { 4476 fg.Response.Response = future.Response() 4477 err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsCreateOrUpdateFuture") 4478 return 4479 } 4480 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4481 if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { 4482 fg, err = client.CreateOrUpdateResponder(fg.Response.Response) 4483 if err != nil { 4484 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsCreateOrUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") 4485 } 4486 } 4487 return 4488} 4489 4490// FailoverGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 4491// operation. 4492type FailoverGroupsDeleteFuture struct { 4493 azure.FutureAPI 4494 // Result returns the result of the asynchronous operation. 4495 // If the operation has not completed it will return an error. 4496 Result func(FailoverGroupsClient) (autorest.Response, error) 4497} 4498 4499// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4500func (future *FailoverGroupsDeleteFuture) UnmarshalJSON(body []byte) error { 4501 var azFuture azure.Future 4502 if err := json.Unmarshal(body, &azFuture); err != nil { 4503 return err 4504 } 4505 future.FutureAPI = &azFuture 4506 future.Result = future.result 4507 return nil 4508} 4509 4510// result is the default implementation for FailoverGroupsDeleteFuture.Result. 4511func (future *FailoverGroupsDeleteFuture) result(client FailoverGroupsClient) (ar autorest.Response, err error) { 4512 var done bool 4513 done, err = future.DoneWithContext(context.Background(), client) 4514 if err != nil { 4515 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsDeleteFuture", "Result", future.Response(), "Polling failure") 4516 return 4517 } 4518 if !done { 4519 ar.Response = future.Response() 4520 err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsDeleteFuture") 4521 return 4522 } 4523 ar.Response = future.Response() 4524 return 4525} 4526 4527// FailoverGroupsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running 4528// operation. 4529type FailoverGroupsFailoverFuture struct { 4530 azure.FutureAPI 4531 // Result returns the result of the asynchronous operation. 4532 // If the operation has not completed it will return an error. 4533 Result func(FailoverGroupsClient) (FailoverGroup, error) 4534} 4535 4536// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4537func (future *FailoverGroupsFailoverFuture) UnmarshalJSON(body []byte) error { 4538 var azFuture azure.Future 4539 if err := json.Unmarshal(body, &azFuture); err != nil { 4540 return err 4541 } 4542 future.FutureAPI = &azFuture 4543 future.Result = future.result 4544 return nil 4545} 4546 4547// result is the default implementation for FailoverGroupsFailoverFuture.Result. 4548func (future *FailoverGroupsFailoverFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { 4549 var done bool 4550 done, err = future.DoneWithContext(context.Background(), client) 4551 if err != nil { 4552 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", future.Response(), "Polling failure") 4553 return 4554 } 4555 if !done { 4556 fg.Response.Response = future.Response() 4557 err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsFailoverFuture") 4558 return 4559 } 4560 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4561 if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { 4562 fg, err = client.FailoverResponder(fg.Response.Response) 4563 if err != nil { 4564 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsFailoverFuture", "Result", fg.Response.Response, "Failure responding to request") 4565 } 4566 } 4567 return 4568} 4569 4570// FailoverGroupsForceFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results 4571// of a long-running operation. 4572type FailoverGroupsForceFailoverAllowDataLossFuture struct { 4573 azure.FutureAPI 4574 // Result returns the result of the asynchronous operation. 4575 // If the operation has not completed it will return an error. 4576 Result func(FailoverGroupsClient) (FailoverGroup, error) 4577} 4578 4579// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4580func (future *FailoverGroupsForceFailoverAllowDataLossFuture) UnmarshalJSON(body []byte) error { 4581 var azFuture azure.Future 4582 if err := json.Unmarshal(body, &azFuture); err != nil { 4583 return err 4584 } 4585 future.FutureAPI = &azFuture 4586 future.Result = future.result 4587 return nil 4588} 4589 4590// result is the default implementation for FailoverGroupsForceFailoverAllowDataLossFuture.Result. 4591func (future *FailoverGroupsForceFailoverAllowDataLossFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { 4592 var done bool 4593 done, err = future.DoneWithContext(context.Background(), client) 4594 if err != nil { 4595 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") 4596 return 4597 } 4598 if !done { 4599 fg.Response.Response = future.Response() 4600 err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsForceFailoverAllowDataLossFuture") 4601 return 4602 } 4603 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4604 if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { 4605 fg, err = client.ForceFailoverAllowDataLossResponder(fg.Response.Response) 4606 if err != nil { 4607 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsForceFailoverAllowDataLossFuture", "Result", fg.Response.Response, "Failure responding to request") 4608 } 4609 } 4610 return 4611} 4612 4613// FailoverGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 4614// operation. 4615type FailoverGroupsUpdateFuture struct { 4616 azure.FutureAPI 4617 // Result returns the result of the asynchronous operation. 4618 // If the operation has not completed it will return an error. 4619 Result func(FailoverGroupsClient) (FailoverGroup, error) 4620} 4621 4622// UnmarshalJSON is the custom unmarshaller for CreateFuture. 4623func (future *FailoverGroupsUpdateFuture) UnmarshalJSON(body []byte) error { 4624 var azFuture azure.Future 4625 if err := json.Unmarshal(body, &azFuture); err != nil { 4626 return err 4627 } 4628 future.FutureAPI = &azFuture 4629 future.Result = future.result 4630 return nil 4631} 4632 4633// result is the default implementation for FailoverGroupsUpdateFuture.Result. 4634func (future *FailoverGroupsUpdateFuture) result(client FailoverGroupsClient) (fg FailoverGroup, err error) { 4635 var done bool 4636 done, err = future.DoneWithContext(context.Background(), client) 4637 if err != nil { 4638 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", future.Response(), "Polling failure") 4639 return 4640 } 4641 if !done { 4642 fg.Response.Response = future.Response() 4643 err = azure.NewAsyncOpIncompleteError("sql.FailoverGroupsUpdateFuture") 4644 return 4645 } 4646 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 4647 if fg.Response.Response, err = future.GetResult(sender); err == nil && fg.Response.Response.StatusCode != http.StatusNoContent { 4648 fg, err = client.UpdateResponder(fg.Response.Response) 4649 if err != nil { 4650 err = autorest.NewErrorWithError(err, "sql.FailoverGroupsUpdateFuture", "Result", fg.Response.Response, "Failure responding to request") 4651 } 4652 } 4653 return 4654} 4655 4656// FailoverGroupUpdate a failover group update request. 4657type FailoverGroupUpdate struct { 4658 // FailoverGroupUpdateProperties - Resource properties. 4659 *FailoverGroupUpdateProperties `json:"properties,omitempty"` 4660 // Tags - Resource tags. 4661 Tags map[string]*string `json:"tags"` 4662} 4663 4664// MarshalJSON is the custom marshaler for FailoverGroupUpdate. 4665func (fgu FailoverGroupUpdate) MarshalJSON() ([]byte, error) { 4666 objectMap := make(map[string]interface{}) 4667 if fgu.FailoverGroupUpdateProperties != nil { 4668 objectMap["properties"] = fgu.FailoverGroupUpdateProperties 4669 } 4670 if fgu.Tags != nil { 4671 objectMap["tags"] = fgu.Tags 4672 } 4673 return json.Marshal(objectMap) 4674} 4675 4676// UnmarshalJSON is the custom unmarshaler for FailoverGroupUpdate struct. 4677func (fgu *FailoverGroupUpdate) UnmarshalJSON(body []byte) error { 4678 var m map[string]*json.RawMessage 4679 err := json.Unmarshal(body, &m) 4680 if err != nil { 4681 return err 4682 } 4683 for k, v := range m { 4684 switch k { 4685 case "properties": 4686 if v != nil { 4687 var failoverGroupUpdateProperties FailoverGroupUpdateProperties 4688 err = json.Unmarshal(*v, &failoverGroupUpdateProperties) 4689 if err != nil { 4690 return err 4691 } 4692 fgu.FailoverGroupUpdateProperties = &failoverGroupUpdateProperties 4693 } 4694 case "tags": 4695 if v != nil { 4696 var tags map[string]*string 4697 err = json.Unmarshal(*v, &tags) 4698 if err != nil { 4699 return err 4700 } 4701 fgu.Tags = tags 4702 } 4703 } 4704 } 4705 4706 return nil 4707} 4708 4709// FailoverGroupUpdateProperties properties of a failover group update. 4710type FailoverGroupUpdateProperties struct { 4711 // ReadWriteEndpoint - Read-write endpoint of the failover group instance. 4712 ReadWriteEndpoint *FailoverGroupReadWriteEndpoint `json:"readWriteEndpoint,omitempty"` 4713 // ReadOnlyEndpoint - Read-only endpoint of the failover group instance. 4714 ReadOnlyEndpoint *FailoverGroupReadOnlyEndpoint `json:"readOnlyEndpoint,omitempty"` 4715 // Databases - List of databases in the failover group. 4716 Databases *[]string `json:"databases,omitempty"` 4717} 4718 4719// FirewallRule represents a server firewall rule. 4720type FirewallRule struct { 4721 autorest.Response `json:"-"` 4722 // Kind - READ-ONLY; Kind of server that contains this firewall rule. 4723 Kind *string `json:"kind,omitempty"` 4724 // Location - READ-ONLY; Location of the server that contains this firewall rule. 4725 Location *string `json:"location,omitempty"` 4726 // FirewallRuleProperties - The properties representing the resource. 4727 *FirewallRuleProperties `json:"properties,omitempty"` 4728 // ID - READ-ONLY; Resource ID. 4729 ID *string `json:"id,omitempty"` 4730 // Name - READ-ONLY; Resource name. 4731 Name *string `json:"name,omitempty"` 4732 // Type - READ-ONLY; Resource type. 4733 Type *string `json:"type,omitempty"` 4734} 4735 4736// MarshalJSON is the custom marshaler for FirewallRule. 4737func (fr FirewallRule) MarshalJSON() ([]byte, error) { 4738 objectMap := make(map[string]interface{}) 4739 if fr.FirewallRuleProperties != nil { 4740 objectMap["properties"] = fr.FirewallRuleProperties 4741 } 4742 return json.Marshal(objectMap) 4743} 4744 4745// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. 4746func (fr *FirewallRule) UnmarshalJSON(body []byte) error { 4747 var m map[string]*json.RawMessage 4748 err := json.Unmarshal(body, &m) 4749 if err != nil { 4750 return err 4751 } 4752 for k, v := range m { 4753 switch k { 4754 case "kind": 4755 if v != nil { 4756 var kind string 4757 err = json.Unmarshal(*v, &kind) 4758 if err != nil { 4759 return err 4760 } 4761 fr.Kind = &kind 4762 } 4763 case "location": 4764 if v != nil { 4765 var location string 4766 err = json.Unmarshal(*v, &location) 4767 if err != nil { 4768 return err 4769 } 4770 fr.Location = &location 4771 } 4772 case "properties": 4773 if v != nil { 4774 var firewallRuleProperties FirewallRuleProperties 4775 err = json.Unmarshal(*v, &firewallRuleProperties) 4776 if err != nil { 4777 return err 4778 } 4779 fr.FirewallRuleProperties = &firewallRuleProperties 4780 } 4781 case "id": 4782 if v != nil { 4783 var ID string 4784 err = json.Unmarshal(*v, &ID) 4785 if err != nil { 4786 return err 4787 } 4788 fr.ID = &ID 4789 } 4790 case "name": 4791 if v != nil { 4792 var name string 4793 err = json.Unmarshal(*v, &name) 4794 if err != nil { 4795 return err 4796 } 4797 fr.Name = &name 4798 } 4799 case "type": 4800 if v != nil { 4801 var typeVar string 4802 err = json.Unmarshal(*v, &typeVar) 4803 if err != nil { 4804 return err 4805 } 4806 fr.Type = &typeVar 4807 } 4808 } 4809 } 4810 4811 return nil 4812} 4813 4814// FirewallRuleListResult represents the response to a List Firewall Rules request. 4815type FirewallRuleListResult struct { 4816 autorest.Response `json:"-"` 4817 // Value - The list of server firewall rules. 4818 Value *[]FirewallRule `json:"value,omitempty"` 4819} 4820 4821// FirewallRuleProperties represents the properties of a server firewall rule. 4822type FirewallRuleProperties struct { 4823 // StartIPAddress - The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all Azure-internal IP addresses. 4824 StartIPAddress *string `json:"startIpAddress,omitempty"` 4825 // EndIPAddress - The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' to represent all Azure-internal IP addresses. 4826 EndIPAddress *string `json:"endIpAddress,omitempty"` 4827} 4828 4829// GeoBackupPolicy a database geo backup policy. 4830type GeoBackupPolicy struct { 4831 autorest.Response `json:"-"` 4832 // GeoBackupPolicyProperties - The properties of the geo backup policy. 4833 *GeoBackupPolicyProperties `json:"properties,omitempty"` 4834 // Kind - READ-ONLY; Kind of geo backup policy. This is metadata used for the Azure portal experience. 4835 Kind *string `json:"kind,omitempty"` 4836 // Location - READ-ONLY; Backup policy location. 4837 Location *string `json:"location,omitempty"` 4838 // ID - READ-ONLY; Resource ID. 4839 ID *string `json:"id,omitempty"` 4840 // Name - READ-ONLY; Resource name. 4841 Name *string `json:"name,omitempty"` 4842 // Type - READ-ONLY; Resource type. 4843 Type *string `json:"type,omitempty"` 4844} 4845 4846// MarshalJSON is the custom marshaler for GeoBackupPolicy. 4847func (gbp GeoBackupPolicy) MarshalJSON() ([]byte, error) { 4848 objectMap := make(map[string]interface{}) 4849 if gbp.GeoBackupPolicyProperties != nil { 4850 objectMap["properties"] = gbp.GeoBackupPolicyProperties 4851 } 4852 return json.Marshal(objectMap) 4853} 4854 4855// UnmarshalJSON is the custom unmarshaler for GeoBackupPolicy struct. 4856func (gbp *GeoBackupPolicy) UnmarshalJSON(body []byte) error { 4857 var m map[string]*json.RawMessage 4858 err := json.Unmarshal(body, &m) 4859 if err != nil { 4860 return err 4861 } 4862 for k, v := range m { 4863 switch k { 4864 case "properties": 4865 if v != nil { 4866 var geoBackupPolicyProperties GeoBackupPolicyProperties 4867 err = json.Unmarshal(*v, &geoBackupPolicyProperties) 4868 if err != nil { 4869 return err 4870 } 4871 gbp.GeoBackupPolicyProperties = &geoBackupPolicyProperties 4872 } 4873 case "kind": 4874 if v != nil { 4875 var kind string 4876 err = json.Unmarshal(*v, &kind) 4877 if err != nil { 4878 return err 4879 } 4880 gbp.Kind = &kind 4881 } 4882 case "location": 4883 if v != nil { 4884 var location string 4885 err = json.Unmarshal(*v, &location) 4886 if err != nil { 4887 return err 4888 } 4889 gbp.Location = &location 4890 } 4891 case "id": 4892 if v != nil { 4893 var ID string 4894 err = json.Unmarshal(*v, &ID) 4895 if err != nil { 4896 return err 4897 } 4898 gbp.ID = &ID 4899 } 4900 case "name": 4901 if v != nil { 4902 var name string 4903 err = json.Unmarshal(*v, &name) 4904 if err != nil { 4905 return err 4906 } 4907 gbp.Name = &name 4908 } 4909 case "type": 4910 if v != nil { 4911 var typeVar string 4912 err = json.Unmarshal(*v, &typeVar) 4913 if err != nil { 4914 return err 4915 } 4916 gbp.Type = &typeVar 4917 } 4918 } 4919 } 4920 4921 return nil 4922} 4923 4924// GeoBackupPolicyListResult the response to a list geo backup policies request. 4925type GeoBackupPolicyListResult struct { 4926 autorest.Response `json:"-"` 4927 // Value - The list of geo backup policies. 4928 Value *[]GeoBackupPolicy `json:"value,omitempty"` 4929} 4930 4931// GeoBackupPolicyProperties the properties of the geo backup policy. 4932type GeoBackupPolicyProperties struct { 4933 // State - The state of the geo backup policy. Possible values include: 'GeoBackupPolicyStateDisabled', 'GeoBackupPolicyStateEnabled' 4934 State GeoBackupPolicyState `json:"state,omitempty"` 4935 // StorageType - READ-ONLY; The storage type of the geo backup policy. 4936 StorageType *string `json:"storageType,omitempty"` 4937} 4938 4939// MarshalJSON is the custom marshaler for GeoBackupPolicyProperties. 4940func (gbpp GeoBackupPolicyProperties) MarshalJSON() ([]byte, error) { 4941 objectMap := make(map[string]interface{}) 4942 if gbpp.State != "" { 4943 objectMap["state"] = gbpp.State 4944 } 4945 return json.Marshal(objectMap) 4946} 4947 4948// ImportExportResponse response for Import/Export Get operation. 4949type ImportExportResponse struct { 4950 autorest.Response `json:"-"` 4951 // ImportExportResponseProperties - The import/export operation properties. 4952 *ImportExportResponseProperties `json:"properties,omitempty"` 4953 // ID - READ-ONLY; Resource ID. 4954 ID *string `json:"id,omitempty"` 4955 // Name - READ-ONLY; Resource name. 4956 Name *string `json:"name,omitempty"` 4957 // Type - READ-ONLY; Resource type. 4958 Type *string `json:"type,omitempty"` 4959} 4960 4961// MarshalJSON is the custom marshaler for ImportExportResponse. 4962func (ier ImportExportResponse) MarshalJSON() ([]byte, error) { 4963 objectMap := make(map[string]interface{}) 4964 if ier.ImportExportResponseProperties != nil { 4965 objectMap["properties"] = ier.ImportExportResponseProperties 4966 } 4967 return json.Marshal(objectMap) 4968} 4969 4970// UnmarshalJSON is the custom unmarshaler for ImportExportResponse struct. 4971func (ier *ImportExportResponse) UnmarshalJSON(body []byte) error { 4972 var m map[string]*json.RawMessage 4973 err := json.Unmarshal(body, &m) 4974 if err != nil { 4975 return err 4976 } 4977 for k, v := range m { 4978 switch k { 4979 case "properties": 4980 if v != nil { 4981 var importExportResponseProperties ImportExportResponseProperties 4982 err = json.Unmarshal(*v, &importExportResponseProperties) 4983 if err != nil { 4984 return err 4985 } 4986 ier.ImportExportResponseProperties = &importExportResponseProperties 4987 } 4988 case "id": 4989 if v != nil { 4990 var ID string 4991 err = json.Unmarshal(*v, &ID) 4992 if err != nil { 4993 return err 4994 } 4995 ier.ID = &ID 4996 } 4997 case "name": 4998 if v != nil { 4999 var name string 5000 err = json.Unmarshal(*v, &name) 5001 if err != nil { 5002 return err 5003 } 5004 ier.Name = &name 5005 } 5006 case "type": 5007 if v != nil { 5008 var typeVar string 5009 err = json.Unmarshal(*v, &typeVar) 5010 if err != nil { 5011 return err 5012 } 5013 ier.Type = &typeVar 5014 } 5015 } 5016 } 5017 5018 return nil 5019} 5020 5021// ImportExportResponseProperties response for Import/Export Status operation. 5022type ImportExportResponseProperties struct { 5023 // RequestType - READ-ONLY; The request type of the operation. 5024 RequestType *string `json:"requestType,omitempty"` 5025 // RequestID - READ-ONLY; The request type of the operation. 5026 RequestID *uuid.UUID `json:"requestId,omitempty"` 5027 // ServerName - READ-ONLY; The name of the server. 5028 ServerName *string `json:"serverName,omitempty"` 5029 // DatabaseName - READ-ONLY; The name of the database. 5030 DatabaseName *string `json:"databaseName,omitempty"` 5031 // Status - READ-ONLY; The status message returned from the server. 5032 Status *string `json:"status,omitempty"` 5033 // LastModifiedTime - READ-ONLY; The operation status last modified time. 5034 LastModifiedTime *string `json:"lastModifiedTime,omitempty"` 5035 // QueuedTime - READ-ONLY; The operation queued time. 5036 QueuedTime *string `json:"queuedTime,omitempty"` 5037 // BlobURI - READ-ONLY; The blob uri. 5038 BlobURI *string `json:"blobUri,omitempty"` 5039 // ErrorMessage - READ-ONLY; The error message returned from the server. 5040 ErrorMessage *string `json:"errorMessage,omitempty"` 5041} 5042 5043// MarshalJSON is the custom marshaler for ImportExportResponseProperties. 5044func (ierp ImportExportResponseProperties) MarshalJSON() ([]byte, error) { 5045 objectMap := make(map[string]interface{}) 5046 return json.Marshal(objectMap) 5047} 5048 5049// ImportExtensionProperties represents the properties for an import operation 5050type ImportExtensionProperties struct { 5051 // OperationMode - The type of import operation being performed. This is always Import. 5052 OperationMode *string `json:"operationMode,omitempty"` 5053 // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' 5054 StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` 5055 // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." 5056 StorageKey *string `json:"storageKey,omitempty"` 5057 // StorageURI - The storage uri to use. 5058 StorageURI *string `json:"storageUri,omitempty"` 5059 // AdministratorLogin - The name of the SQL administrator. 5060 AdministratorLogin *string `json:"administratorLogin,omitempty"` 5061 // AdministratorLoginPassword - The password of the SQL administrator. 5062 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` 5063 // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' 5064 AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` 5065} 5066 5067// ImportExtensionRequest import database parameters. 5068type ImportExtensionRequest struct { 5069 // Name - The name of the extension. 5070 Name *string `json:"name,omitempty"` 5071 // Type - The type of the extension. 5072 Type *string `json:"type,omitempty"` 5073 // ImportExtensionProperties - Represents the properties of the resource. 5074 *ImportExtensionProperties `json:"properties,omitempty"` 5075} 5076 5077// MarshalJSON is the custom marshaler for ImportExtensionRequest. 5078func (ier ImportExtensionRequest) MarshalJSON() ([]byte, error) { 5079 objectMap := make(map[string]interface{}) 5080 if ier.Name != nil { 5081 objectMap["name"] = ier.Name 5082 } 5083 if ier.Type != nil { 5084 objectMap["type"] = ier.Type 5085 } 5086 if ier.ImportExtensionProperties != nil { 5087 objectMap["properties"] = ier.ImportExtensionProperties 5088 } 5089 return json.Marshal(objectMap) 5090} 5091 5092// UnmarshalJSON is the custom unmarshaler for ImportExtensionRequest struct. 5093func (ier *ImportExtensionRequest) UnmarshalJSON(body []byte) error { 5094 var m map[string]*json.RawMessage 5095 err := json.Unmarshal(body, &m) 5096 if err != nil { 5097 return err 5098 } 5099 for k, v := range m { 5100 switch k { 5101 case "name": 5102 if v != nil { 5103 var name string 5104 err = json.Unmarshal(*v, &name) 5105 if err != nil { 5106 return err 5107 } 5108 ier.Name = &name 5109 } 5110 case "type": 5111 if v != nil { 5112 var typeVar string 5113 err = json.Unmarshal(*v, &typeVar) 5114 if err != nil { 5115 return err 5116 } 5117 ier.Type = &typeVar 5118 } 5119 case "properties": 5120 if v != nil { 5121 var importExtensionProperties ImportExtensionProperties 5122 err = json.Unmarshal(*v, &importExtensionProperties) 5123 if err != nil { 5124 return err 5125 } 5126 ier.ImportExtensionProperties = &importExtensionProperties 5127 } 5128 } 5129 } 5130 5131 return nil 5132} 5133 5134// ImportRequest import database parameters. 5135type ImportRequest struct { 5136 // DatabaseName - The name of the database to import. 5137 DatabaseName *string `json:"databaseName,omitempty"` 5138 // Edition - The edition for the database being created. 5139 // 5140 // The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands: 5141 // 5142 // ```azurecli 5143 // az sql db list-editions -l <location> -o table 5144 // ```` 5145 // 5146 // ```powershell 5147 // Get-AzSqlServerServiceObjective -Location <location> 5148 // ```` 5149 // . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' 5150 Edition DatabaseEdition `json:"edition,omitempty"` 5151 // ServiceObjectiveName - The name of the service objective to assign to the database. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' 5152 ServiceObjectiveName ServiceObjectiveName `json:"serviceObjectiveName,omitempty"` 5153 // MaxSizeBytes - The maximum size for the newly imported database. 5154 MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` 5155 // StorageKeyType - The type of the storage key to use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' 5156 StorageKeyType StorageKeyType `json:"storageKeyType,omitempty"` 5157 // StorageKey - The storage key to use. If storage key type is SharedAccessKey, it must be preceded with a "?." 5158 StorageKey *string `json:"storageKey,omitempty"` 5159 // StorageURI - The storage uri to use. 5160 StorageURI *string `json:"storageUri,omitempty"` 5161 // AdministratorLogin - The name of the SQL administrator. 5162 AdministratorLogin *string `json:"administratorLogin,omitempty"` 5163 // AdministratorLoginPassword - The password of the SQL administrator. 5164 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` 5165 // AuthenticationType - The authentication type. Possible values include: 'SQL', 'ADPassword' 5166 AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` 5167} 5168 5169// Job a job. 5170type Job struct { 5171 autorest.Response `json:"-"` 5172 // JobProperties - Resource properties. 5173 *JobProperties `json:"properties,omitempty"` 5174 // ID - READ-ONLY; Resource ID. 5175 ID *string `json:"id,omitempty"` 5176 // Name - READ-ONLY; Resource name. 5177 Name *string `json:"name,omitempty"` 5178 // Type - READ-ONLY; Resource type. 5179 Type *string `json:"type,omitempty"` 5180} 5181 5182// MarshalJSON is the custom marshaler for Job. 5183func (j Job) MarshalJSON() ([]byte, error) { 5184 objectMap := make(map[string]interface{}) 5185 if j.JobProperties != nil { 5186 objectMap["properties"] = j.JobProperties 5187 } 5188 return json.Marshal(objectMap) 5189} 5190 5191// UnmarshalJSON is the custom unmarshaler for Job struct. 5192func (j *Job) UnmarshalJSON(body []byte) error { 5193 var m map[string]*json.RawMessage 5194 err := json.Unmarshal(body, &m) 5195 if err != nil { 5196 return err 5197 } 5198 for k, v := range m { 5199 switch k { 5200 case "properties": 5201 if v != nil { 5202 var jobProperties JobProperties 5203 err = json.Unmarshal(*v, &jobProperties) 5204 if err != nil { 5205 return err 5206 } 5207 j.JobProperties = &jobProperties 5208 } 5209 case "id": 5210 if v != nil { 5211 var ID string 5212 err = json.Unmarshal(*v, &ID) 5213 if err != nil { 5214 return err 5215 } 5216 j.ID = &ID 5217 } 5218 case "name": 5219 if v != nil { 5220 var name string 5221 err = json.Unmarshal(*v, &name) 5222 if err != nil { 5223 return err 5224 } 5225 j.Name = &name 5226 } 5227 case "type": 5228 if v != nil { 5229 var typeVar string 5230 err = json.Unmarshal(*v, &typeVar) 5231 if err != nil { 5232 return err 5233 } 5234 j.Type = &typeVar 5235 } 5236 } 5237 } 5238 5239 return nil 5240} 5241 5242// JobAgent an Azure SQL job agent. 5243type JobAgent struct { 5244 autorest.Response `json:"-"` 5245 // Sku - The name and tier of the SKU. 5246 Sku *Sku `json:"sku,omitempty"` 5247 // JobAgentProperties - Resource properties. 5248 *JobAgentProperties `json:"properties,omitempty"` 5249 // Location - Resource location. 5250 Location *string `json:"location,omitempty"` 5251 // Tags - Resource tags. 5252 Tags map[string]*string `json:"tags"` 5253 // ID - READ-ONLY; Resource ID. 5254 ID *string `json:"id,omitempty"` 5255 // Name - READ-ONLY; Resource name. 5256 Name *string `json:"name,omitempty"` 5257 // Type - READ-ONLY; Resource type. 5258 Type *string `json:"type,omitempty"` 5259} 5260 5261// MarshalJSON is the custom marshaler for JobAgent. 5262func (ja JobAgent) MarshalJSON() ([]byte, error) { 5263 objectMap := make(map[string]interface{}) 5264 if ja.Sku != nil { 5265 objectMap["sku"] = ja.Sku 5266 } 5267 if ja.JobAgentProperties != nil { 5268 objectMap["properties"] = ja.JobAgentProperties 5269 } 5270 if ja.Location != nil { 5271 objectMap["location"] = ja.Location 5272 } 5273 if ja.Tags != nil { 5274 objectMap["tags"] = ja.Tags 5275 } 5276 return json.Marshal(objectMap) 5277} 5278 5279// UnmarshalJSON is the custom unmarshaler for JobAgent struct. 5280func (ja *JobAgent) UnmarshalJSON(body []byte) error { 5281 var m map[string]*json.RawMessage 5282 err := json.Unmarshal(body, &m) 5283 if err != nil { 5284 return err 5285 } 5286 for k, v := range m { 5287 switch k { 5288 case "sku": 5289 if v != nil { 5290 var sku Sku 5291 err = json.Unmarshal(*v, &sku) 5292 if err != nil { 5293 return err 5294 } 5295 ja.Sku = &sku 5296 } 5297 case "properties": 5298 if v != nil { 5299 var jobAgentProperties JobAgentProperties 5300 err = json.Unmarshal(*v, &jobAgentProperties) 5301 if err != nil { 5302 return err 5303 } 5304 ja.JobAgentProperties = &jobAgentProperties 5305 } 5306 case "location": 5307 if v != nil { 5308 var location string 5309 err = json.Unmarshal(*v, &location) 5310 if err != nil { 5311 return err 5312 } 5313 ja.Location = &location 5314 } 5315 case "tags": 5316 if v != nil { 5317 var tags map[string]*string 5318 err = json.Unmarshal(*v, &tags) 5319 if err != nil { 5320 return err 5321 } 5322 ja.Tags = tags 5323 } 5324 case "id": 5325 if v != nil { 5326 var ID string 5327 err = json.Unmarshal(*v, &ID) 5328 if err != nil { 5329 return err 5330 } 5331 ja.ID = &ID 5332 } 5333 case "name": 5334 if v != nil { 5335 var name string 5336 err = json.Unmarshal(*v, &name) 5337 if err != nil { 5338 return err 5339 } 5340 ja.Name = &name 5341 } 5342 case "type": 5343 if v != nil { 5344 var typeVar string 5345 err = json.Unmarshal(*v, &typeVar) 5346 if err != nil { 5347 return err 5348 } 5349 ja.Type = &typeVar 5350 } 5351 } 5352 } 5353 5354 return nil 5355} 5356 5357// JobAgentListResult a list of Azure SQL job agents. 5358type JobAgentListResult struct { 5359 autorest.Response `json:"-"` 5360 // Value - READ-ONLY; Array of results. 5361 Value *[]JobAgent `json:"value,omitempty"` 5362 // NextLink - READ-ONLY; Link to retrieve next page of results. 5363 NextLink *string `json:"nextLink,omitempty"` 5364} 5365 5366// MarshalJSON is the custom marshaler for JobAgentListResult. 5367func (jalr JobAgentListResult) MarshalJSON() ([]byte, error) { 5368 objectMap := make(map[string]interface{}) 5369 return json.Marshal(objectMap) 5370} 5371 5372// JobAgentListResultIterator provides access to a complete listing of JobAgent values. 5373type JobAgentListResultIterator struct { 5374 i int 5375 page JobAgentListResultPage 5376} 5377 5378// NextWithContext advances to the next value. If there was an error making 5379// the request the iterator does not advance and the error is returned. 5380func (iter *JobAgentListResultIterator) NextWithContext(ctx context.Context) (err error) { 5381 if tracing.IsEnabled() { 5382 ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentListResultIterator.NextWithContext") 5383 defer func() { 5384 sc := -1 5385 if iter.Response().Response.Response != nil { 5386 sc = iter.Response().Response.Response.StatusCode 5387 } 5388 tracing.EndSpan(ctx, sc, err) 5389 }() 5390 } 5391 iter.i++ 5392 if iter.i < len(iter.page.Values()) { 5393 return nil 5394 } 5395 err = iter.page.NextWithContext(ctx) 5396 if err != nil { 5397 iter.i-- 5398 return err 5399 } 5400 iter.i = 0 5401 return nil 5402} 5403 5404// Next advances to the next value. If there was an error making 5405// the request the iterator does not advance and the error is returned. 5406// Deprecated: Use NextWithContext() instead. 5407func (iter *JobAgentListResultIterator) Next() error { 5408 return iter.NextWithContext(context.Background()) 5409} 5410 5411// NotDone returns true if the enumeration should be started or is not yet complete. 5412func (iter JobAgentListResultIterator) NotDone() bool { 5413 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5414} 5415 5416// Response returns the raw server response from the last page request. 5417func (iter JobAgentListResultIterator) Response() JobAgentListResult { 5418 return iter.page.Response() 5419} 5420 5421// Value returns the current value or a zero-initialized value if the 5422// iterator has advanced beyond the end of the collection. 5423func (iter JobAgentListResultIterator) Value() JobAgent { 5424 if !iter.page.NotDone() { 5425 return JobAgent{} 5426 } 5427 return iter.page.Values()[iter.i] 5428} 5429 5430// Creates a new instance of the JobAgentListResultIterator type. 5431func NewJobAgentListResultIterator(page JobAgentListResultPage) JobAgentListResultIterator { 5432 return JobAgentListResultIterator{page: page} 5433} 5434 5435// IsEmpty returns true if the ListResult contains no values. 5436func (jalr JobAgentListResult) IsEmpty() bool { 5437 return jalr.Value == nil || len(*jalr.Value) == 0 5438} 5439 5440// hasNextLink returns true if the NextLink is not empty. 5441func (jalr JobAgentListResult) hasNextLink() bool { 5442 return jalr.NextLink != nil && len(*jalr.NextLink) != 0 5443} 5444 5445// jobAgentListResultPreparer prepares a request to retrieve the next set of results. 5446// It returns nil if no more results exist. 5447func (jalr JobAgentListResult) jobAgentListResultPreparer(ctx context.Context) (*http.Request, error) { 5448 if !jalr.hasNextLink() { 5449 return nil, nil 5450 } 5451 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5452 autorest.AsJSON(), 5453 autorest.AsGet(), 5454 autorest.WithBaseURL(to.String(jalr.NextLink))) 5455} 5456 5457// JobAgentListResultPage contains a page of JobAgent values. 5458type JobAgentListResultPage struct { 5459 fn func(context.Context, JobAgentListResult) (JobAgentListResult, error) 5460 jalr JobAgentListResult 5461} 5462 5463// NextWithContext advances to the next page of values. If there was an error making 5464// the request the page does not advance and the error is returned. 5465func (page *JobAgentListResultPage) NextWithContext(ctx context.Context) (err error) { 5466 if tracing.IsEnabled() { 5467 ctx = tracing.StartSpan(ctx, fqdn+"/JobAgentListResultPage.NextWithContext") 5468 defer func() { 5469 sc := -1 5470 if page.Response().Response.Response != nil { 5471 sc = page.Response().Response.Response.StatusCode 5472 } 5473 tracing.EndSpan(ctx, sc, err) 5474 }() 5475 } 5476 for { 5477 next, err := page.fn(ctx, page.jalr) 5478 if err != nil { 5479 return err 5480 } 5481 page.jalr = next 5482 if !next.hasNextLink() || !next.IsEmpty() { 5483 break 5484 } 5485 } 5486 return nil 5487} 5488 5489// Next advances to the next page of values. If there was an error making 5490// the request the page does not advance and the error is returned. 5491// Deprecated: Use NextWithContext() instead. 5492func (page *JobAgentListResultPage) Next() error { 5493 return page.NextWithContext(context.Background()) 5494} 5495 5496// NotDone returns true if the page enumeration should be started or is not yet complete. 5497func (page JobAgentListResultPage) NotDone() bool { 5498 return !page.jalr.IsEmpty() 5499} 5500 5501// Response returns the raw server response from the last page request. 5502func (page JobAgentListResultPage) Response() JobAgentListResult { 5503 return page.jalr 5504} 5505 5506// Values returns the slice of values for the current page or nil if there are no values. 5507func (page JobAgentListResultPage) Values() []JobAgent { 5508 if page.jalr.IsEmpty() { 5509 return nil 5510 } 5511 return *page.jalr.Value 5512} 5513 5514// Creates a new instance of the JobAgentListResultPage type. 5515func NewJobAgentListResultPage(cur JobAgentListResult, getNextPage func(context.Context, JobAgentListResult) (JobAgentListResult, error)) JobAgentListResultPage { 5516 return JobAgentListResultPage{ 5517 fn: getNextPage, 5518 jalr: cur, 5519 } 5520} 5521 5522// JobAgentProperties properties of a job agent. 5523type JobAgentProperties struct { 5524 // DatabaseID - Resource ID of the database to store job metadata in. 5525 DatabaseID *string `json:"databaseId,omitempty"` 5526 // State - READ-ONLY; The state of the job agent. Possible values include: 'JobAgentStateCreating', 'JobAgentStateReady', 'JobAgentStateUpdating', 'JobAgentStateDeleting', 'JobAgentStateDisabled' 5527 State JobAgentState `json:"state,omitempty"` 5528} 5529 5530// MarshalJSON is the custom marshaler for JobAgentProperties. 5531func (jap JobAgentProperties) MarshalJSON() ([]byte, error) { 5532 objectMap := make(map[string]interface{}) 5533 if jap.DatabaseID != nil { 5534 objectMap["databaseId"] = jap.DatabaseID 5535 } 5536 return json.Marshal(objectMap) 5537} 5538 5539// JobAgentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 5540// operation. 5541type JobAgentsCreateOrUpdateFuture struct { 5542 azure.FutureAPI 5543 // Result returns the result of the asynchronous operation. 5544 // If the operation has not completed it will return an error. 5545 Result func(JobAgentsClient) (JobAgent, error) 5546} 5547 5548// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5549func (future *JobAgentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 5550 var azFuture azure.Future 5551 if err := json.Unmarshal(body, &azFuture); err != nil { 5552 return err 5553 } 5554 future.FutureAPI = &azFuture 5555 future.Result = future.result 5556 return nil 5557} 5558 5559// result is the default implementation for JobAgentsCreateOrUpdateFuture.Result. 5560func (future *JobAgentsCreateOrUpdateFuture) result(client JobAgentsClient) (ja JobAgent, err error) { 5561 var done bool 5562 done, err = future.DoneWithContext(context.Background(), client) 5563 if err != nil { 5564 err = autorest.NewErrorWithError(err, "sql.JobAgentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 5565 return 5566 } 5567 if !done { 5568 ja.Response.Response = future.Response() 5569 err = azure.NewAsyncOpIncompleteError("sql.JobAgentsCreateOrUpdateFuture") 5570 return 5571 } 5572 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5573 if ja.Response.Response, err = future.GetResult(sender); err == nil && ja.Response.Response.StatusCode != http.StatusNoContent { 5574 ja, err = client.CreateOrUpdateResponder(ja.Response.Response) 5575 if err != nil { 5576 err = autorest.NewErrorWithError(err, "sql.JobAgentsCreateOrUpdateFuture", "Result", ja.Response.Response, "Failure responding to request") 5577 } 5578 } 5579 return 5580} 5581 5582// JobAgentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 5583// operation. 5584type JobAgentsDeleteFuture struct { 5585 azure.FutureAPI 5586 // Result returns the result of the asynchronous operation. 5587 // If the operation has not completed it will return an error. 5588 Result func(JobAgentsClient) (autorest.Response, error) 5589} 5590 5591// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5592func (future *JobAgentsDeleteFuture) UnmarshalJSON(body []byte) error { 5593 var azFuture azure.Future 5594 if err := json.Unmarshal(body, &azFuture); err != nil { 5595 return err 5596 } 5597 future.FutureAPI = &azFuture 5598 future.Result = future.result 5599 return nil 5600} 5601 5602// result is the default implementation for JobAgentsDeleteFuture.Result. 5603func (future *JobAgentsDeleteFuture) result(client JobAgentsClient) (ar autorest.Response, err error) { 5604 var done bool 5605 done, err = future.DoneWithContext(context.Background(), client) 5606 if err != nil { 5607 err = autorest.NewErrorWithError(err, "sql.JobAgentsDeleteFuture", "Result", future.Response(), "Polling failure") 5608 return 5609 } 5610 if !done { 5611 ar.Response = future.Response() 5612 err = azure.NewAsyncOpIncompleteError("sql.JobAgentsDeleteFuture") 5613 return 5614 } 5615 ar.Response = future.Response() 5616 return 5617} 5618 5619// JobAgentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 5620// operation. 5621type JobAgentsUpdateFuture struct { 5622 azure.FutureAPI 5623 // Result returns the result of the asynchronous operation. 5624 // If the operation has not completed it will return an error. 5625 Result func(JobAgentsClient) (JobAgent, error) 5626} 5627 5628// UnmarshalJSON is the custom unmarshaller for CreateFuture. 5629func (future *JobAgentsUpdateFuture) UnmarshalJSON(body []byte) error { 5630 var azFuture azure.Future 5631 if err := json.Unmarshal(body, &azFuture); err != nil { 5632 return err 5633 } 5634 future.FutureAPI = &azFuture 5635 future.Result = future.result 5636 return nil 5637} 5638 5639// result is the default implementation for JobAgentsUpdateFuture.Result. 5640func (future *JobAgentsUpdateFuture) result(client JobAgentsClient) (ja JobAgent, err error) { 5641 var done bool 5642 done, err = future.DoneWithContext(context.Background(), client) 5643 if err != nil { 5644 err = autorest.NewErrorWithError(err, "sql.JobAgentsUpdateFuture", "Result", future.Response(), "Polling failure") 5645 return 5646 } 5647 if !done { 5648 ja.Response.Response = future.Response() 5649 err = azure.NewAsyncOpIncompleteError("sql.JobAgentsUpdateFuture") 5650 return 5651 } 5652 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 5653 if ja.Response.Response, err = future.GetResult(sender); err == nil && ja.Response.Response.StatusCode != http.StatusNoContent { 5654 ja, err = client.UpdateResponder(ja.Response.Response) 5655 if err != nil { 5656 err = autorest.NewErrorWithError(err, "sql.JobAgentsUpdateFuture", "Result", ja.Response.Response, "Failure responding to request") 5657 } 5658 } 5659 return 5660} 5661 5662// JobAgentUpdate an update to an Azure SQL job agent. 5663type JobAgentUpdate struct { 5664 // Tags - Resource tags. 5665 Tags map[string]*string `json:"tags"` 5666} 5667 5668// MarshalJSON is the custom marshaler for JobAgentUpdate. 5669func (jau JobAgentUpdate) MarshalJSON() ([]byte, error) { 5670 objectMap := make(map[string]interface{}) 5671 if jau.Tags != nil { 5672 objectMap["tags"] = jau.Tags 5673 } 5674 return json.Marshal(objectMap) 5675} 5676 5677// JobCredential a stored credential that can be used by a job to connect to target databases. 5678type JobCredential struct { 5679 autorest.Response `json:"-"` 5680 // JobCredentialProperties - Resource properties. 5681 *JobCredentialProperties `json:"properties,omitempty"` 5682 // ID - READ-ONLY; Resource ID. 5683 ID *string `json:"id,omitempty"` 5684 // Name - READ-ONLY; Resource name. 5685 Name *string `json:"name,omitempty"` 5686 // Type - READ-ONLY; Resource type. 5687 Type *string `json:"type,omitempty"` 5688} 5689 5690// MarshalJSON is the custom marshaler for JobCredential. 5691func (jc JobCredential) MarshalJSON() ([]byte, error) { 5692 objectMap := make(map[string]interface{}) 5693 if jc.JobCredentialProperties != nil { 5694 objectMap["properties"] = jc.JobCredentialProperties 5695 } 5696 return json.Marshal(objectMap) 5697} 5698 5699// UnmarshalJSON is the custom unmarshaler for JobCredential struct. 5700func (jc *JobCredential) UnmarshalJSON(body []byte) error { 5701 var m map[string]*json.RawMessage 5702 err := json.Unmarshal(body, &m) 5703 if err != nil { 5704 return err 5705 } 5706 for k, v := range m { 5707 switch k { 5708 case "properties": 5709 if v != nil { 5710 var jobCredentialProperties JobCredentialProperties 5711 err = json.Unmarshal(*v, &jobCredentialProperties) 5712 if err != nil { 5713 return err 5714 } 5715 jc.JobCredentialProperties = &jobCredentialProperties 5716 } 5717 case "id": 5718 if v != nil { 5719 var ID string 5720 err = json.Unmarshal(*v, &ID) 5721 if err != nil { 5722 return err 5723 } 5724 jc.ID = &ID 5725 } 5726 case "name": 5727 if v != nil { 5728 var name string 5729 err = json.Unmarshal(*v, &name) 5730 if err != nil { 5731 return err 5732 } 5733 jc.Name = &name 5734 } 5735 case "type": 5736 if v != nil { 5737 var typeVar string 5738 err = json.Unmarshal(*v, &typeVar) 5739 if err != nil { 5740 return err 5741 } 5742 jc.Type = &typeVar 5743 } 5744 } 5745 } 5746 5747 return nil 5748} 5749 5750// JobCredentialListResult a list of job credentials. 5751type JobCredentialListResult struct { 5752 autorest.Response `json:"-"` 5753 // Value - READ-ONLY; Array of results. 5754 Value *[]JobCredential `json:"value,omitempty"` 5755 // NextLink - READ-ONLY; Link to retrieve next page of results. 5756 NextLink *string `json:"nextLink,omitempty"` 5757} 5758 5759// MarshalJSON is the custom marshaler for JobCredentialListResult. 5760func (jclr JobCredentialListResult) MarshalJSON() ([]byte, error) { 5761 objectMap := make(map[string]interface{}) 5762 return json.Marshal(objectMap) 5763} 5764 5765// JobCredentialListResultIterator provides access to a complete listing of JobCredential values. 5766type JobCredentialListResultIterator struct { 5767 i int 5768 page JobCredentialListResultPage 5769} 5770 5771// NextWithContext advances to the next value. If there was an error making 5772// the request the iterator does not advance and the error is returned. 5773func (iter *JobCredentialListResultIterator) NextWithContext(ctx context.Context) (err error) { 5774 if tracing.IsEnabled() { 5775 ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialListResultIterator.NextWithContext") 5776 defer func() { 5777 sc := -1 5778 if iter.Response().Response.Response != nil { 5779 sc = iter.Response().Response.Response.StatusCode 5780 } 5781 tracing.EndSpan(ctx, sc, err) 5782 }() 5783 } 5784 iter.i++ 5785 if iter.i < len(iter.page.Values()) { 5786 return nil 5787 } 5788 err = iter.page.NextWithContext(ctx) 5789 if err != nil { 5790 iter.i-- 5791 return err 5792 } 5793 iter.i = 0 5794 return nil 5795} 5796 5797// Next advances to the next value. If there was an error making 5798// the request the iterator does not advance and the error is returned. 5799// Deprecated: Use NextWithContext() instead. 5800func (iter *JobCredentialListResultIterator) Next() error { 5801 return iter.NextWithContext(context.Background()) 5802} 5803 5804// NotDone returns true if the enumeration should be started or is not yet complete. 5805func (iter JobCredentialListResultIterator) NotDone() bool { 5806 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 5807} 5808 5809// Response returns the raw server response from the last page request. 5810func (iter JobCredentialListResultIterator) Response() JobCredentialListResult { 5811 return iter.page.Response() 5812} 5813 5814// Value returns the current value or a zero-initialized value if the 5815// iterator has advanced beyond the end of the collection. 5816func (iter JobCredentialListResultIterator) Value() JobCredential { 5817 if !iter.page.NotDone() { 5818 return JobCredential{} 5819 } 5820 return iter.page.Values()[iter.i] 5821} 5822 5823// Creates a new instance of the JobCredentialListResultIterator type. 5824func NewJobCredentialListResultIterator(page JobCredentialListResultPage) JobCredentialListResultIterator { 5825 return JobCredentialListResultIterator{page: page} 5826} 5827 5828// IsEmpty returns true if the ListResult contains no values. 5829func (jclr JobCredentialListResult) IsEmpty() bool { 5830 return jclr.Value == nil || len(*jclr.Value) == 0 5831} 5832 5833// hasNextLink returns true if the NextLink is not empty. 5834func (jclr JobCredentialListResult) hasNextLink() bool { 5835 return jclr.NextLink != nil && len(*jclr.NextLink) != 0 5836} 5837 5838// jobCredentialListResultPreparer prepares a request to retrieve the next set of results. 5839// It returns nil if no more results exist. 5840func (jclr JobCredentialListResult) jobCredentialListResultPreparer(ctx context.Context) (*http.Request, error) { 5841 if !jclr.hasNextLink() { 5842 return nil, nil 5843 } 5844 return autorest.Prepare((&http.Request{}).WithContext(ctx), 5845 autorest.AsJSON(), 5846 autorest.AsGet(), 5847 autorest.WithBaseURL(to.String(jclr.NextLink))) 5848} 5849 5850// JobCredentialListResultPage contains a page of JobCredential values. 5851type JobCredentialListResultPage struct { 5852 fn func(context.Context, JobCredentialListResult) (JobCredentialListResult, error) 5853 jclr JobCredentialListResult 5854} 5855 5856// NextWithContext advances to the next page of values. If there was an error making 5857// the request the page does not advance and the error is returned. 5858func (page *JobCredentialListResultPage) NextWithContext(ctx context.Context) (err error) { 5859 if tracing.IsEnabled() { 5860 ctx = tracing.StartSpan(ctx, fqdn+"/JobCredentialListResultPage.NextWithContext") 5861 defer func() { 5862 sc := -1 5863 if page.Response().Response.Response != nil { 5864 sc = page.Response().Response.Response.StatusCode 5865 } 5866 tracing.EndSpan(ctx, sc, err) 5867 }() 5868 } 5869 for { 5870 next, err := page.fn(ctx, page.jclr) 5871 if err != nil { 5872 return err 5873 } 5874 page.jclr = next 5875 if !next.hasNextLink() || !next.IsEmpty() { 5876 break 5877 } 5878 } 5879 return nil 5880} 5881 5882// Next advances to the next page of values. If there was an error making 5883// the request the page does not advance and the error is returned. 5884// Deprecated: Use NextWithContext() instead. 5885func (page *JobCredentialListResultPage) Next() error { 5886 return page.NextWithContext(context.Background()) 5887} 5888 5889// NotDone returns true if the page enumeration should be started or is not yet complete. 5890func (page JobCredentialListResultPage) NotDone() bool { 5891 return !page.jclr.IsEmpty() 5892} 5893 5894// Response returns the raw server response from the last page request. 5895func (page JobCredentialListResultPage) Response() JobCredentialListResult { 5896 return page.jclr 5897} 5898 5899// Values returns the slice of values for the current page or nil if there are no values. 5900func (page JobCredentialListResultPage) Values() []JobCredential { 5901 if page.jclr.IsEmpty() { 5902 return nil 5903 } 5904 return *page.jclr.Value 5905} 5906 5907// Creates a new instance of the JobCredentialListResultPage type. 5908func NewJobCredentialListResultPage(cur JobCredentialListResult, getNextPage func(context.Context, JobCredentialListResult) (JobCredentialListResult, error)) JobCredentialListResultPage { 5909 return JobCredentialListResultPage{ 5910 fn: getNextPage, 5911 jclr: cur, 5912 } 5913} 5914 5915// JobCredentialProperties properties of a job credential. 5916type JobCredentialProperties struct { 5917 // Username - The credential user name. 5918 Username *string `json:"username,omitempty"` 5919 // Password - The credential password. 5920 Password *string `json:"password,omitempty"` 5921} 5922 5923// JobExecution an execution of a job 5924type JobExecution struct { 5925 autorest.Response `json:"-"` 5926 // JobExecutionProperties - Resource properties. 5927 *JobExecutionProperties `json:"properties,omitempty"` 5928 // ID - READ-ONLY; Resource ID. 5929 ID *string `json:"id,omitempty"` 5930 // Name - READ-ONLY; Resource name. 5931 Name *string `json:"name,omitempty"` 5932 // Type - READ-ONLY; Resource type. 5933 Type *string `json:"type,omitempty"` 5934} 5935 5936// MarshalJSON is the custom marshaler for JobExecution. 5937func (je JobExecution) MarshalJSON() ([]byte, error) { 5938 objectMap := make(map[string]interface{}) 5939 if je.JobExecutionProperties != nil { 5940 objectMap["properties"] = je.JobExecutionProperties 5941 } 5942 return json.Marshal(objectMap) 5943} 5944 5945// UnmarshalJSON is the custom unmarshaler for JobExecution struct. 5946func (je *JobExecution) UnmarshalJSON(body []byte) error { 5947 var m map[string]*json.RawMessage 5948 err := json.Unmarshal(body, &m) 5949 if err != nil { 5950 return err 5951 } 5952 for k, v := range m { 5953 switch k { 5954 case "properties": 5955 if v != nil { 5956 var jobExecutionProperties JobExecutionProperties 5957 err = json.Unmarshal(*v, &jobExecutionProperties) 5958 if err != nil { 5959 return err 5960 } 5961 je.JobExecutionProperties = &jobExecutionProperties 5962 } 5963 case "id": 5964 if v != nil { 5965 var ID string 5966 err = json.Unmarshal(*v, &ID) 5967 if err != nil { 5968 return err 5969 } 5970 je.ID = &ID 5971 } 5972 case "name": 5973 if v != nil { 5974 var name string 5975 err = json.Unmarshal(*v, &name) 5976 if err != nil { 5977 return err 5978 } 5979 je.Name = &name 5980 } 5981 case "type": 5982 if v != nil { 5983 var typeVar string 5984 err = json.Unmarshal(*v, &typeVar) 5985 if err != nil { 5986 return err 5987 } 5988 je.Type = &typeVar 5989 } 5990 } 5991 } 5992 5993 return nil 5994} 5995 5996// JobExecutionListResult a list of job executions. 5997type JobExecutionListResult struct { 5998 autorest.Response `json:"-"` 5999 // Value - READ-ONLY; Array of results. 6000 Value *[]JobExecution `json:"value,omitempty"` 6001 // NextLink - READ-ONLY; Link to retrieve next page of results. 6002 NextLink *string `json:"nextLink,omitempty"` 6003} 6004 6005// MarshalJSON is the custom marshaler for JobExecutionListResult. 6006func (jelr JobExecutionListResult) MarshalJSON() ([]byte, error) { 6007 objectMap := make(map[string]interface{}) 6008 return json.Marshal(objectMap) 6009} 6010 6011// JobExecutionListResultIterator provides access to a complete listing of JobExecution values. 6012type JobExecutionListResultIterator struct { 6013 i int 6014 page JobExecutionListResultPage 6015} 6016 6017// NextWithContext advances to the next value. If there was an error making 6018// the request the iterator does not advance and the error is returned. 6019func (iter *JobExecutionListResultIterator) NextWithContext(ctx context.Context) (err error) { 6020 if tracing.IsEnabled() { 6021 ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionListResultIterator.NextWithContext") 6022 defer func() { 6023 sc := -1 6024 if iter.Response().Response.Response != nil { 6025 sc = iter.Response().Response.Response.StatusCode 6026 } 6027 tracing.EndSpan(ctx, sc, err) 6028 }() 6029 } 6030 iter.i++ 6031 if iter.i < len(iter.page.Values()) { 6032 return nil 6033 } 6034 err = iter.page.NextWithContext(ctx) 6035 if err != nil { 6036 iter.i-- 6037 return err 6038 } 6039 iter.i = 0 6040 return nil 6041} 6042 6043// Next advances to the next value. If there was an error making 6044// the request the iterator does not advance and the error is returned. 6045// Deprecated: Use NextWithContext() instead. 6046func (iter *JobExecutionListResultIterator) Next() error { 6047 return iter.NextWithContext(context.Background()) 6048} 6049 6050// NotDone returns true if the enumeration should be started or is not yet complete. 6051func (iter JobExecutionListResultIterator) NotDone() bool { 6052 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6053} 6054 6055// Response returns the raw server response from the last page request. 6056func (iter JobExecutionListResultIterator) Response() JobExecutionListResult { 6057 return iter.page.Response() 6058} 6059 6060// Value returns the current value or a zero-initialized value if the 6061// iterator has advanced beyond the end of the collection. 6062func (iter JobExecutionListResultIterator) Value() JobExecution { 6063 if !iter.page.NotDone() { 6064 return JobExecution{} 6065 } 6066 return iter.page.Values()[iter.i] 6067} 6068 6069// Creates a new instance of the JobExecutionListResultIterator type. 6070func NewJobExecutionListResultIterator(page JobExecutionListResultPage) JobExecutionListResultIterator { 6071 return JobExecutionListResultIterator{page: page} 6072} 6073 6074// IsEmpty returns true if the ListResult contains no values. 6075func (jelr JobExecutionListResult) IsEmpty() bool { 6076 return jelr.Value == nil || len(*jelr.Value) == 0 6077} 6078 6079// hasNextLink returns true if the NextLink is not empty. 6080func (jelr JobExecutionListResult) hasNextLink() bool { 6081 return jelr.NextLink != nil && len(*jelr.NextLink) != 0 6082} 6083 6084// jobExecutionListResultPreparer prepares a request to retrieve the next set of results. 6085// It returns nil if no more results exist. 6086func (jelr JobExecutionListResult) jobExecutionListResultPreparer(ctx context.Context) (*http.Request, error) { 6087 if !jelr.hasNextLink() { 6088 return nil, nil 6089 } 6090 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6091 autorest.AsJSON(), 6092 autorest.AsGet(), 6093 autorest.WithBaseURL(to.String(jelr.NextLink))) 6094} 6095 6096// JobExecutionListResultPage contains a page of JobExecution values. 6097type JobExecutionListResultPage struct { 6098 fn func(context.Context, JobExecutionListResult) (JobExecutionListResult, error) 6099 jelr JobExecutionListResult 6100} 6101 6102// NextWithContext advances to the next page of values. If there was an error making 6103// the request the page does not advance and the error is returned. 6104func (page *JobExecutionListResultPage) NextWithContext(ctx context.Context) (err error) { 6105 if tracing.IsEnabled() { 6106 ctx = tracing.StartSpan(ctx, fqdn+"/JobExecutionListResultPage.NextWithContext") 6107 defer func() { 6108 sc := -1 6109 if page.Response().Response.Response != nil { 6110 sc = page.Response().Response.Response.StatusCode 6111 } 6112 tracing.EndSpan(ctx, sc, err) 6113 }() 6114 } 6115 for { 6116 next, err := page.fn(ctx, page.jelr) 6117 if err != nil { 6118 return err 6119 } 6120 page.jelr = next 6121 if !next.hasNextLink() || !next.IsEmpty() { 6122 break 6123 } 6124 } 6125 return nil 6126} 6127 6128// Next advances to the next page of values. If there was an error making 6129// the request the page does not advance and the error is returned. 6130// Deprecated: Use NextWithContext() instead. 6131func (page *JobExecutionListResultPage) Next() error { 6132 return page.NextWithContext(context.Background()) 6133} 6134 6135// NotDone returns true if the page enumeration should be started or is not yet complete. 6136func (page JobExecutionListResultPage) NotDone() bool { 6137 return !page.jelr.IsEmpty() 6138} 6139 6140// Response returns the raw server response from the last page request. 6141func (page JobExecutionListResultPage) Response() JobExecutionListResult { 6142 return page.jelr 6143} 6144 6145// Values returns the slice of values for the current page or nil if there are no values. 6146func (page JobExecutionListResultPage) Values() []JobExecution { 6147 if page.jelr.IsEmpty() { 6148 return nil 6149 } 6150 return *page.jelr.Value 6151} 6152 6153// Creates a new instance of the JobExecutionListResultPage type. 6154func NewJobExecutionListResultPage(cur JobExecutionListResult, getNextPage func(context.Context, JobExecutionListResult) (JobExecutionListResult, error)) JobExecutionListResultPage { 6155 return JobExecutionListResultPage{ 6156 fn: getNextPage, 6157 jelr: cur, 6158 } 6159} 6160 6161// JobExecutionProperties properties for an Azure SQL Database Elastic job execution. 6162type JobExecutionProperties struct { 6163 // JobVersion - READ-ONLY; The job version number. 6164 JobVersion *int32 `json:"jobVersion,omitempty"` 6165 // StepName - READ-ONLY; The job step name. 6166 StepName *string `json:"stepName,omitempty"` 6167 // StepID - READ-ONLY; The job step id. 6168 StepID *int32 `json:"stepId,omitempty"` 6169 // JobExecutionID - READ-ONLY; The unique identifier of the job execution. 6170 JobExecutionID *uuid.UUID `json:"jobExecutionId,omitempty"` 6171 // Lifecycle - READ-ONLY; The detailed state of the job execution. Possible values include: 'Created', 'InProgress', 'WaitingForChildJobExecutions', 'WaitingForRetry', 'Succeeded', 'SucceededWithSkipped', 'Failed', 'TimedOut', 'Canceled', 'Skipped' 6172 Lifecycle JobExecutionLifecycle `json:"lifecycle,omitempty"` 6173 // ProvisioningState - READ-ONLY; The ARM provisioning state of the job execution. Possible values include: 'ProvisioningStateCreated', 'ProvisioningStateInProgress', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' 6174 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 6175 // CreateTime - READ-ONLY; The time that the job execution was created. 6176 CreateTime *date.Time `json:"createTime,omitempty"` 6177 // StartTime - READ-ONLY; The time that the job execution started. 6178 StartTime *date.Time `json:"startTime,omitempty"` 6179 // EndTime - READ-ONLY; The time that the job execution completed. 6180 EndTime *date.Time `json:"endTime,omitempty"` 6181 // CurrentAttempts - Number of times the job execution has been attempted. 6182 CurrentAttempts *int32 `json:"currentAttempts,omitempty"` 6183 // CurrentAttemptStartTime - READ-ONLY; Start time of the current attempt. 6184 CurrentAttemptStartTime *date.Time `json:"currentAttemptStartTime,omitempty"` 6185 // LastMessage - READ-ONLY; The last status or error message. 6186 LastMessage *string `json:"lastMessage,omitempty"` 6187 // Target - READ-ONLY; The target that this execution is executed on. 6188 Target *JobExecutionTarget `json:"target,omitempty"` 6189} 6190 6191// MarshalJSON is the custom marshaler for JobExecutionProperties. 6192func (jep JobExecutionProperties) MarshalJSON() ([]byte, error) { 6193 objectMap := make(map[string]interface{}) 6194 if jep.CurrentAttempts != nil { 6195 objectMap["currentAttempts"] = jep.CurrentAttempts 6196 } 6197 return json.Marshal(objectMap) 6198} 6199 6200// JobExecutionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 6201// operation. 6202type JobExecutionsCreateFuture struct { 6203 azure.FutureAPI 6204 // Result returns the result of the asynchronous operation. 6205 // If the operation has not completed it will return an error. 6206 Result func(JobExecutionsClient) (JobExecution, error) 6207} 6208 6209// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6210func (future *JobExecutionsCreateFuture) UnmarshalJSON(body []byte) error { 6211 var azFuture azure.Future 6212 if err := json.Unmarshal(body, &azFuture); err != nil { 6213 return err 6214 } 6215 future.FutureAPI = &azFuture 6216 future.Result = future.result 6217 return nil 6218} 6219 6220// result is the default implementation for JobExecutionsCreateFuture.Result. 6221func (future *JobExecutionsCreateFuture) result(client JobExecutionsClient) (je JobExecution, err error) { 6222 var done bool 6223 done, err = future.DoneWithContext(context.Background(), client) 6224 if err != nil { 6225 err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateFuture", "Result", future.Response(), "Polling failure") 6226 return 6227 } 6228 if !done { 6229 je.Response.Response = future.Response() 6230 err = azure.NewAsyncOpIncompleteError("sql.JobExecutionsCreateFuture") 6231 return 6232 } 6233 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6234 if je.Response.Response, err = future.GetResult(sender); err == nil && je.Response.Response.StatusCode != http.StatusNoContent { 6235 je, err = client.CreateResponder(je.Response.Response) 6236 if err != nil { 6237 err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateFuture", "Result", je.Response.Response, "Failure responding to request") 6238 } 6239 } 6240 return 6241} 6242 6243// JobExecutionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 6244// long-running operation. 6245type JobExecutionsCreateOrUpdateFuture struct { 6246 azure.FutureAPI 6247 // Result returns the result of the asynchronous operation. 6248 // If the operation has not completed it will return an error. 6249 Result func(JobExecutionsClient) (JobExecution, error) 6250} 6251 6252// UnmarshalJSON is the custom unmarshaller for CreateFuture. 6253func (future *JobExecutionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 6254 var azFuture azure.Future 6255 if err := json.Unmarshal(body, &azFuture); err != nil { 6256 return err 6257 } 6258 future.FutureAPI = &azFuture 6259 future.Result = future.result 6260 return nil 6261} 6262 6263// result is the default implementation for JobExecutionsCreateOrUpdateFuture.Result. 6264func (future *JobExecutionsCreateOrUpdateFuture) result(client JobExecutionsClient) (je JobExecution, err error) { 6265 var done bool 6266 done, err = future.DoneWithContext(context.Background(), client) 6267 if err != nil { 6268 err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 6269 return 6270 } 6271 if !done { 6272 je.Response.Response = future.Response() 6273 err = azure.NewAsyncOpIncompleteError("sql.JobExecutionsCreateOrUpdateFuture") 6274 return 6275 } 6276 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 6277 if je.Response.Response, err = future.GetResult(sender); err == nil && je.Response.Response.StatusCode != http.StatusNoContent { 6278 je, err = client.CreateOrUpdateResponder(je.Response.Response) 6279 if err != nil { 6280 err = autorest.NewErrorWithError(err, "sql.JobExecutionsCreateOrUpdateFuture", "Result", je.Response.Response, "Failure responding to request") 6281 } 6282 } 6283 return 6284} 6285 6286// JobExecutionTarget the target that a job execution is executed on. 6287type JobExecutionTarget struct { 6288 // Type - READ-ONLY; The type of the target. Possible values include: 'JobTargetTypeTargetGroup', 'JobTargetTypeSQLDatabase', 'JobTargetTypeSQLElasticPool', 'JobTargetTypeSQLShardMap', 'JobTargetTypeSQLServer' 6289 Type JobTargetType `json:"type,omitempty"` 6290 // ServerName - READ-ONLY; The server name. 6291 ServerName *string `json:"serverName,omitempty"` 6292 // DatabaseName - READ-ONLY; The database name. 6293 DatabaseName *string `json:"databaseName,omitempty"` 6294} 6295 6296// MarshalJSON is the custom marshaler for JobExecutionTarget. 6297func (jet JobExecutionTarget) MarshalJSON() ([]byte, error) { 6298 objectMap := make(map[string]interface{}) 6299 return json.Marshal(objectMap) 6300} 6301 6302// JobListResult a list of jobs. 6303type JobListResult struct { 6304 autorest.Response `json:"-"` 6305 // Value - READ-ONLY; Array of results. 6306 Value *[]Job `json:"value,omitempty"` 6307 // NextLink - READ-ONLY; Link to retrieve next page of results. 6308 NextLink *string `json:"nextLink,omitempty"` 6309} 6310 6311// MarshalJSON is the custom marshaler for JobListResult. 6312func (jlr JobListResult) MarshalJSON() ([]byte, error) { 6313 objectMap := make(map[string]interface{}) 6314 return json.Marshal(objectMap) 6315} 6316 6317// JobListResultIterator provides access to a complete listing of Job values. 6318type JobListResultIterator struct { 6319 i int 6320 page JobListResultPage 6321} 6322 6323// NextWithContext advances to the next value. If there was an error making 6324// the request the iterator does not advance and the error is returned. 6325func (iter *JobListResultIterator) NextWithContext(ctx context.Context) (err error) { 6326 if tracing.IsEnabled() { 6327 ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultIterator.NextWithContext") 6328 defer func() { 6329 sc := -1 6330 if iter.Response().Response.Response != nil { 6331 sc = iter.Response().Response.Response.StatusCode 6332 } 6333 tracing.EndSpan(ctx, sc, err) 6334 }() 6335 } 6336 iter.i++ 6337 if iter.i < len(iter.page.Values()) { 6338 return nil 6339 } 6340 err = iter.page.NextWithContext(ctx) 6341 if err != nil { 6342 iter.i-- 6343 return err 6344 } 6345 iter.i = 0 6346 return nil 6347} 6348 6349// Next advances to the next value. If there was an error making 6350// the request the iterator does not advance and the error is returned. 6351// Deprecated: Use NextWithContext() instead. 6352func (iter *JobListResultIterator) Next() error { 6353 return iter.NextWithContext(context.Background()) 6354} 6355 6356// NotDone returns true if the enumeration should be started or is not yet complete. 6357func (iter JobListResultIterator) NotDone() bool { 6358 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6359} 6360 6361// Response returns the raw server response from the last page request. 6362func (iter JobListResultIterator) Response() JobListResult { 6363 return iter.page.Response() 6364} 6365 6366// Value returns the current value or a zero-initialized value if the 6367// iterator has advanced beyond the end of the collection. 6368func (iter JobListResultIterator) Value() Job { 6369 if !iter.page.NotDone() { 6370 return Job{} 6371 } 6372 return iter.page.Values()[iter.i] 6373} 6374 6375// Creates a new instance of the JobListResultIterator type. 6376func NewJobListResultIterator(page JobListResultPage) JobListResultIterator { 6377 return JobListResultIterator{page: page} 6378} 6379 6380// IsEmpty returns true if the ListResult contains no values. 6381func (jlr JobListResult) IsEmpty() bool { 6382 return jlr.Value == nil || len(*jlr.Value) == 0 6383} 6384 6385// hasNextLink returns true if the NextLink is not empty. 6386func (jlr JobListResult) hasNextLink() bool { 6387 return jlr.NextLink != nil && len(*jlr.NextLink) != 0 6388} 6389 6390// jobListResultPreparer prepares a request to retrieve the next set of results. 6391// It returns nil if no more results exist. 6392func (jlr JobListResult) jobListResultPreparer(ctx context.Context) (*http.Request, error) { 6393 if !jlr.hasNextLink() { 6394 return nil, nil 6395 } 6396 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6397 autorest.AsJSON(), 6398 autorest.AsGet(), 6399 autorest.WithBaseURL(to.String(jlr.NextLink))) 6400} 6401 6402// JobListResultPage contains a page of Job values. 6403type JobListResultPage struct { 6404 fn func(context.Context, JobListResult) (JobListResult, error) 6405 jlr JobListResult 6406} 6407 6408// NextWithContext advances to the next page of values. If there was an error making 6409// the request the page does not advance and the error is returned. 6410func (page *JobListResultPage) NextWithContext(ctx context.Context) (err error) { 6411 if tracing.IsEnabled() { 6412 ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultPage.NextWithContext") 6413 defer func() { 6414 sc := -1 6415 if page.Response().Response.Response != nil { 6416 sc = page.Response().Response.Response.StatusCode 6417 } 6418 tracing.EndSpan(ctx, sc, err) 6419 }() 6420 } 6421 for { 6422 next, err := page.fn(ctx, page.jlr) 6423 if err != nil { 6424 return err 6425 } 6426 page.jlr = next 6427 if !next.hasNextLink() || !next.IsEmpty() { 6428 break 6429 } 6430 } 6431 return nil 6432} 6433 6434// Next advances to the next page of values. If there was an error making 6435// the request the page does not advance and the error is returned. 6436// Deprecated: Use NextWithContext() instead. 6437func (page *JobListResultPage) Next() error { 6438 return page.NextWithContext(context.Background()) 6439} 6440 6441// NotDone returns true if the page enumeration should be started or is not yet complete. 6442func (page JobListResultPage) NotDone() bool { 6443 return !page.jlr.IsEmpty() 6444} 6445 6446// Response returns the raw server response from the last page request. 6447func (page JobListResultPage) Response() JobListResult { 6448 return page.jlr 6449} 6450 6451// Values returns the slice of values for the current page or nil if there are no values. 6452func (page JobListResultPage) Values() []Job { 6453 if page.jlr.IsEmpty() { 6454 return nil 6455 } 6456 return *page.jlr.Value 6457} 6458 6459// Creates a new instance of the JobListResultPage type. 6460func NewJobListResultPage(cur JobListResult, getNextPage func(context.Context, JobListResult) (JobListResult, error)) JobListResultPage { 6461 return JobListResultPage{ 6462 fn: getNextPage, 6463 jlr: cur, 6464 } 6465} 6466 6467// JobProperties properties of a job. 6468type JobProperties struct { 6469 // Description - User-defined description of the job. 6470 Description *string `json:"description,omitempty"` 6471 // Version - READ-ONLY; The job version number. 6472 Version *int32 `json:"version,omitempty"` 6473 // Schedule - Schedule properties of the job. 6474 Schedule *JobSchedule `json:"schedule,omitempty"` 6475} 6476 6477// MarshalJSON is the custom marshaler for JobProperties. 6478func (jp JobProperties) MarshalJSON() ([]byte, error) { 6479 objectMap := make(map[string]interface{}) 6480 if jp.Description != nil { 6481 objectMap["description"] = jp.Description 6482 } 6483 if jp.Schedule != nil { 6484 objectMap["schedule"] = jp.Schedule 6485 } 6486 return json.Marshal(objectMap) 6487} 6488 6489// JobSchedule scheduling properties of a job. 6490type JobSchedule struct { 6491 // StartTime - Schedule start time. 6492 StartTime *date.Time `json:"startTime,omitempty"` 6493 // EndTime - Schedule end time. 6494 EndTime *date.Time `json:"endTime,omitempty"` 6495 // Type - Schedule interval type. Possible values include: 'Once', 'Recurring' 6496 Type JobScheduleType `json:"type,omitempty"` 6497 // Enabled - Whether or not the schedule is enabled. 6498 Enabled *bool `json:"enabled,omitempty"` 6499 // Interval - Value of the schedule's recurring interval, if the schedule type is recurring. ISO8601 duration format. 6500 Interval *string `json:"interval,omitempty"` 6501} 6502 6503// JobStep a job step. 6504type JobStep struct { 6505 autorest.Response `json:"-"` 6506 // JobStepProperties - Resource properties. 6507 *JobStepProperties `json:"properties,omitempty"` 6508 // ID - READ-ONLY; Resource ID. 6509 ID *string `json:"id,omitempty"` 6510 // Name - READ-ONLY; Resource name. 6511 Name *string `json:"name,omitempty"` 6512 // Type - READ-ONLY; Resource type. 6513 Type *string `json:"type,omitempty"` 6514} 6515 6516// MarshalJSON is the custom marshaler for JobStep. 6517func (js JobStep) MarshalJSON() ([]byte, error) { 6518 objectMap := make(map[string]interface{}) 6519 if js.JobStepProperties != nil { 6520 objectMap["properties"] = js.JobStepProperties 6521 } 6522 return json.Marshal(objectMap) 6523} 6524 6525// UnmarshalJSON is the custom unmarshaler for JobStep struct. 6526func (js *JobStep) UnmarshalJSON(body []byte) error { 6527 var m map[string]*json.RawMessage 6528 err := json.Unmarshal(body, &m) 6529 if err != nil { 6530 return err 6531 } 6532 for k, v := range m { 6533 switch k { 6534 case "properties": 6535 if v != nil { 6536 var jobStepProperties JobStepProperties 6537 err = json.Unmarshal(*v, &jobStepProperties) 6538 if err != nil { 6539 return err 6540 } 6541 js.JobStepProperties = &jobStepProperties 6542 } 6543 case "id": 6544 if v != nil { 6545 var ID string 6546 err = json.Unmarshal(*v, &ID) 6547 if err != nil { 6548 return err 6549 } 6550 js.ID = &ID 6551 } 6552 case "name": 6553 if v != nil { 6554 var name string 6555 err = json.Unmarshal(*v, &name) 6556 if err != nil { 6557 return err 6558 } 6559 js.Name = &name 6560 } 6561 case "type": 6562 if v != nil { 6563 var typeVar string 6564 err = json.Unmarshal(*v, &typeVar) 6565 if err != nil { 6566 return err 6567 } 6568 js.Type = &typeVar 6569 } 6570 } 6571 } 6572 6573 return nil 6574} 6575 6576// JobStepAction the action to be executed by a job step. 6577type JobStepAction struct { 6578 // Type - Type of action being executed by the job step. Possible values include: 'TSQL' 6579 Type JobStepActionType `json:"type,omitempty"` 6580 // Source - The source of the action to execute. Possible values include: 'Inline' 6581 Source JobStepActionSource `json:"source,omitempty"` 6582 // Value - The action value, for example the text of the T-SQL script to execute. 6583 Value *string `json:"value,omitempty"` 6584} 6585 6586// JobStepExecutionOptions the execution options of a job step. 6587type JobStepExecutionOptions struct { 6588 // TimeoutSeconds - Execution timeout for the job step. 6589 TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` 6590 // RetryAttempts - Maximum number of times the job step will be reattempted if the first attempt fails. 6591 RetryAttempts *int32 `json:"retryAttempts,omitempty"` 6592 // InitialRetryIntervalSeconds - Initial delay between retries for job step execution. 6593 InitialRetryIntervalSeconds *int32 `json:"initialRetryIntervalSeconds,omitempty"` 6594 // MaximumRetryIntervalSeconds - The maximum amount of time to wait between retries for job step execution. 6595 MaximumRetryIntervalSeconds *int32 `json:"maximumRetryIntervalSeconds,omitempty"` 6596 // RetryIntervalBackoffMultiplier - The backoff multiplier for the time between retries. 6597 RetryIntervalBackoffMultiplier *float64 `json:"retryIntervalBackoffMultiplier,omitempty"` 6598} 6599 6600// JobStepListResult a list of job steps. 6601type JobStepListResult struct { 6602 autorest.Response `json:"-"` 6603 // Value - READ-ONLY; Array of results. 6604 Value *[]JobStep `json:"value,omitempty"` 6605 // NextLink - READ-ONLY; Link to retrieve next page of results. 6606 NextLink *string `json:"nextLink,omitempty"` 6607} 6608 6609// MarshalJSON is the custom marshaler for JobStepListResult. 6610func (jslr JobStepListResult) MarshalJSON() ([]byte, error) { 6611 objectMap := make(map[string]interface{}) 6612 return json.Marshal(objectMap) 6613} 6614 6615// JobStepListResultIterator provides access to a complete listing of JobStep values. 6616type JobStepListResultIterator struct { 6617 i int 6618 page JobStepListResultPage 6619} 6620 6621// NextWithContext advances to the next value. If there was an error making 6622// the request the iterator does not advance and the error is returned. 6623func (iter *JobStepListResultIterator) NextWithContext(ctx context.Context) (err error) { 6624 if tracing.IsEnabled() { 6625 ctx = tracing.StartSpan(ctx, fqdn+"/JobStepListResultIterator.NextWithContext") 6626 defer func() { 6627 sc := -1 6628 if iter.Response().Response.Response != nil { 6629 sc = iter.Response().Response.Response.StatusCode 6630 } 6631 tracing.EndSpan(ctx, sc, err) 6632 }() 6633 } 6634 iter.i++ 6635 if iter.i < len(iter.page.Values()) { 6636 return nil 6637 } 6638 err = iter.page.NextWithContext(ctx) 6639 if err != nil { 6640 iter.i-- 6641 return err 6642 } 6643 iter.i = 0 6644 return nil 6645} 6646 6647// Next advances to the next value. If there was an error making 6648// the request the iterator does not advance and the error is returned. 6649// Deprecated: Use NextWithContext() instead. 6650func (iter *JobStepListResultIterator) Next() error { 6651 return iter.NextWithContext(context.Background()) 6652} 6653 6654// NotDone returns true if the enumeration should be started or is not yet complete. 6655func (iter JobStepListResultIterator) NotDone() bool { 6656 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6657} 6658 6659// Response returns the raw server response from the last page request. 6660func (iter JobStepListResultIterator) Response() JobStepListResult { 6661 return iter.page.Response() 6662} 6663 6664// Value returns the current value or a zero-initialized value if the 6665// iterator has advanced beyond the end of the collection. 6666func (iter JobStepListResultIterator) Value() JobStep { 6667 if !iter.page.NotDone() { 6668 return JobStep{} 6669 } 6670 return iter.page.Values()[iter.i] 6671} 6672 6673// Creates a new instance of the JobStepListResultIterator type. 6674func NewJobStepListResultIterator(page JobStepListResultPage) JobStepListResultIterator { 6675 return JobStepListResultIterator{page: page} 6676} 6677 6678// IsEmpty returns true if the ListResult contains no values. 6679func (jslr JobStepListResult) IsEmpty() bool { 6680 return jslr.Value == nil || len(*jslr.Value) == 0 6681} 6682 6683// hasNextLink returns true if the NextLink is not empty. 6684func (jslr JobStepListResult) hasNextLink() bool { 6685 return jslr.NextLink != nil && len(*jslr.NextLink) != 0 6686} 6687 6688// jobStepListResultPreparer prepares a request to retrieve the next set of results. 6689// It returns nil if no more results exist. 6690func (jslr JobStepListResult) jobStepListResultPreparer(ctx context.Context) (*http.Request, error) { 6691 if !jslr.hasNextLink() { 6692 return nil, nil 6693 } 6694 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6695 autorest.AsJSON(), 6696 autorest.AsGet(), 6697 autorest.WithBaseURL(to.String(jslr.NextLink))) 6698} 6699 6700// JobStepListResultPage contains a page of JobStep values. 6701type JobStepListResultPage struct { 6702 fn func(context.Context, JobStepListResult) (JobStepListResult, error) 6703 jslr JobStepListResult 6704} 6705 6706// NextWithContext advances to the next page of values. If there was an error making 6707// the request the page does not advance and the error is returned. 6708func (page *JobStepListResultPage) NextWithContext(ctx context.Context) (err error) { 6709 if tracing.IsEnabled() { 6710 ctx = tracing.StartSpan(ctx, fqdn+"/JobStepListResultPage.NextWithContext") 6711 defer func() { 6712 sc := -1 6713 if page.Response().Response.Response != nil { 6714 sc = page.Response().Response.Response.StatusCode 6715 } 6716 tracing.EndSpan(ctx, sc, err) 6717 }() 6718 } 6719 for { 6720 next, err := page.fn(ctx, page.jslr) 6721 if err != nil { 6722 return err 6723 } 6724 page.jslr = next 6725 if !next.hasNextLink() || !next.IsEmpty() { 6726 break 6727 } 6728 } 6729 return nil 6730} 6731 6732// Next advances to the next page of values. If there was an error making 6733// the request the page does not advance and the error is returned. 6734// Deprecated: Use NextWithContext() instead. 6735func (page *JobStepListResultPage) Next() error { 6736 return page.NextWithContext(context.Background()) 6737} 6738 6739// NotDone returns true if the page enumeration should be started or is not yet complete. 6740func (page JobStepListResultPage) NotDone() bool { 6741 return !page.jslr.IsEmpty() 6742} 6743 6744// Response returns the raw server response from the last page request. 6745func (page JobStepListResultPage) Response() JobStepListResult { 6746 return page.jslr 6747} 6748 6749// Values returns the slice of values for the current page or nil if there are no values. 6750func (page JobStepListResultPage) Values() []JobStep { 6751 if page.jslr.IsEmpty() { 6752 return nil 6753 } 6754 return *page.jslr.Value 6755} 6756 6757// Creates a new instance of the JobStepListResultPage type. 6758func NewJobStepListResultPage(cur JobStepListResult, getNextPage func(context.Context, JobStepListResult) (JobStepListResult, error)) JobStepListResultPage { 6759 return JobStepListResultPage{ 6760 fn: getNextPage, 6761 jslr: cur, 6762 } 6763} 6764 6765// JobStepOutput the output configuration of a job step. 6766type JobStepOutput struct { 6767 // Type - The output destination type. Possible values include: 'SQLDatabase' 6768 Type JobStepOutputType `json:"type,omitempty"` 6769 // SubscriptionID - The output destination subscription id. 6770 SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"` 6771 // ResourceGroupName - The output destination resource group. 6772 ResourceGroupName *string `json:"resourceGroupName,omitempty"` 6773 // ServerName - The output destination server name. 6774 ServerName *string `json:"serverName,omitempty"` 6775 // DatabaseName - The output destination database. 6776 DatabaseName *string `json:"databaseName,omitempty"` 6777 // SchemaName - The output destination schema. 6778 SchemaName *string `json:"schemaName,omitempty"` 6779 // TableName - The output destination table. 6780 TableName *string `json:"tableName,omitempty"` 6781 // Credential - The resource ID of the credential to use to connect to the output destination. 6782 Credential *string `json:"credential,omitempty"` 6783} 6784 6785// JobStepProperties properties of a job step. 6786type JobStepProperties struct { 6787 // StepID - The job step's index within the job. If not specified when creating the job step, it will be created as the last step. If not specified when updating the job step, the step id is not modified. 6788 StepID *int32 `json:"stepId,omitempty"` 6789 // TargetGroup - The resource ID of the target group that the job step will be executed on. 6790 TargetGroup *string `json:"targetGroup,omitempty"` 6791 // Credential - The resource ID of the job credential that will be used to connect to the targets. 6792 Credential *string `json:"credential,omitempty"` 6793 // Action - The action payload of the job step. 6794 Action *JobStepAction `json:"action,omitempty"` 6795 // Output - Output destination properties of the job step. 6796 Output *JobStepOutput `json:"output,omitempty"` 6797 // ExecutionOptions - Execution options for the job step. 6798 ExecutionOptions *JobStepExecutionOptions `json:"executionOptions,omitempty"` 6799} 6800 6801// JobTarget a job target, for example a specific database or a container of databases that is evaluated 6802// during job execution. 6803type JobTarget struct { 6804 // MembershipType - Whether the target is included or excluded from the group. Possible values include: 'Include', 'Exclude' 6805 MembershipType JobTargetGroupMembershipType `json:"membershipType,omitempty"` 6806 // Type - The target type. Possible values include: 'JobTargetTypeTargetGroup', 'JobTargetTypeSQLDatabase', 'JobTargetTypeSQLElasticPool', 'JobTargetTypeSQLShardMap', 'JobTargetTypeSQLServer' 6807 Type JobTargetType `json:"type,omitempty"` 6808 // ServerName - The target server name. 6809 ServerName *string `json:"serverName,omitempty"` 6810 // DatabaseName - The target database name. 6811 DatabaseName *string `json:"databaseName,omitempty"` 6812 // ElasticPoolName - The target elastic pool name. 6813 ElasticPoolName *string `json:"elasticPoolName,omitempty"` 6814 // ShardMapName - The target shard map. 6815 ShardMapName *string `json:"shardMapName,omitempty"` 6816 // RefreshCredential - The resource ID of the credential that is used during job execution to connect to the target and determine the list of databases inside the target. 6817 RefreshCredential *string `json:"refreshCredential,omitempty"` 6818} 6819 6820// JobTargetGroup a group of job targets. 6821type JobTargetGroup struct { 6822 autorest.Response `json:"-"` 6823 // JobTargetGroupProperties - Resource properties. 6824 *JobTargetGroupProperties `json:"properties,omitempty"` 6825 // ID - READ-ONLY; Resource ID. 6826 ID *string `json:"id,omitempty"` 6827 // Name - READ-ONLY; Resource name. 6828 Name *string `json:"name,omitempty"` 6829 // Type - READ-ONLY; Resource type. 6830 Type *string `json:"type,omitempty"` 6831} 6832 6833// MarshalJSON is the custom marshaler for JobTargetGroup. 6834func (jtg JobTargetGroup) MarshalJSON() ([]byte, error) { 6835 objectMap := make(map[string]interface{}) 6836 if jtg.JobTargetGroupProperties != nil { 6837 objectMap["properties"] = jtg.JobTargetGroupProperties 6838 } 6839 return json.Marshal(objectMap) 6840} 6841 6842// UnmarshalJSON is the custom unmarshaler for JobTargetGroup struct. 6843func (jtg *JobTargetGroup) UnmarshalJSON(body []byte) error { 6844 var m map[string]*json.RawMessage 6845 err := json.Unmarshal(body, &m) 6846 if err != nil { 6847 return err 6848 } 6849 for k, v := range m { 6850 switch k { 6851 case "properties": 6852 if v != nil { 6853 var jobTargetGroupProperties JobTargetGroupProperties 6854 err = json.Unmarshal(*v, &jobTargetGroupProperties) 6855 if err != nil { 6856 return err 6857 } 6858 jtg.JobTargetGroupProperties = &jobTargetGroupProperties 6859 } 6860 case "id": 6861 if v != nil { 6862 var ID string 6863 err = json.Unmarshal(*v, &ID) 6864 if err != nil { 6865 return err 6866 } 6867 jtg.ID = &ID 6868 } 6869 case "name": 6870 if v != nil { 6871 var name string 6872 err = json.Unmarshal(*v, &name) 6873 if err != nil { 6874 return err 6875 } 6876 jtg.Name = &name 6877 } 6878 case "type": 6879 if v != nil { 6880 var typeVar string 6881 err = json.Unmarshal(*v, &typeVar) 6882 if err != nil { 6883 return err 6884 } 6885 jtg.Type = &typeVar 6886 } 6887 } 6888 } 6889 6890 return nil 6891} 6892 6893// JobTargetGroupListResult a list of target groups. 6894type JobTargetGroupListResult struct { 6895 autorest.Response `json:"-"` 6896 // Value - READ-ONLY; Array of results. 6897 Value *[]JobTargetGroup `json:"value,omitempty"` 6898 // NextLink - READ-ONLY; Link to retrieve next page of results. 6899 NextLink *string `json:"nextLink,omitempty"` 6900} 6901 6902// MarshalJSON is the custom marshaler for JobTargetGroupListResult. 6903func (jtglr JobTargetGroupListResult) MarshalJSON() ([]byte, error) { 6904 objectMap := make(map[string]interface{}) 6905 return json.Marshal(objectMap) 6906} 6907 6908// JobTargetGroupListResultIterator provides access to a complete listing of JobTargetGroup values. 6909type JobTargetGroupListResultIterator struct { 6910 i int 6911 page JobTargetGroupListResultPage 6912} 6913 6914// NextWithContext advances to the next value. If there was an error making 6915// the request the iterator does not advance and the error is returned. 6916func (iter *JobTargetGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { 6917 if tracing.IsEnabled() { 6918 ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupListResultIterator.NextWithContext") 6919 defer func() { 6920 sc := -1 6921 if iter.Response().Response.Response != nil { 6922 sc = iter.Response().Response.Response.StatusCode 6923 } 6924 tracing.EndSpan(ctx, sc, err) 6925 }() 6926 } 6927 iter.i++ 6928 if iter.i < len(iter.page.Values()) { 6929 return nil 6930 } 6931 err = iter.page.NextWithContext(ctx) 6932 if err != nil { 6933 iter.i-- 6934 return err 6935 } 6936 iter.i = 0 6937 return nil 6938} 6939 6940// Next advances to the next value. If there was an error making 6941// the request the iterator does not advance and the error is returned. 6942// Deprecated: Use NextWithContext() instead. 6943func (iter *JobTargetGroupListResultIterator) Next() error { 6944 return iter.NextWithContext(context.Background()) 6945} 6946 6947// NotDone returns true if the enumeration should be started or is not yet complete. 6948func (iter JobTargetGroupListResultIterator) NotDone() bool { 6949 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 6950} 6951 6952// Response returns the raw server response from the last page request. 6953func (iter JobTargetGroupListResultIterator) Response() JobTargetGroupListResult { 6954 return iter.page.Response() 6955} 6956 6957// Value returns the current value or a zero-initialized value if the 6958// iterator has advanced beyond the end of the collection. 6959func (iter JobTargetGroupListResultIterator) Value() JobTargetGroup { 6960 if !iter.page.NotDone() { 6961 return JobTargetGroup{} 6962 } 6963 return iter.page.Values()[iter.i] 6964} 6965 6966// Creates a new instance of the JobTargetGroupListResultIterator type. 6967func NewJobTargetGroupListResultIterator(page JobTargetGroupListResultPage) JobTargetGroupListResultIterator { 6968 return JobTargetGroupListResultIterator{page: page} 6969} 6970 6971// IsEmpty returns true if the ListResult contains no values. 6972func (jtglr JobTargetGroupListResult) IsEmpty() bool { 6973 return jtglr.Value == nil || len(*jtglr.Value) == 0 6974} 6975 6976// hasNextLink returns true if the NextLink is not empty. 6977func (jtglr JobTargetGroupListResult) hasNextLink() bool { 6978 return jtglr.NextLink != nil && len(*jtglr.NextLink) != 0 6979} 6980 6981// jobTargetGroupListResultPreparer prepares a request to retrieve the next set of results. 6982// It returns nil if no more results exist. 6983func (jtglr JobTargetGroupListResult) jobTargetGroupListResultPreparer(ctx context.Context) (*http.Request, error) { 6984 if !jtglr.hasNextLink() { 6985 return nil, nil 6986 } 6987 return autorest.Prepare((&http.Request{}).WithContext(ctx), 6988 autorest.AsJSON(), 6989 autorest.AsGet(), 6990 autorest.WithBaseURL(to.String(jtglr.NextLink))) 6991} 6992 6993// JobTargetGroupListResultPage contains a page of JobTargetGroup values. 6994type JobTargetGroupListResultPage struct { 6995 fn func(context.Context, JobTargetGroupListResult) (JobTargetGroupListResult, error) 6996 jtglr JobTargetGroupListResult 6997} 6998 6999// NextWithContext advances to the next page of values. If there was an error making 7000// the request the page does not advance and the error is returned. 7001func (page *JobTargetGroupListResultPage) NextWithContext(ctx context.Context) (err error) { 7002 if tracing.IsEnabled() { 7003 ctx = tracing.StartSpan(ctx, fqdn+"/JobTargetGroupListResultPage.NextWithContext") 7004 defer func() { 7005 sc := -1 7006 if page.Response().Response.Response != nil { 7007 sc = page.Response().Response.Response.StatusCode 7008 } 7009 tracing.EndSpan(ctx, sc, err) 7010 }() 7011 } 7012 for { 7013 next, err := page.fn(ctx, page.jtglr) 7014 if err != nil { 7015 return err 7016 } 7017 page.jtglr = next 7018 if !next.hasNextLink() || !next.IsEmpty() { 7019 break 7020 } 7021 } 7022 return nil 7023} 7024 7025// Next advances to the next page of values. If there was an error making 7026// the request the page does not advance and the error is returned. 7027// Deprecated: Use NextWithContext() instead. 7028func (page *JobTargetGroupListResultPage) Next() error { 7029 return page.NextWithContext(context.Background()) 7030} 7031 7032// NotDone returns true if the page enumeration should be started or is not yet complete. 7033func (page JobTargetGroupListResultPage) NotDone() bool { 7034 return !page.jtglr.IsEmpty() 7035} 7036 7037// Response returns the raw server response from the last page request. 7038func (page JobTargetGroupListResultPage) Response() JobTargetGroupListResult { 7039 return page.jtglr 7040} 7041 7042// Values returns the slice of values for the current page or nil if there are no values. 7043func (page JobTargetGroupListResultPage) Values() []JobTargetGroup { 7044 if page.jtglr.IsEmpty() { 7045 return nil 7046 } 7047 return *page.jtglr.Value 7048} 7049 7050// Creates a new instance of the JobTargetGroupListResultPage type. 7051func NewJobTargetGroupListResultPage(cur JobTargetGroupListResult, getNextPage func(context.Context, JobTargetGroupListResult) (JobTargetGroupListResult, error)) JobTargetGroupListResultPage { 7052 return JobTargetGroupListResultPage{ 7053 fn: getNextPage, 7054 jtglr: cur, 7055 } 7056} 7057 7058// JobTargetGroupProperties properties of job target group. 7059type JobTargetGroupProperties struct { 7060 // Members - Members of the target group. 7061 Members *[]JobTarget `json:"members,omitempty"` 7062} 7063 7064// JobVersion a job version. 7065type JobVersion struct { 7066 autorest.Response `json:"-"` 7067 // ID - READ-ONLY; Resource ID. 7068 ID *string `json:"id,omitempty"` 7069 // Name - READ-ONLY; Resource name. 7070 Name *string `json:"name,omitempty"` 7071 // Type - READ-ONLY; Resource type. 7072 Type *string `json:"type,omitempty"` 7073} 7074 7075// MarshalJSON is the custom marshaler for JobVersion. 7076func (jv JobVersion) MarshalJSON() ([]byte, error) { 7077 objectMap := make(map[string]interface{}) 7078 return json.Marshal(objectMap) 7079} 7080 7081// JobVersionListResult a list of job versions. 7082type JobVersionListResult struct { 7083 autorest.Response `json:"-"` 7084 // Value - READ-ONLY; Array of results. 7085 Value *[]JobVersion `json:"value,omitempty"` 7086 // NextLink - READ-ONLY; Link to retrieve next page of results. 7087 NextLink *string `json:"nextLink,omitempty"` 7088} 7089 7090// MarshalJSON is the custom marshaler for JobVersionListResult. 7091func (jvlr JobVersionListResult) MarshalJSON() ([]byte, error) { 7092 objectMap := make(map[string]interface{}) 7093 return json.Marshal(objectMap) 7094} 7095 7096// JobVersionListResultIterator provides access to a complete listing of JobVersion values. 7097type JobVersionListResultIterator struct { 7098 i int 7099 page JobVersionListResultPage 7100} 7101 7102// NextWithContext advances to the next value. If there was an error making 7103// the request the iterator does not advance and the error is returned. 7104func (iter *JobVersionListResultIterator) NextWithContext(ctx context.Context) (err error) { 7105 if tracing.IsEnabled() { 7106 ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionListResultIterator.NextWithContext") 7107 defer func() { 7108 sc := -1 7109 if iter.Response().Response.Response != nil { 7110 sc = iter.Response().Response.Response.StatusCode 7111 } 7112 tracing.EndSpan(ctx, sc, err) 7113 }() 7114 } 7115 iter.i++ 7116 if iter.i < len(iter.page.Values()) { 7117 return nil 7118 } 7119 err = iter.page.NextWithContext(ctx) 7120 if err != nil { 7121 iter.i-- 7122 return err 7123 } 7124 iter.i = 0 7125 return nil 7126} 7127 7128// Next advances to the next value. If there was an error making 7129// the request the iterator does not advance and the error is returned. 7130// Deprecated: Use NextWithContext() instead. 7131func (iter *JobVersionListResultIterator) Next() error { 7132 return iter.NextWithContext(context.Background()) 7133} 7134 7135// NotDone returns true if the enumeration should be started or is not yet complete. 7136func (iter JobVersionListResultIterator) NotDone() bool { 7137 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 7138} 7139 7140// Response returns the raw server response from the last page request. 7141func (iter JobVersionListResultIterator) Response() JobVersionListResult { 7142 return iter.page.Response() 7143} 7144 7145// Value returns the current value or a zero-initialized value if the 7146// iterator has advanced beyond the end of the collection. 7147func (iter JobVersionListResultIterator) Value() JobVersion { 7148 if !iter.page.NotDone() { 7149 return JobVersion{} 7150 } 7151 return iter.page.Values()[iter.i] 7152} 7153 7154// Creates a new instance of the JobVersionListResultIterator type. 7155func NewJobVersionListResultIterator(page JobVersionListResultPage) JobVersionListResultIterator { 7156 return JobVersionListResultIterator{page: page} 7157} 7158 7159// IsEmpty returns true if the ListResult contains no values. 7160func (jvlr JobVersionListResult) IsEmpty() bool { 7161 return jvlr.Value == nil || len(*jvlr.Value) == 0 7162} 7163 7164// hasNextLink returns true if the NextLink is not empty. 7165func (jvlr JobVersionListResult) hasNextLink() bool { 7166 return jvlr.NextLink != nil && len(*jvlr.NextLink) != 0 7167} 7168 7169// jobVersionListResultPreparer prepares a request to retrieve the next set of results. 7170// It returns nil if no more results exist. 7171func (jvlr JobVersionListResult) jobVersionListResultPreparer(ctx context.Context) (*http.Request, error) { 7172 if !jvlr.hasNextLink() { 7173 return nil, nil 7174 } 7175 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7176 autorest.AsJSON(), 7177 autorest.AsGet(), 7178 autorest.WithBaseURL(to.String(jvlr.NextLink))) 7179} 7180 7181// JobVersionListResultPage contains a page of JobVersion values. 7182type JobVersionListResultPage struct { 7183 fn func(context.Context, JobVersionListResult) (JobVersionListResult, error) 7184 jvlr JobVersionListResult 7185} 7186 7187// NextWithContext advances to the next page of values. If there was an error making 7188// the request the page does not advance and the error is returned. 7189func (page *JobVersionListResultPage) NextWithContext(ctx context.Context) (err error) { 7190 if tracing.IsEnabled() { 7191 ctx = tracing.StartSpan(ctx, fqdn+"/JobVersionListResultPage.NextWithContext") 7192 defer func() { 7193 sc := -1 7194 if page.Response().Response.Response != nil { 7195 sc = page.Response().Response.Response.StatusCode 7196 } 7197 tracing.EndSpan(ctx, sc, err) 7198 }() 7199 } 7200 for { 7201 next, err := page.fn(ctx, page.jvlr) 7202 if err != nil { 7203 return err 7204 } 7205 page.jvlr = next 7206 if !next.hasNextLink() || !next.IsEmpty() { 7207 break 7208 } 7209 } 7210 return nil 7211} 7212 7213// Next advances to the next page of values. If there was an error making 7214// the request the page does not advance and the error is returned. 7215// Deprecated: Use NextWithContext() instead. 7216func (page *JobVersionListResultPage) Next() error { 7217 return page.NextWithContext(context.Background()) 7218} 7219 7220// NotDone returns true if the page enumeration should be started or is not yet complete. 7221func (page JobVersionListResultPage) NotDone() bool { 7222 return !page.jvlr.IsEmpty() 7223} 7224 7225// Response returns the raw server response from the last page request. 7226func (page JobVersionListResultPage) Response() JobVersionListResult { 7227 return page.jvlr 7228} 7229 7230// Values returns the slice of values for the current page or nil if there are no values. 7231func (page JobVersionListResultPage) Values() []JobVersion { 7232 if page.jvlr.IsEmpty() { 7233 return nil 7234 } 7235 return *page.jvlr.Value 7236} 7237 7238// Creates a new instance of the JobVersionListResultPage type. 7239func NewJobVersionListResultPage(cur JobVersionListResult, getNextPage func(context.Context, JobVersionListResult) (JobVersionListResult, error)) JobVersionListResultPage { 7240 return JobVersionListResultPage{ 7241 fn: getNextPage, 7242 jvlr: cur, 7243 } 7244} 7245 7246// LocationCapabilities the capabilities for a location. 7247type LocationCapabilities struct { 7248 autorest.Response `json:"-"` 7249 // Name - READ-ONLY; The location name. 7250 Name *string `json:"name,omitempty"` 7251 // Status - READ-ONLY; Azure SQL Database's status for the location. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' 7252 Status CapabilityStatus `json:"status,omitempty"` 7253 // SupportedServerVersions - READ-ONLY; The list of supported server versions. 7254 SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` 7255} 7256 7257// MarshalJSON is the custom marshaler for LocationCapabilities. 7258func (lc LocationCapabilities) MarshalJSON() ([]byte, error) { 7259 objectMap := make(map[string]interface{}) 7260 return json.Marshal(objectMap) 7261} 7262 7263// LogicalServerSecurityAlertPolicyListResult a list of the server's security alert policies. 7264type LogicalServerSecurityAlertPolicyListResult struct { 7265 autorest.Response `json:"-"` 7266 // Value - READ-ONLY; Array of results. 7267 Value *[]ServerSecurityAlertPolicy `json:"value,omitempty"` 7268 // NextLink - READ-ONLY; Link to retrieve next page of results. 7269 NextLink *string `json:"nextLink,omitempty"` 7270} 7271 7272// MarshalJSON is the custom marshaler for LogicalServerSecurityAlertPolicyListResult. 7273func (lssaplr LogicalServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { 7274 objectMap := make(map[string]interface{}) 7275 return json.Marshal(objectMap) 7276} 7277 7278// LogicalServerSecurityAlertPolicyListResultIterator provides access to a complete listing of 7279// ServerSecurityAlertPolicy values. 7280type LogicalServerSecurityAlertPolicyListResultIterator struct { 7281 i int 7282 page LogicalServerSecurityAlertPolicyListResultPage 7283} 7284 7285// NextWithContext advances to the next value. If there was an error making 7286// the request the iterator does not advance and the error is returned. 7287func (iter *LogicalServerSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { 7288 if tracing.IsEnabled() { 7289 ctx = tracing.StartSpan(ctx, fqdn+"/LogicalServerSecurityAlertPolicyListResultIterator.NextWithContext") 7290 defer func() { 7291 sc := -1 7292 if iter.Response().Response.Response != nil { 7293 sc = iter.Response().Response.Response.StatusCode 7294 } 7295 tracing.EndSpan(ctx, sc, err) 7296 }() 7297 } 7298 iter.i++ 7299 if iter.i < len(iter.page.Values()) { 7300 return nil 7301 } 7302 err = iter.page.NextWithContext(ctx) 7303 if err != nil { 7304 iter.i-- 7305 return err 7306 } 7307 iter.i = 0 7308 return nil 7309} 7310 7311// Next advances to the next value. If there was an error making 7312// the request the iterator does not advance and the error is returned. 7313// Deprecated: Use NextWithContext() instead. 7314func (iter *LogicalServerSecurityAlertPolicyListResultIterator) Next() error { 7315 return iter.NextWithContext(context.Background()) 7316} 7317 7318// NotDone returns true if the enumeration should be started or is not yet complete. 7319func (iter LogicalServerSecurityAlertPolicyListResultIterator) NotDone() bool { 7320 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 7321} 7322 7323// Response returns the raw server response from the last page request. 7324func (iter LogicalServerSecurityAlertPolicyListResultIterator) Response() LogicalServerSecurityAlertPolicyListResult { 7325 return iter.page.Response() 7326} 7327 7328// Value returns the current value or a zero-initialized value if the 7329// iterator has advanced beyond the end of the collection. 7330func (iter LogicalServerSecurityAlertPolicyListResultIterator) Value() ServerSecurityAlertPolicy { 7331 if !iter.page.NotDone() { 7332 return ServerSecurityAlertPolicy{} 7333 } 7334 return iter.page.Values()[iter.i] 7335} 7336 7337// Creates a new instance of the LogicalServerSecurityAlertPolicyListResultIterator type. 7338func NewLogicalServerSecurityAlertPolicyListResultIterator(page LogicalServerSecurityAlertPolicyListResultPage) LogicalServerSecurityAlertPolicyListResultIterator { 7339 return LogicalServerSecurityAlertPolicyListResultIterator{page: page} 7340} 7341 7342// IsEmpty returns true if the ListResult contains no values. 7343func (lssaplr LogicalServerSecurityAlertPolicyListResult) IsEmpty() bool { 7344 return lssaplr.Value == nil || len(*lssaplr.Value) == 0 7345} 7346 7347// hasNextLink returns true if the NextLink is not empty. 7348func (lssaplr LogicalServerSecurityAlertPolicyListResult) hasNextLink() bool { 7349 return lssaplr.NextLink != nil && len(*lssaplr.NextLink) != 0 7350} 7351 7352// logicalServerSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. 7353// It returns nil if no more results exist. 7354func (lssaplr LogicalServerSecurityAlertPolicyListResult) logicalServerSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { 7355 if !lssaplr.hasNextLink() { 7356 return nil, nil 7357 } 7358 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7359 autorest.AsJSON(), 7360 autorest.AsGet(), 7361 autorest.WithBaseURL(to.String(lssaplr.NextLink))) 7362} 7363 7364// LogicalServerSecurityAlertPolicyListResultPage contains a page of ServerSecurityAlertPolicy values. 7365type LogicalServerSecurityAlertPolicyListResultPage struct { 7366 fn func(context.Context, LogicalServerSecurityAlertPolicyListResult) (LogicalServerSecurityAlertPolicyListResult, error) 7367 lssaplr LogicalServerSecurityAlertPolicyListResult 7368} 7369 7370// NextWithContext advances to the next page of values. If there was an error making 7371// the request the page does not advance and the error is returned. 7372func (page *LogicalServerSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { 7373 if tracing.IsEnabled() { 7374 ctx = tracing.StartSpan(ctx, fqdn+"/LogicalServerSecurityAlertPolicyListResultPage.NextWithContext") 7375 defer func() { 7376 sc := -1 7377 if page.Response().Response.Response != nil { 7378 sc = page.Response().Response.Response.StatusCode 7379 } 7380 tracing.EndSpan(ctx, sc, err) 7381 }() 7382 } 7383 for { 7384 next, err := page.fn(ctx, page.lssaplr) 7385 if err != nil { 7386 return err 7387 } 7388 page.lssaplr = next 7389 if !next.hasNextLink() || !next.IsEmpty() { 7390 break 7391 } 7392 } 7393 return nil 7394} 7395 7396// Next advances to the next page of values. If there was an error making 7397// the request the page does not advance and the error is returned. 7398// Deprecated: Use NextWithContext() instead. 7399func (page *LogicalServerSecurityAlertPolicyListResultPage) Next() error { 7400 return page.NextWithContext(context.Background()) 7401} 7402 7403// NotDone returns true if the page enumeration should be started or is not yet complete. 7404func (page LogicalServerSecurityAlertPolicyListResultPage) NotDone() bool { 7405 return !page.lssaplr.IsEmpty() 7406} 7407 7408// Response returns the raw server response from the last page request. 7409func (page LogicalServerSecurityAlertPolicyListResultPage) Response() LogicalServerSecurityAlertPolicyListResult { 7410 return page.lssaplr 7411} 7412 7413// Values returns the slice of values for the current page or nil if there are no values. 7414func (page LogicalServerSecurityAlertPolicyListResultPage) Values() []ServerSecurityAlertPolicy { 7415 if page.lssaplr.IsEmpty() { 7416 return nil 7417 } 7418 return *page.lssaplr.Value 7419} 7420 7421// Creates a new instance of the LogicalServerSecurityAlertPolicyListResultPage type. 7422func NewLogicalServerSecurityAlertPolicyListResultPage(cur LogicalServerSecurityAlertPolicyListResult, getNextPage func(context.Context, LogicalServerSecurityAlertPolicyListResult) (LogicalServerSecurityAlertPolicyListResult, error)) LogicalServerSecurityAlertPolicyListResultPage { 7423 return LogicalServerSecurityAlertPolicyListResultPage{ 7424 fn: getNextPage, 7425 lssaplr: cur, 7426 } 7427} 7428 7429// ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving 7430// the results of a long-running operation. 7431type ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture struct { 7432 azure.FutureAPI 7433 // Result returns the result of the asynchronous operation. 7434 // If the operation has not completed it will return an error. 7435 Result func(ManagedBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) 7436} 7437 7438// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7439func (future *ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 7440 var azFuture azure.Future 7441 if err := json.Unmarshal(body, &azFuture); err != nil { 7442 return err 7443 } 7444 future.FutureAPI = &azFuture 7445 future.Result = future.result 7446 return nil 7447} 7448 7449// result is the default implementation for ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture.Result. 7450func (future *ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture) result(client ManagedBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { 7451 var done bool 7452 done, err = future.DoneWithContext(context.Background(), client) 7453 if err != nil { 7454 err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 7455 return 7456 } 7457 if !done { 7458 mbstrp.Response.Response = future.Response() 7459 err = azure.NewAsyncOpIncompleteError("sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture") 7460 return 7461 } 7462 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7463 if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { 7464 mbstrp, err = client.CreateOrUpdateResponder(mbstrp.Response.Response) 7465 if err != nil { 7466 err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesCreateOrUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") 7467 } 7468 } 7469 return 7470} 7471 7472// ManagedBackupShortTermRetentionPoliciesUpdateFuture an abstraction for monitoring and retrieving the 7473// results of a long-running operation. 7474type ManagedBackupShortTermRetentionPoliciesUpdateFuture struct { 7475 azure.FutureAPI 7476 // Result returns the result of the asynchronous operation. 7477 // If the operation has not completed it will return an error. 7478 Result func(ManagedBackupShortTermRetentionPoliciesClient) (ManagedBackupShortTermRetentionPolicy, error) 7479} 7480 7481// UnmarshalJSON is the custom unmarshaller for CreateFuture. 7482func (future *ManagedBackupShortTermRetentionPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { 7483 var azFuture azure.Future 7484 if err := json.Unmarshal(body, &azFuture); err != nil { 7485 return err 7486 } 7487 future.FutureAPI = &azFuture 7488 future.Result = future.result 7489 return nil 7490} 7491 7492// result is the default implementation for ManagedBackupShortTermRetentionPoliciesUpdateFuture.Result. 7493func (future *ManagedBackupShortTermRetentionPoliciesUpdateFuture) result(client ManagedBackupShortTermRetentionPoliciesClient) (mbstrp ManagedBackupShortTermRetentionPolicy, err error) { 7494 var done bool 7495 done, err = future.DoneWithContext(context.Background(), client) 7496 if err != nil { 7497 err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") 7498 return 7499 } 7500 if !done { 7501 mbstrp.Response.Response = future.Response() 7502 err = azure.NewAsyncOpIncompleteError("sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture") 7503 return 7504 } 7505 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 7506 if mbstrp.Response.Response, err = future.GetResult(sender); err == nil && mbstrp.Response.Response.StatusCode != http.StatusNoContent { 7507 mbstrp, err = client.UpdateResponder(mbstrp.Response.Response) 7508 if err != nil { 7509 err = autorest.NewErrorWithError(err, "sql.ManagedBackupShortTermRetentionPoliciesUpdateFuture", "Result", mbstrp.Response.Response, "Failure responding to request") 7510 } 7511 } 7512 return 7513} 7514 7515// ManagedBackupShortTermRetentionPolicy a short term retention policy. 7516type ManagedBackupShortTermRetentionPolicy struct { 7517 autorest.Response `json:"-"` 7518 // ManagedBackupShortTermRetentionPolicyProperties - Resource properties. 7519 *ManagedBackupShortTermRetentionPolicyProperties `json:"properties,omitempty"` 7520 // ID - READ-ONLY; Resource ID. 7521 ID *string `json:"id,omitempty"` 7522 // Name - READ-ONLY; Resource name. 7523 Name *string `json:"name,omitempty"` 7524 // Type - READ-ONLY; Resource type. 7525 Type *string `json:"type,omitempty"` 7526} 7527 7528// MarshalJSON is the custom marshaler for ManagedBackupShortTermRetentionPolicy. 7529func (mbstrp ManagedBackupShortTermRetentionPolicy) MarshalJSON() ([]byte, error) { 7530 objectMap := make(map[string]interface{}) 7531 if mbstrp.ManagedBackupShortTermRetentionPolicyProperties != nil { 7532 objectMap["properties"] = mbstrp.ManagedBackupShortTermRetentionPolicyProperties 7533 } 7534 return json.Marshal(objectMap) 7535} 7536 7537// UnmarshalJSON is the custom unmarshaler for ManagedBackupShortTermRetentionPolicy struct. 7538func (mbstrp *ManagedBackupShortTermRetentionPolicy) UnmarshalJSON(body []byte) error { 7539 var m map[string]*json.RawMessage 7540 err := json.Unmarshal(body, &m) 7541 if err != nil { 7542 return err 7543 } 7544 for k, v := range m { 7545 switch k { 7546 case "properties": 7547 if v != nil { 7548 var managedBackupShortTermRetentionPolicyProperties ManagedBackupShortTermRetentionPolicyProperties 7549 err = json.Unmarshal(*v, &managedBackupShortTermRetentionPolicyProperties) 7550 if err != nil { 7551 return err 7552 } 7553 mbstrp.ManagedBackupShortTermRetentionPolicyProperties = &managedBackupShortTermRetentionPolicyProperties 7554 } 7555 case "id": 7556 if v != nil { 7557 var ID string 7558 err = json.Unmarshal(*v, &ID) 7559 if err != nil { 7560 return err 7561 } 7562 mbstrp.ID = &ID 7563 } 7564 case "name": 7565 if v != nil { 7566 var name string 7567 err = json.Unmarshal(*v, &name) 7568 if err != nil { 7569 return err 7570 } 7571 mbstrp.Name = &name 7572 } 7573 case "type": 7574 if v != nil { 7575 var typeVar string 7576 err = json.Unmarshal(*v, &typeVar) 7577 if err != nil { 7578 return err 7579 } 7580 mbstrp.Type = &typeVar 7581 } 7582 } 7583 } 7584 7585 return nil 7586} 7587 7588// ManagedBackupShortTermRetentionPolicyListResult a list of short term retention policies. 7589type ManagedBackupShortTermRetentionPolicyListResult struct { 7590 autorest.Response `json:"-"` 7591 // Value - READ-ONLY; Array of results. 7592 Value *[]ManagedBackupShortTermRetentionPolicy `json:"value,omitempty"` 7593 // NextLink - READ-ONLY; Link to retrieve next page of results. 7594 NextLink *string `json:"nextLink,omitempty"` 7595} 7596 7597// MarshalJSON is the custom marshaler for ManagedBackupShortTermRetentionPolicyListResult. 7598func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) MarshalJSON() ([]byte, error) { 7599 objectMap := make(map[string]interface{}) 7600 return json.Marshal(objectMap) 7601} 7602 7603// ManagedBackupShortTermRetentionPolicyListResultIterator provides access to a complete listing of 7604// ManagedBackupShortTermRetentionPolicy values. 7605type ManagedBackupShortTermRetentionPolicyListResultIterator struct { 7606 i int 7607 page ManagedBackupShortTermRetentionPolicyListResultPage 7608} 7609 7610// NextWithContext advances to the next value. If there was an error making 7611// the request the iterator does not advance and the error is returned. 7612func (iter *ManagedBackupShortTermRetentionPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { 7613 if tracing.IsEnabled() { 7614 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPolicyListResultIterator.NextWithContext") 7615 defer func() { 7616 sc := -1 7617 if iter.Response().Response.Response != nil { 7618 sc = iter.Response().Response.Response.StatusCode 7619 } 7620 tracing.EndSpan(ctx, sc, err) 7621 }() 7622 } 7623 iter.i++ 7624 if iter.i < len(iter.page.Values()) { 7625 return nil 7626 } 7627 err = iter.page.NextWithContext(ctx) 7628 if err != nil { 7629 iter.i-- 7630 return err 7631 } 7632 iter.i = 0 7633 return nil 7634} 7635 7636// Next advances to the next value. If there was an error making 7637// the request the iterator does not advance and the error is returned. 7638// Deprecated: Use NextWithContext() instead. 7639func (iter *ManagedBackupShortTermRetentionPolicyListResultIterator) Next() error { 7640 return iter.NextWithContext(context.Background()) 7641} 7642 7643// NotDone returns true if the enumeration should be started or is not yet complete. 7644func (iter ManagedBackupShortTermRetentionPolicyListResultIterator) NotDone() bool { 7645 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 7646} 7647 7648// Response returns the raw server response from the last page request. 7649func (iter ManagedBackupShortTermRetentionPolicyListResultIterator) Response() ManagedBackupShortTermRetentionPolicyListResult { 7650 return iter.page.Response() 7651} 7652 7653// Value returns the current value or a zero-initialized value if the 7654// iterator has advanced beyond the end of the collection. 7655func (iter ManagedBackupShortTermRetentionPolicyListResultIterator) Value() ManagedBackupShortTermRetentionPolicy { 7656 if !iter.page.NotDone() { 7657 return ManagedBackupShortTermRetentionPolicy{} 7658 } 7659 return iter.page.Values()[iter.i] 7660} 7661 7662// Creates a new instance of the ManagedBackupShortTermRetentionPolicyListResultIterator type. 7663func NewManagedBackupShortTermRetentionPolicyListResultIterator(page ManagedBackupShortTermRetentionPolicyListResultPage) ManagedBackupShortTermRetentionPolicyListResultIterator { 7664 return ManagedBackupShortTermRetentionPolicyListResultIterator{page: page} 7665} 7666 7667// IsEmpty returns true if the ListResult contains no values. 7668func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) IsEmpty() bool { 7669 return mbstrplr.Value == nil || len(*mbstrplr.Value) == 0 7670} 7671 7672// hasNextLink returns true if the NextLink is not empty. 7673func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) hasNextLink() bool { 7674 return mbstrplr.NextLink != nil && len(*mbstrplr.NextLink) != 0 7675} 7676 7677// managedBackupShortTermRetentionPolicyListResultPreparer prepares a request to retrieve the next set of results. 7678// It returns nil if no more results exist. 7679func (mbstrplr ManagedBackupShortTermRetentionPolicyListResult) managedBackupShortTermRetentionPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { 7680 if !mbstrplr.hasNextLink() { 7681 return nil, nil 7682 } 7683 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7684 autorest.AsJSON(), 7685 autorest.AsGet(), 7686 autorest.WithBaseURL(to.String(mbstrplr.NextLink))) 7687} 7688 7689// ManagedBackupShortTermRetentionPolicyListResultPage contains a page of 7690// ManagedBackupShortTermRetentionPolicy values. 7691type ManagedBackupShortTermRetentionPolicyListResultPage struct { 7692 fn func(context.Context, ManagedBackupShortTermRetentionPolicyListResult) (ManagedBackupShortTermRetentionPolicyListResult, error) 7693 mbstrplr ManagedBackupShortTermRetentionPolicyListResult 7694} 7695 7696// NextWithContext advances to the next page of values. If there was an error making 7697// the request the page does not advance and the error is returned. 7698func (page *ManagedBackupShortTermRetentionPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { 7699 if tracing.IsEnabled() { 7700 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedBackupShortTermRetentionPolicyListResultPage.NextWithContext") 7701 defer func() { 7702 sc := -1 7703 if page.Response().Response.Response != nil { 7704 sc = page.Response().Response.Response.StatusCode 7705 } 7706 tracing.EndSpan(ctx, sc, err) 7707 }() 7708 } 7709 for { 7710 next, err := page.fn(ctx, page.mbstrplr) 7711 if err != nil { 7712 return err 7713 } 7714 page.mbstrplr = next 7715 if !next.hasNextLink() || !next.IsEmpty() { 7716 break 7717 } 7718 } 7719 return nil 7720} 7721 7722// Next advances to the next page of values. If there was an error making 7723// the request the page does not advance and the error is returned. 7724// Deprecated: Use NextWithContext() instead. 7725func (page *ManagedBackupShortTermRetentionPolicyListResultPage) Next() error { 7726 return page.NextWithContext(context.Background()) 7727} 7728 7729// NotDone returns true if the page enumeration should be started or is not yet complete. 7730func (page ManagedBackupShortTermRetentionPolicyListResultPage) NotDone() bool { 7731 return !page.mbstrplr.IsEmpty() 7732} 7733 7734// Response returns the raw server response from the last page request. 7735func (page ManagedBackupShortTermRetentionPolicyListResultPage) Response() ManagedBackupShortTermRetentionPolicyListResult { 7736 return page.mbstrplr 7737} 7738 7739// Values returns the slice of values for the current page or nil if there are no values. 7740func (page ManagedBackupShortTermRetentionPolicyListResultPage) Values() []ManagedBackupShortTermRetentionPolicy { 7741 if page.mbstrplr.IsEmpty() { 7742 return nil 7743 } 7744 return *page.mbstrplr.Value 7745} 7746 7747// Creates a new instance of the ManagedBackupShortTermRetentionPolicyListResultPage type. 7748func NewManagedBackupShortTermRetentionPolicyListResultPage(cur ManagedBackupShortTermRetentionPolicyListResult, getNextPage func(context.Context, ManagedBackupShortTermRetentionPolicyListResult) (ManagedBackupShortTermRetentionPolicyListResult, error)) ManagedBackupShortTermRetentionPolicyListResultPage { 7749 return ManagedBackupShortTermRetentionPolicyListResultPage{ 7750 fn: getNextPage, 7751 mbstrplr: cur, 7752 } 7753} 7754 7755// ManagedBackupShortTermRetentionPolicyProperties properties of a short term retention policy 7756type ManagedBackupShortTermRetentionPolicyProperties struct { 7757 // RetentionDays - The backup retention period in days. This is how many days Point-in-Time Restore will be supported. 7758 RetentionDays *int32 `json:"retentionDays,omitempty"` 7759} 7760 7761// ManagedDatabase a managed database resource. 7762type ManagedDatabase struct { 7763 autorest.Response `json:"-"` 7764 // ManagedDatabaseProperties - Resource properties. 7765 *ManagedDatabaseProperties `json:"properties,omitempty"` 7766 // Location - Resource location. 7767 Location *string `json:"location,omitempty"` 7768 // Tags - Resource tags. 7769 Tags map[string]*string `json:"tags"` 7770 // ID - READ-ONLY; Resource ID. 7771 ID *string `json:"id,omitempty"` 7772 // Name - READ-ONLY; Resource name. 7773 Name *string `json:"name,omitempty"` 7774 // Type - READ-ONLY; Resource type. 7775 Type *string `json:"type,omitempty"` 7776} 7777 7778// MarshalJSON is the custom marshaler for ManagedDatabase. 7779func (md ManagedDatabase) MarshalJSON() ([]byte, error) { 7780 objectMap := make(map[string]interface{}) 7781 if md.ManagedDatabaseProperties != nil { 7782 objectMap["properties"] = md.ManagedDatabaseProperties 7783 } 7784 if md.Location != nil { 7785 objectMap["location"] = md.Location 7786 } 7787 if md.Tags != nil { 7788 objectMap["tags"] = md.Tags 7789 } 7790 return json.Marshal(objectMap) 7791} 7792 7793// UnmarshalJSON is the custom unmarshaler for ManagedDatabase struct. 7794func (md *ManagedDatabase) UnmarshalJSON(body []byte) error { 7795 var m map[string]*json.RawMessage 7796 err := json.Unmarshal(body, &m) 7797 if err != nil { 7798 return err 7799 } 7800 for k, v := range m { 7801 switch k { 7802 case "properties": 7803 if v != nil { 7804 var managedDatabaseProperties ManagedDatabaseProperties 7805 err = json.Unmarshal(*v, &managedDatabaseProperties) 7806 if err != nil { 7807 return err 7808 } 7809 md.ManagedDatabaseProperties = &managedDatabaseProperties 7810 } 7811 case "location": 7812 if v != nil { 7813 var location string 7814 err = json.Unmarshal(*v, &location) 7815 if err != nil { 7816 return err 7817 } 7818 md.Location = &location 7819 } 7820 case "tags": 7821 if v != nil { 7822 var tags map[string]*string 7823 err = json.Unmarshal(*v, &tags) 7824 if err != nil { 7825 return err 7826 } 7827 md.Tags = tags 7828 } 7829 case "id": 7830 if v != nil { 7831 var ID string 7832 err = json.Unmarshal(*v, &ID) 7833 if err != nil { 7834 return err 7835 } 7836 md.ID = &ID 7837 } 7838 case "name": 7839 if v != nil { 7840 var name string 7841 err = json.Unmarshal(*v, &name) 7842 if err != nil { 7843 return err 7844 } 7845 md.Name = &name 7846 } 7847 case "type": 7848 if v != nil { 7849 var typeVar string 7850 err = json.Unmarshal(*v, &typeVar) 7851 if err != nil { 7852 return err 7853 } 7854 md.Type = &typeVar 7855 } 7856 } 7857 } 7858 7859 return nil 7860} 7861 7862// ManagedDatabaseListResult a list of managed databases. 7863type ManagedDatabaseListResult struct { 7864 autorest.Response `json:"-"` 7865 // Value - READ-ONLY; Array of results. 7866 Value *[]ManagedDatabase `json:"value,omitempty"` 7867 // NextLink - READ-ONLY; Link to retrieve next page of results. 7868 NextLink *string `json:"nextLink,omitempty"` 7869} 7870 7871// MarshalJSON is the custom marshaler for ManagedDatabaseListResult. 7872func (mdlr ManagedDatabaseListResult) MarshalJSON() ([]byte, error) { 7873 objectMap := make(map[string]interface{}) 7874 return json.Marshal(objectMap) 7875} 7876 7877// ManagedDatabaseListResultIterator provides access to a complete listing of ManagedDatabase values. 7878type ManagedDatabaseListResultIterator struct { 7879 i int 7880 page ManagedDatabaseListResultPage 7881} 7882 7883// NextWithContext advances to the next value. If there was an error making 7884// the request the iterator does not advance and the error is returned. 7885func (iter *ManagedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { 7886 if tracing.IsEnabled() { 7887 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultIterator.NextWithContext") 7888 defer func() { 7889 sc := -1 7890 if iter.Response().Response.Response != nil { 7891 sc = iter.Response().Response.Response.StatusCode 7892 } 7893 tracing.EndSpan(ctx, sc, err) 7894 }() 7895 } 7896 iter.i++ 7897 if iter.i < len(iter.page.Values()) { 7898 return nil 7899 } 7900 err = iter.page.NextWithContext(ctx) 7901 if err != nil { 7902 iter.i-- 7903 return err 7904 } 7905 iter.i = 0 7906 return nil 7907} 7908 7909// Next advances to the next value. If there was an error making 7910// the request the iterator does not advance and the error is returned. 7911// Deprecated: Use NextWithContext() instead. 7912func (iter *ManagedDatabaseListResultIterator) Next() error { 7913 return iter.NextWithContext(context.Background()) 7914} 7915 7916// NotDone returns true if the enumeration should be started or is not yet complete. 7917func (iter ManagedDatabaseListResultIterator) NotDone() bool { 7918 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 7919} 7920 7921// Response returns the raw server response from the last page request. 7922func (iter ManagedDatabaseListResultIterator) Response() ManagedDatabaseListResult { 7923 return iter.page.Response() 7924} 7925 7926// Value returns the current value or a zero-initialized value if the 7927// iterator has advanced beyond the end of the collection. 7928func (iter ManagedDatabaseListResultIterator) Value() ManagedDatabase { 7929 if !iter.page.NotDone() { 7930 return ManagedDatabase{} 7931 } 7932 return iter.page.Values()[iter.i] 7933} 7934 7935// Creates a new instance of the ManagedDatabaseListResultIterator type. 7936func NewManagedDatabaseListResultIterator(page ManagedDatabaseListResultPage) ManagedDatabaseListResultIterator { 7937 return ManagedDatabaseListResultIterator{page: page} 7938} 7939 7940// IsEmpty returns true if the ListResult contains no values. 7941func (mdlr ManagedDatabaseListResult) IsEmpty() bool { 7942 return mdlr.Value == nil || len(*mdlr.Value) == 0 7943} 7944 7945// hasNextLink returns true if the NextLink is not empty. 7946func (mdlr ManagedDatabaseListResult) hasNextLink() bool { 7947 return mdlr.NextLink != nil && len(*mdlr.NextLink) != 0 7948} 7949 7950// managedDatabaseListResultPreparer prepares a request to retrieve the next set of results. 7951// It returns nil if no more results exist. 7952func (mdlr ManagedDatabaseListResult) managedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { 7953 if !mdlr.hasNextLink() { 7954 return nil, nil 7955 } 7956 return autorest.Prepare((&http.Request{}).WithContext(ctx), 7957 autorest.AsJSON(), 7958 autorest.AsGet(), 7959 autorest.WithBaseURL(to.String(mdlr.NextLink))) 7960} 7961 7962// ManagedDatabaseListResultPage contains a page of ManagedDatabase values. 7963type ManagedDatabaseListResultPage struct { 7964 fn func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error) 7965 mdlr ManagedDatabaseListResult 7966} 7967 7968// NextWithContext advances to the next page of values. If there was an error making 7969// the request the page does not advance and the error is returned. 7970func (page *ManagedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { 7971 if tracing.IsEnabled() { 7972 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedDatabaseListResultPage.NextWithContext") 7973 defer func() { 7974 sc := -1 7975 if page.Response().Response.Response != nil { 7976 sc = page.Response().Response.Response.StatusCode 7977 } 7978 tracing.EndSpan(ctx, sc, err) 7979 }() 7980 } 7981 for { 7982 next, err := page.fn(ctx, page.mdlr) 7983 if err != nil { 7984 return err 7985 } 7986 page.mdlr = next 7987 if !next.hasNextLink() || !next.IsEmpty() { 7988 break 7989 } 7990 } 7991 return nil 7992} 7993 7994// Next advances to the next page of values. If there was an error making 7995// the request the page does not advance and the error is returned. 7996// Deprecated: Use NextWithContext() instead. 7997func (page *ManagedDatabaseListResultPage) Next() error { 7998 return page.NextWithContext(context.Background()) 7999} 8000 8001// NotDone returns true if the page enumeration should be started or is not yet complete. 8002func (page ManagedDatabaseListResultPage) NotDone() bool { 8003 return !page.mdlr.IsEmpty() 8004} 8005 8006// Response returns the raw server response from the last page request. 8007func (page ManagedDatabaseListResultPage) Response() ManagedDatabaseListResult { 8008 return page.mdlr 8009} 8010 8011// Values returns the slice of values for the current page or nil if there are no values. 8012func (page ManagedDatabaseListResultPage) Values() []ManagedDatabase { 8013 if page.mdlr.IsEmpty() { 8014 return nil 8015 } 8016 return *page.mdlr.Value 8017} 8018 8019// Creates a new instance of the ManagedDatabaseListResultPage type. 8020func NewManagedDatabaseListResultPage(cur ManagedDatabaseListResult, getNextPage func(context.Context, ManagedDatabaseListResult) (ManagedDatabaseListResult, error)) ManagedDatabaseListResultPage { 8021 return ManagedDatabaseListResultPage{ 8022 fn: getNextPage, 8023 mdlr: cur, 8024 } 8025} 8026 8027// ManagedDatabaseProperties the managed database's properties. 8028type ManagedDatabaseProperties struct { 8029 // Collation - Collation of the managed database. 8030 Collation *string `json:"collation,omitempty"` 8031 // Status - READ-ONLY; Status of the database. Possible values include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible', 'Restoring', 'Updating' 8032 Status ManagedDatabaseStatus `json:"status,omitempty"` 8033 // CreationDate - READ-ONLY; Creation date of the database. 8034 CreationDate *date.Time `json:"creationDate,omitempty"` 8035 // EarliestRestorePoint - READ-ONLY; Earliest restore point in time for point in time restore. 8036 EarliestRestorePoint *date.Time `json:"earliestRestorePoint,omitempty"` 8037 // RestorePointInTime - Conditional. If createMode is PointInTimeRestore, this value is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. 8038 RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` 8039 // DefaultSecondaryLocation - READ-ONLY; Geo paired region. 8040 DefaultSecondaryLocation *string `json:"defaultSecondaryLocation,omitempty"` 8041 // CatalogCollation - Collation of the metadata catalog. Possible values include: 'DATABASEDEFAULT', 'SQLLatin1GeneralCP1CIAS' 8042 CatalogCollation CatalogCollationType `json:"catalogCollation,omitempty"` 8043 // CreateMode - Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. Possible values include: 'ManagedDatabaseCreateModeDefault', 'ManagedDatabaseCreateModeRestoreExternalBackup', 'ManagedDatabaseCreateModePointInTimeRestore', 'ManagedDatabaseCreateModeRecovery', 'ManagedDatabaseCreateModeRestoreLongTermRetentionBackup' 8044 CreateMode ManagedDatabaseCreateMode `json:"createMode,omitempty"` 8045 // StorageContainerURI - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the uri of the storage container where backups for this restore are stored. 8046 StorageContainerURI *string `json:"storageContainerUri,omitempty"` 8047 // SourceDatabaseID - The resource identifier of the source database associated with create operation of this database. 8048 SourceDatabaseID *string `json:"sourceDatabaseId,omitempty"` 8049 // RestorableDroppedDatabaseID - The restorable dropped database resource id to restore when creating this database. 8050 RestorableDroppedDatabaseID *string `json:"restorableDroppedDatabaseId,omitempty"` 8051 // StorageContainerSasToken - Conditional. If createMode is RestoreExternalBackup, this value is required. Specifies the storage container sas token. 8052 StorageContainerSasToken *string `json:"storageContainerSasToken,omitempty"` 8053 // FailoverGroupID - READ-ONLY; Instance Failover Group resource identifier that this managed database belongs to. 8054 FailoverGroupID *string `json:"failoverGroupId,omitempty"` 8055 // RecoverableDatabaseID - The resource identifier of the recoverable database associated with create operation of this database. 8056 RecoverableDatabaseID *string `json:"recoverableDatabaseId,omitempty"` 8057 // LongTermRetentionBackupResourceID - The name of the Long Term Retention backup to be used for restore of this managed database. 8058 LongTermRetentionBackupResourceID *string `json:"longTermRetentionBackupResourceId,omitempty"` 8059} 8060 8061// MarshalJSON is the custom marshaler for ManagedDatabaseProperties. 8062func (mdp ManagedDatabaseProperties) MarshalJSON() ([]byte, error) { 8063 objectMap := make(map[string]interface{}) 8064 if mdp.Collation != nil { 8065 objectMap["collation"] = mdp.Collation 8066 } 8067 if mdp.RestorePointInTime != nil { 8068 objectMap["restorePointInTime"] = mdp.RestorePointInTime 8069 } 8070 if mdp.CatalogCollation != "" { 8071 objectMap["catalogCollation"] = mdp.CatalogCollation 8072 } 8073 if mdp.CreateMode != "" { 8074 objectMap["createMode"] = mdp.CreateMode 8075 } 8076 if mdp.StorageContainerURI != nil { 8077 objectMap["storageContainerUri"] = mdp.StorageContainerURI 8078 } 8079 if mdp.SourceDatabaseID != nil { 8080 objectMap["sourceDatabaseId"] = mdp.SourceDatabaseID 8081 } 8082 if mdp.RestorableDroppedDatabaseID != nil { 8083 objectMap["restorableDroppedDatabaseId"] = mdp.RestorableDroppedDatabaseID 8084 } 8085 if mdp.StorageContainerSasToken != nil { 8086 objectMap["storageContainerSasToken"] = mdp.StorageContainerSasToken 8087 } 8088 if mdp.RecoverableDatabaseID != nil { 8089 objectMap["recoverableDatabaseId"] = mdp.RecoverableDatabaseID 8090 } 8091 if mdp.LongTermRetentionBackupResourceID != nil { 8092 objectMap["longTermRetentionBackupResourceId"] = mdp.LongTermRetentionBackupResourceID 8093 } 8094 return json.Marshal(objectMap) 8095} 8096 8097// ManagedDatabasesCompleteRestoreFuture an abstraction for monitoring and retrieving the results of a 8098// long-running operation. 8099type ManagedDatabasesCompleteRestoreFuture struct { 8100 azure.FutureAPI 8101 // Result returns the result of the asynchronous operation. 8102 // If the operation has not completed it will return an error. 8103 Result func(ManagedDatabasesClient) (autorest.Response, error) 8104} 8105 8106// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8107func (future *ManagedDatabasesCompleteRestoreFuture) UnmarshalJSON(body []byte) error { 8108 var azFuture azure.Future 8109 if err := json.Unmarshal(body, &azFuture); err != nil { 8110 return err 8111 } 8112 future.FutureAPI = &azFuture 8113 future.Result = future.result 8114 return nil 8115} 8116 8117// result is the default implementation for ManagedDatabasesCompleteRestoreFuture.Result. 8118func (future *ManagedDatabasesCompleteRestoreFuture) result(client ManagedDatabasesClient) (ar autorest.Response, err error) { 8119 var done bool 8120 done, err = future.DoneWithContext(context.Background(), client) 8121 if err != nil { 8122 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCompleteRestoreFuture", "Result", future.Response(), "Polling failure") 8123 return 8124 } 8125 if !done { 8126 ar.Response = future.Response() 8127 err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCompleteRestoreFuture") 8128 return 8129 } 8130 ar.Response = future.Response() 8131 return 8132} 8133 8134// ManagedDatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 8135// long-running operation. 8136type ManagedDatabasesCreateOrUpdateFuture struct { 8137 azure.FutureAPI 8138 // Result returns the result of the asynchronous operation. 8139 // If the operation has not completed it will return an error. 8140 Result func(ManagedDatabasesClient) (ManagedDatabase, error) 8141} 8142 8143// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8144func (future *ManagedDatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 8145 var azFuture azure.Future 8146 if err := json.Unmarshal(body, &azFuture); err != nil { 8147 return err 8148 } 8149 future.FutureAPI = &azFuture 8150 future.Result = future.result 8151 return nil 8152} 8153 8154// result is the default implementation for ManagedDatabasesCreateOrUpdateFuture.Result. 8155func (future *ManagedDatabasesCreateOrUpdateFuture) result(client ManagedDatabasesClient) (md ManagedDatabase, err error) { 8156 var done bool 8157 done, err = future.DoneWithContext(context.Background(), client) 8158 if err != nil { 8159 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 8160 return 8161 } 8162 if !done { 8163 md.Response.Response = future.Response() 8164 err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesCreateOrUpdateFuture") 8165 return 8166 } 8167 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 8168 if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent { 8169 md, err = client.CreateOrUpdateResponder(md.Response.Response) 8170 if err != nil { 8171 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesCreateOrUpdateFuture", "Result", md.Response.Response, "Failure responding to request") 8172 } 8173 } 8174 return 8175} 8176 8177// ManagedDatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 8178// operation. 8179type ManagedDatabasesDeleteFuture struct { 8180 azure.FutureAPI 8181 // Result returns the result of the asynchronous operation. 8182 // If the operation has not completed it will return an error. 8183 Result func(ManagedDatabasesClient) (autorest.Response, error) 8184} 8185 8186// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8187func (future *ManagedDatabasesDeleteFuture) UnmarshalJSON(body []byte) error { 8188 var azFuture azure.Future 8189 if err := json.Unmarshal(body, &azFuture); err != nil { 8190 return err 8191 } 8192 future.FutureAPI = &azFuture 8193 future.Result = future.result 8194 return nil 8195} 8196 8197// result is the default implementation for ManagedDatabasesDeleteFuture.Result. 8198func (future *ManagedDatabasesDeleteFuture) result(client ManagedDatabasesClient) (ar autorest.Response, err error) { 8199 var done bool 8200 done, err = future.DoneWithContext(context.Background(), client) 8201 if err != nil { 8202 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesDeleteFuture", "Result", future.Response(), "Polling failure") 8203 return 8204 } 8205 if !done { 8206 ar.Response = future.Response() 8207 err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesDeleteFuture") 8208 return 8209 } 8210 ar.Response = future.Response() 8211 return 8212} 8213 8214// ManagedDatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 8215// operation. 8216type ManagedDatabasesUpdateFuture struct { 8217 azure.FutureAPI 8218 // Result returns the result of the asynchronous operation. 8219 // If the operation has not completed it will return an error. 8220 Result func(ManagedDatabasesClient) (ManagedDatabase, error) 8221} 8222 8223// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8224func (future *ManagedDatabasesUpdateFuture) UnmarshalJSON(body []byte) error { 8225 var azFuture azure.Future 8226 if err := json.Unmarshal(body, &azFuture); err != nil { 8227 return err 8228 } 8229 future.FutureAPI = &azFuture 8230 future.Result = future.result 8231 return nil 8232} 8233 8234// result is the default implementation for ManagedDatabasesUpdateFuture.Result. 8235func (future *ManagedDatabasesUpdateFuture) result(client ManagedDatabasesClient) (md ManagedDatabase, err error) { 8236 var done bool 8237 done, err = future.DoneWithContext(context.Background(), client) 8238 if err != nil { 8239 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", future.Response(), "Polling failure") 8240 return 8241 } 8242 if !done { 8243 md.Response.Response = future.Response() 8244 err = azure.NewAsyncOpIncompleteError("sql.ManagedDatabasesUpdateFuture") 8245 return 8246 } 8247 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 8248 if md.Response.Response, err = future.GetResult(sender); err == nil && md.Response.Response.StatusCode != http.StatusNoContent { 8249 md, err = client.UpdateResponder(md.Response.Response) 8250 if err != nil { 8251 err = autorest.NewErrorWithError(err, "sql.ManagedDatabasesUpdateFuture", "Result", md.Response.Response, "Failure responding to request") 8252 } 8253 } 8254 return 8255} 8256 8257// ManagedDatabaseUpdate an managed database update. 8258type ManagedDatabaseUpdate struct { 8259 // ManagedDatabaseProperties - Resource properties. 8260 *ManagedDatabaseProperties `json:"properties,omitempty"` 8261 // Tags - Resource tags. 8262 Tags map[string]*string `json:"tags"` 8263} 8264 8265// MarshalJSON is the custom marshaler for ManagedDatabaseUpdate. 8266func (mdu ManagedDatabaseUpdate) MarshalJSON() ([]byte, error) { 8267 objectMap := make(map[string]interface{}) 8268 if mdu.ManagedDatabaseProperties != nil { 8269 objectMap["properties"] = mdu.ManagedDatabaseProperties 8270 } 8271 if mdu.Tags != nil { 8272 objectMap["tags"] = mdu.Tags 8273 } 8274 return json.Marshal(objectMap) 8275} 8276 8277// UnmarshalJSON is the custom unmarshaler for ManagedDatabaseUpdate struct. 8278func (mdu *ManagedDatabaseUpdate) UnmarshalJSON(body []byte) error { 8279 var m map[string]*json.RawMessage 8280 err := json.Unmarshal(body, &m) 8281 if err != nil { 8282 return err 8283 } 8284 for k, v := range m { 8285 switch k { 8286 case "properties": 8287 if v != nil { 8288 var managedDatabaseProperties ManagedDatabaseProperties 8289 err = json.Unmarshal(*v, &managedDatabaseProperties) 8290 if err != nil { 8291 return err 8292 } 8293 mdu.ManagedDatabaseProperties = &managedDatabaseProperties 8294 } 8295 case "tags": 8296 if v != nil { 8297 var tags map[string]*string 8298 err = json.Unmarshal(*v, &tags) 8299 if err != nil { 8300 return err 8301 } 8302 mdu.Tags = tags 8303 } 8304 } 8305 } 8306 8307 return nil 8308} 8309 8310// ManagedInstance an Azure SQL managed instance. 8311type ManagedInstance struct { 8312 autorest.Response `json:"-"` 8313 // Identity - The Azure Active Directory identity of the managed instance. 8314 Identity *ResourceIdentity `json:"identity,omitempty"` 8315 // Sku - Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5 8316 Sku *Sku `json:"sku,omitempty"` 8317 // ManagedInstanceProperties - Resource properties. 8318 *ManagedInstanceProperties `json:"properties,omitempty"` 8319 // Location - Resource location. 8320 Location *string `json:"location,omitempty"` 8321 // Tags - Resource tags. 8322 Tags map[string]*string `json:"tags"` 8323 // ID - READ-ONLY; Resource ID. 8324 ID *string `json:"id,omitempty"` 8325 // Name - READ-ONLY; Resource name. 8326 Name *string `json:"name,omitempty"` 8327 // Type - READ-ONLY; Resource type. 8328 Type *string `json:"type,omitempty"` 8329} 8330 8331// MarshalJSON is the custom marshaler for ManagedInstance. 8332func (mi ManagedInstance) MarshalJSON() ([]byte, error) { 8333 objectMap := make(map[string]interface{}) 8334 if mi.Identity != nil { 8335 objectMap["identity"] = mi.Identity 8336 } 8337 if mi.Sku != nil { 8338 objectMap["sku"] = mi.Sku 8339 } 8340 if mi.ManagedInstanceProperties != nil { 8341 objectMap["properties"] = mi.ManagedInstanceProperties 8342 } 8343 if mi.Location != nil { 8344 objectMap["location"] = mi.Location 8345 } 8346 if mi.Tags != nil { 8347 objectMap["tags"] = mi.Tags 8348 } 8349 return json.Marshal(objectMap) 8350} 8351 8352// UnmarshalJSON is the custom unmarshaler for ManagedInstance struct. 8353func (mi *ManagedInstance) UnmarshalJSON(body []byte) error { 8354 var m map[string]*json.RawMessage 8355 err := json.Unmarshal(body, &m) 8356 if err != nil { 8357 return err 8358 } 8359 for k, v := range m { 8360 switch k { 8361 case "identity": 8362 if v != nil { 8363 var identity ResourceIdentity 8364 err = json.Unmarshal(*v, &identity) 8365 if err != nil { 8366 return err 8367 } 8368 mi.Identity = &identity 8369 } 8370 case "sku": 8371 if v != nil { 8372 var sku Sku 8373 err = json.Unmarshal(*v, &sku) 8374 if err != nil { 8375 return err 8376 } 8377 mi.Sku = &sku 8378 } 8379 case "properties": 8380 if v != nil { 8381 var managedInstanceProperties ManagedInstanceProperties 8382 err = json.Unmarshal(*v, &managedInstanceProperties) 8383 if err != nil { 8384 return err 8385 } 8386 mi.ManagedInstanceProperties = &managedInstanceProperties 8387 } 8388 case "location": 8389 if v != nil { 8390 var location string 8391 err = json.Unmarshal(*v, &location) 8392 if err != nil { 8393 return err 8394 } 8395 mi.Location = &location 8396 } 8397 case "tags": 8398 if v != nil { 8399 var tags map[string]*string 8400 err = json.Unmarshal(*v, &tags) 8401 if err != nil { 8402 return err 8403 } 8404 mi.Tags = tags 8405 } 8406 case "id": 8407 if v != nil { 8408 var ID string 8409 err = json.Unmarshal(*v, &ID) 8410 if err != nil { 8411 return err 8412 } 8413 mi.ID = &ID 8414 } 8415 case "name": 8416 if v != nil { 8417 var name string 8418 err = json.Unmarshal(*v, &name) 8419 if err != nil { 8420 return err 8421 } 8422 mi.Name = &name 8423 } 8424 case "type": 8425 if v != nil { 8426 var typeVar string 8427 err = json.Unmarshal(*v, &typeVar) 8428 if err != nil { 8429 return err 8430 } 8431 mi.Type = &typeVar 8432 } 8433 } 8434 } 8435 8436 return nil 8437} 8438 8439// ManagedInstanceAdministrator an Azure SQL managed instance administrator. 8440type ManagedInstanceAdministrator struct { 8441 autorest.Response `json:"-"` 8442 // ManagedInstanceAdministratorProperties - Resource properties. 8443 *ManagedInstanceAdministratorProperties `json:"properties,omitempty"` 8444 // ID - READ-ONLY; Resource ID. 8445 ID *string `json:"id,omitempty"` 8446 // Name - READ-ONLY; Resource name. 8447 Name *string `json:"name,omitempty"` 8448 // Type - READ-ONLY; Resource type. 8449 Type *string `json:"type,omitempty"` 8450} 8451 8452// MarshalJSON is the custom marshaler for ManagedInstanceAdministrator. 8453func (mia ManagedInstanceAdministrator) MarshalJSON() ([]byte, error) { 8454 objectMap := make(map[string]interface{}) 8455 if mia.ManagedInstanceAdministratorProperties != nil { 8456 objectMap["properties"] = mia.ManagedInstanceAdministratorProperties 8457 } 8458 return json.Marshal(objectMap) 8459} 8460 8461// UnmarshalJSON is the custom unmarshaler for ManagedInstanceAdministrator struct. 8462func (mia *ManagedInstanceAdministrator) UnmarshalJSON(body []byte) error { 8463 var m map[string]*json.RawMessage 8464 err := json.Unmarshal(body, &m) 8465 if err != nil { 8466 return err 8467 } 8468 for k, v := range m { 8469 switch k { 8470 case "properties": 8471 if v != nil { 8472 var managedInstanceAdministratorProperties ManagedInstanceAdministratorProperties 8473 err = json.Unmarshal(*v, &managedInstanceAdministratorProperties) 8474 if err != nil { 8475 return err 8476 } 8477 mia.ManagedInstanceAdministratorProperties = &managedInstanceAdministratorProperties 8478 } 8479 case "id": 8480 if v != nil { 8481 var ID string 8482 err = json.Unmarshal(*v, &ID) 8483 if err != nil { 8484 return err 8485 } 8486 mia.ID = &ID 8487 } 8488 case "name": 8489 if v != nil { 8490 var name string 8491 err = json.Unmarshal(*v, &name) 8492 if err != nil { 8493 return err 8494 } 8495 mia.Name = &name 8496 } 8497 case "type": 8498 if v != nil { 8499 var typeVar string 8500 err = json.Unmarshal(*v, &typeVar) 8501 if err != nil { 8502 return err 8503 } 8504 mia.Type = &typeVar 8505 } 8506 } 8507 } 8508 8509 return nil 8510} 8511 8512// ManagedInstanceAdministratorListResult a list of managed instance administrators. 8513type ManagedInstanceAdministratorListResult struct { 8514 autorest.Response `json:"-"` 8515 // Value - READ-ONLY; Array of results. 8516 Value *[]ManagedInstanceAdministrator `json:"value,omitempty"` 8517 // NextLink - READ-ONLY; Link to retrieve next page of results. 8518 NextLink *string `json:"nextLink,omitempty"` 8519} 8520 8521// MarshalJSON is the custom marshaler for ManagedInstanceAdministratorListResult. 8522func (mialr ManagedInstanceAdministratorListResult) MarshalJSON() ([]byte, error) { 8523 objectMap := make(map[string]interface{}) 8524 return json.Marshal(objectMap) 8525} 8526 8527// ManagedInstanceAdministratorListResultIterator provides access to a complete listing of 8528// ManagedInstanceAdministrator values. 8529type ManagedInstanceAdministratorListResultIterator struct { 8530 i int 8531 page ManagedInstanceAdministratorListResultPage 8532} 8533 8534// NextWithContext advances to the next value. If there was an error making 8535// the request the iterator does not advance and the error is returned. 8536func (iter *ManagedInstanceAdministratorListResultIterator) NextWithContext(ctx context.Context) (err error) { 8537 if tracing.IsEnabled() { 8538 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultIterator.NextWithContext") 8539 defer func() { 8540 sc := -1 8541 if iter.Response().Response.Response != nil { 8542 sc = iter.Response().Response.Response.StatusCode 8543 } 8544 tracing.EndSpan(ctx, sc, err) 8545 }() 8546 } 8547 iter.i++ 8548 if iter.i < len(iter.page.Values()) { 8549 return nil 8550 } 8551 err = iter.page.NextWithContext(ctx) 8552 if err != nil { 8553 iter.i-- 8554 return err 8555 } 8556 iter.i = 0 8557 return nil 8558} 8559 8560// Next advances to the next value. If there was an error making 8561// the request the iterator does not advance and the error is returned. 8562// Deprecated: Use NextWithContext() instead. 8563func (iter *ManagedInstanceAdministratorListResultIterator) Next() error { 8564 return iter.NextWithContext(context.Background()) 8565} 8566 8567// NotDone returns true if the enumeration should be started or is not yet complete. 8568func (iter ManagedInstanceAdministratorListResultIterator) NotDone() bool { 8569 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 8570} 8571 8572// Response returns the raw server response from the last page request. 8573func (iter ManagedInstanceAdministratorListResultIterator) Response() ManagedInstanceAdministratorListResult { 8574 return iter.page.Response() 8575} 8576 8577// Value returns the current value or a zero-initialized value if the 8578// iterator has advanced beyond the end of the collection. 8579func (iter ManagedInstanceAdministratorListResultIterator) Value() ManagedInstanceAdministrator { 8580 if !iter.page.NotDone() { 8581 return ManagedInstanceAdministrator{} 8582 } 8583 return iter.page.Values()[iter.i] 8584} 8585 8586// Creates a new instance of the ManagedInstanceAdministratorListResultIterator type. 8587func NewManagedInstanceAdministratorListResultIterator(page ManagedInstanceAdministratorListResultPage) ManagedInstanceAdministratorListResultIterator { 8588 return ManagedInstanceAdministratorListResultIterator{page: page} 8589} 8590 8591// IsEmpty returns true if the ListResult contains no values. 8592func (mialr ManagedInstanceAdministratorListResult) IsEmpty() bool { 8593 return mialr.Value == nil || len(*mialr.Value) == 0 8594} 8595 8596// hasNextLink returns true if the NextLink is not empty. 8597func (mialr ManagedInstanceAdministratorListResult) hasNextLink() bool { 8598 return mialr.NextLink != nil && len(*mialr.NextLink) != 0 8599} 8600 8601// managedInstanceAdministratorListResultPreparer prepares a request to retrieve the next set of results. 8602// It returns nil if no more results exist. 8603func (mialr ManagedInstanceAdministratorListResult) managedInstanceAdministratorListResultPreparer(ctx context.Context) (*http.Request, error) { 8604 if !mialr.hasNextLink() { 8605 return nil, nil 8606 } 8607 return autorest.Prepare((&http.Request{}).WithContext(ctx), 8608 autorest.AsJSON(), 8609 autorest.AsGet(), 8610 autorest.WithBaseURL(to.String(mialr.NextLink))) 8611} 8612 8613// ManagedInstanceAdministratorListResultPage contains a page of ManagedInstanceAdministrator values. 8614type ManagedInstanceAdministratorListResultPage struct { 8615 fn func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error) 8616 mialr ManagedInstanceAdministratorListResult 8617} 8618 8619// NextWithContext advances to the next page of values. If there was an error making 8620// the request the page does not advance and the error is returned. 8621func (page *ManagedInstanceAdministratorListResultPage) NextWithContext(ctx context.Context) (err error) { 8622 if tracing.IsEnabled() { 8623 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceAdministratorListResultPage.NextWithContext") 8624 defer func() { 8625 sc := -1 8626 if page.Response().Response.Response != nil { 8627 sc = page.Response().Response.Response.StatusCode 8628 } 8629 tracing.EndSpan(ctx, sc, err) 8630 }() 8631 } 8632 for { 8633 next, err := page.fn(ctx, page.mialr) 8634 if err != nil { 8635 return err 8636 } 8637 page.mialr = next 8638 if !next.hasNextLink() || !next.IsEmpty() { 8639 break 8640 } 8641 } 8642 return nil 8643} 8644 8645// Next advances to the next page of values. If there was an error making 8646// the request the page does not advance and the error is returned. 8647// Deprecated: Use NextWithContext() instead. 8648func (page *ManagedInstanceAdministratorListResultPage) Next() error { 8649 return page.NextWithContext(context.Background()) 8650} 8651 8652// NotDone returns true if the page enumeration should be started or is not yet complete. 8653func (page ManagedInstanceAdministratorListResultPage) NotDone() bool { 8654 return !page.mialr.IsEmpty() 8655} 8656 8657// Response returns the raw server response from the last page request. 8658func (page ManagedInstanceAdministratorListResultPage) Response() ManagedInstanceAdministratorListResult { 8659 return page.mialr 8660} 8661 8662// Values returns the slice of values for the current page or nil if there are no values. 8663func (page ManagedInstanceAdministratorListResultPage) Values() []ManagedInstanceAdministrator { 8664 if page.mialr.IsEmpty() { 8665 return nil 8666 } 8667 return *page.mialr.Value 8668} 8669 8670// Creates a new instance of the ManagedInstanceAdministratorListResultPage type. 8671func NewManagedInstanceAdministratorListResultPage(cur ManagedInstanceAdministratorListResult, getNextPage func(context.Context, ManagedInstanceAdministratorListResult) (ManagedInstanceAdministratorListResult, error)) ManagedInstanceAdministratorListResultPage { 8672 return ManagedInstanceAdministratorListResultPage{ 8673 fn: getNextPage, 8674 mialr: cur, 8675 } 8676} 8677 8678// ManagedInstanceAdministratorProperties the properties of a managed instance administrator. 8679type ManagedInstanceAdministratorProperties struct { 8680 // AdministratorType - Type of the managed instance administrator. 8681 AdministratorType *string `json:"administratorType,omitempty"` 8682 // Login - Login name of the managed instance administrator. 8683 Login *string `json:"login,omitempty"` 8684 // Sid - SID (object ID) of the managed instance administrator. 8685 Sid *uuid.UUID `json:"sid,omitempty"` 8686 // TenantID - Tenant ID of the managed instance administrator. 8687 TenantID *uuid.UUID `json:"tenantId,omitempty"` 8688} 8689 8690// ManagedInstanceAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the 8691// results of a long-running operation. 8692type ManagedInstanceAdministratorsCreateOrUpdateFuture struct { 8693 azure.FutureAPI 8694 // Result returns the result of the asynchronous operation. 8695 // If the operation has not completed it will return an error. 8696 Result func(ManagedInstanceAdministratorsClient) (ManagedInstanceAdministrator, error) 8697} 8698 8699// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8700func (future *ManagedInstanceAdministratorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 8701 var azFuture azure.Future 8702 if err := json.Unmarshal(body, &azFuture); err != nil { 8703 return err 8704 } 8705 future.FutureAPI = &azFuture 8706 future.Result = future.result 8707 return nil 8708} 8709 8710// result is the default implementation for ManagedInstanceAdministratorsCreateOrUpdateFuture.Result. 8711func (future *ManagedInstanceAdministratorsCreateOrUpdateFuture) result(client ManagedInstanceAdministratorsClient) (mia ManagedInstanceAdministrator, err error) { 8712 var done bool 8713 done, err = future.DoneWithContext(context.Background(), client) 8714 if err != nil { 8715 err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 8716 return 8717 } 8718 if !done { 8719 mia.Response.Response = future.Response() 8720 err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsCreateOrUpdateFuture") 8721 return 8722 } 8723 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 8724 if mia.Response.Response, err = future.GetResult(sender); err == nil && mia.Response.Response.StatusCode != http.StatusNoContent { 8725 mia, err = client.CreateOrUpdateResponder(mia.Response.Response) 8726 if err != nil { 8727 err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsCreateOrUpdateFuture", "Result", mia.Response.Response, "Failure responding to request") 8728 } 8729 } 8730 return 8731} 8732 8733// ManagedInstanceAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a 8734// long-running operation. 8735type ManagedInstanceAdministratorsDeleteFuture struct { 8736 azure.FutureAPI 8737 // Result returns the result of the asynchronous operation. 8738 // If the operation has not completed it will return an error. 8739 Result func(ManagedInstanceAdministratorsClient) (autorest.Response, error) 8740} 8741 8742// UnmarshalJSON is the custom unmarshaller for CreateFuture. 8743func (future *ManagedInstanceAdministratorsDeleteFuture) UnmarshalJSON(body []byte) error { 8744 var azFuture azure.Future 8745 if err := json.Unmarshal(body, &azFuture); err != nil { 8746 return err 8747 } 8748 future.FutureAPI = &azFuture 8749 future.Result = future.result 8750 return nil 8751} 8752 8753// result is the default implementation for ManagedInstanceAdministratorsDeleteFuture.Result. 8754func (future *ManagedInstanceAdministratorsDeleteFuture) result(client ManagedInstanceAdministratorsClient) (ar autorest.Response, err error) { 8755 var done bool 8756 done, err = future.DoneWithContext(context.Background(), client) 8757 if err != nil { 8758 err = autorest.NewErrorWithError(err, "sql.ManagedInstanceAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") 8759 return 8760 } 8761 if !done { 8762 ar.Response = future.Response() 8763 err = azure.NewAsyncOpIncompleteError("sql.ManagedInstanceAdministratorsDeleteFuture") 8764 return 8765 } 8766 ar.Response = future.Response() 8767 return 8768} 8769 8770// ManagedInstanceListResult a list of managed instances. 8771type ManagedInstanceListResult struct { 8772 autorest.Response `json:"-"` 8773 // Value - READ-ONLY; Array of results. 8774 Value *[]ManagedInstance `json:"value,omitempty"` 8775 // NextLink - READ-ONLY; Link to retrieve next page of results. 8776 NextLink *string `json:"nextLink,omitempty"` 8777} 8778 8779// MarshalJSON is the custom marshaler for ManagedInstanceListResult. 8780func (milr ManagedInstanceListResult) MarshalJSON() ([]byte, error) { 8781 objectMap := make(map[string]interface{}) 8782 return json.Marshal(objectMap) 8783} 8784 8785// ManagedInstanceListResultIterator provides access to a complete listing of ManagedInstance values. 8786type ManagedInstanceListResultIterator struct { 8787 i int 8788 page ManagedInstanceListResultPage 8789} 8790 8791// NextWithContext advances to the next value. If there was an error making 8792// the request the iterator does not advance and the error is returned. 8793func (iter *ManagedInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { 8794 if tracing.IsEnabled() { 8795 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultIterator.NextWithContext") 8796 defer func() { 8797 sc := -1 8798 if iter.Response().Response.Response != nil { 8799 sc = iter.Response().Response.Response.StatusCode 8800 } 8801 tracing.EndSpan(ctx, sc, err) 8802 }() 8803 } 8804 iter.i++ 8805 if iter.i < len(iter.page.Values()) { 8806 return nil 8807 } 8808 err = iter.page.NextWithContext(ctx) 8809 if err != nil { 8810 iter.i-- 8811 return err 8812 } 8813 iter.i = 0 8814 return nil 8815} 8816 8817// Next advances to the next value. If there was an error making 8818// the request the iterator does not advance and the error is returned. 8819// Deprecated: Use NextWithContext() instead. 8820func (iter *ManagedInstanceListResultIterator) Next() error { 8821 return iter.NextWithContext(context.Background()) 8822} 8823 8824// NotDone returns true if the enumeration should be started or is not yet complete. 8825func (iter ManagedInstanceListResultIterator) NotDone() bool { 8826 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 8827} 8828 8829// Response returns the raw server response from the last page request. 8830func (iter ManagedInstanceListResultIterator) Response() ManagedInstanceListResult { 8831 return iter.page.Response() 8832} 8833 8834// Value returns the current value or a zero-initialized value if the 8835// iterator has advanced beyond the end of the collection. 8836func (iter ManagedInstanceListResultIterator) Value() ManagedInstance { 8837 if !iter.page.NotDone() { 8838 return ManagedInstance{} 8839 } 8840 return iter.page.Values()[iter.i] 8841} 8842 8843// Creates a new instance of the ManagedInstanceListResultIterator type. 8844func NewManagedInstanceListResultIterator(page ManagedInstanceListResultPage) ManagedInstanceListResultIterator { 8845 return ManagedInstanceListResultIterator{page: page} 8846} 8847 8848// IsEmpty returns true if the ListResult contains no values. 8849func (milr ManagedInstanceListResult) IsEmpty() bool { 8850 return milr.Value == nil || len(*milr.Value) == 0 8851} 8852 8853// hasNextLink returns true if the NextLink is not empty. 8854func (milr ManagedInstanceListResult) hasNextLink() bool { 8855 return milr.NextLink != nil && len(*milr.NextLink) != 0 8856} 8857 8858// managedInstanceListResultPreparer prepares a request to retrieve the next set of results. 8859// It returns nil if no more results exist. 8860func (milr ManagedInstanceListResult) managedInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { 8861 if !milr.hasNextLink() { 8862 return nil, nil 8863 } 8864 return autorest.Prepare((&http.Request{}).WithContext(ctx), 8865 autorest.AsJSON(), 8866 autorest.AsGet(), 8867 autorest.WithBaseURL(to.String(milr.NextLink))) 8868} 8869 8870// ManagedInstanceListResultPage contains a page of ManagedInstance values. 8871type ManagedInstanceListResultPage struct { 8872 fn func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error) 8873 milr ManagedInstanceListResult 8874} 8875 8876// NextWithContext advances to the next page of values. If there was an error making 8877// the request the page does not advance and the error is returned. 8878func (page *ManagedInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { 8879 if tracing.IsEnabled() { 8880 ctx = tracing.StartSpan(ctx, fqdn+"/ManagedInstanceListResultPage.NextWithContext") 8881 defer func() { 8882 sc := -1 8883 if page.Response().Response.Response != nil { 8884 sc = page.Response().Response.Response.StatusCode 8885 } 8886 tracing.EndSpan(ctx, sc, err) 8887 }() 8888 } 8889 for { 8890 next, err := page.fn(ctx, page.milr) 8891 if err != nil { 8892 return err 8893 } 8894 page.milr = next 8895 if !next.hasNextLink() || !next.IsEmpty() { 8896 break 8897 } 8898 } 8899 return nil 8900} 8901 8902// Next advances to the next page of values. If there was an error making 8903// the request the page does not advance and the error is returned. 8904// Deprecated: Use NextWithContext() instead. 8905func (page *ManagedInstanceListResultPage) Next() error { 8906 return page.NextWithContext(context.Background()) 8907} 8908 8909// NotDone returns true if the page enumeration should be started or is not yet complete. 8910func (page ManagedInstanceListResultPage) NotDone() bool { 8911 return !page.milr.IsEmpty() 8912} 8913 8914// Response returns the raw server response from the last page request. 8915func (page ManagedInstanceListResultPage) Response() ManagedInstanceListResult { 8916 return page.milr 8917} 8918 8919// Values returns the slice of values for the current page or nil if there are no values. 8920func (page ManagedInstanceListResultPage) Values() []ManagedInstance { 8921 if page.milr.IsEmpty() { 8922 return nil 8923 } 8924 return *page.milr.Value 8925} 8926 8927// Creates a new instance of the ManagedInstanceListResultPage type. 8928func NewManagedInstanceListResultPage(cur ManagedInstanceListResult, getNextPage func(context.Context, ManagedInstanceListResult) (ManagedInstanceListResult, error)) ManagedInstanceListResultPage { 8929 return ManagedInstanceListResultPage{ 8930 fn: getNextPage, 8931 milr: cur, 8932 } 8933} 8934 8935// ManagedInstanceProperties the properties of a managed instance. 8936type ManagedInstanceProperties struct { 8937 // ManagedInstanceCreateMode - Specifies the mode of database creation. 8938 // 8939 // Default: Regular instance creation. 8940 // 8941 // Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. Possible values include: 'ManagedServerCreateModeDefault', 'ManagedServerCreateModePointInTimeRestore' 8942 ManagedInstanceCreateMode ManagedServerCreateMode `json:"managedInstanceCreateMode,omitempty"` 8943 // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the managed instance. 8944 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` 8945 // AdministratorLogin - Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). 8946 AdministratorLogin *string `json:"administratorLogin,omitempty"` 8947 // AdministratorLoginPassword - The administrator login password (required for managed instance creation). 8948 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` 8949 // SubnetID - Subnet resource ID for the managed instance. 8950 SubnetID *string `json:"subnetId,omitempty"` 8951 // State - READ-ONLY; The state of the managed instance. 8952 State *string `json:"state,omitempty"` 8953 // LicenseType - The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). Possible values include: 'LicenseIncluded', 'BasePrice' 8954 LicenseType ManagedInstanceLicenseType `json:"licenseType,omitempty"` 8955 // VCores - The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. 8956 VCores *int32 `json:"vCores,omitempty"` 8957 // StorageSizeInGB - Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. 8958 StorageSizeInGB *int32 `json:"storageSizeInGB,omitempty"` 8959 // Collation - Collation of the managed instance. 8960 Collation *string `json:"collation,omitempty"` 8961 // DNSZone - READ-ONLY; The Dns Zone that the managed instance is in. 8962 DNSZone *string `json:"dnsZone,omitempty"` 8963 // DNSZonePartner - The resource id of another managed instance whose DNS zone this managed instance will share after creation. 8964 DNSZonePartner *string `json:"dnsZonePartner,omitempty"` 8965 // PublicDataEndpointEnabled - Whether or not the public data endpoint is enabled. 8966 PublicDataEndpointEnabled *bool `json:"publicDataEndpointEnabled,omitempty"` 8967 // SourceManagedInstanceID - The resource identifier of the source managed instance associated with create operation of this instance. 8968 SourceManagedInstanceID *string `json:"sourceManagedInstanceId,omitempty"` 8969 // RestorePointInTime - Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. 8970 RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` 8971 // ProxyOverride - Connection type used for connecting to the instance. Possible values include: 'ManagedInstanceProxyOverrideProxy', 'ManagedInstanceProxyOverrideRedirect', 'ManagedInstanceProxyOverrideDefault' 8972 ProxyOverride ManagedInstanceProxyOverride `json:"proxyOverride,omitempty"` 8973 // TimezoneID - Id of the timezone. Allowed values are timezones supported by Windows. 8974 // Windows keeps details on supported timezones, including the id, in registry under 8975 // KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. 8976 // You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. 8977 // List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. 8978 // An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". 8979 TimezoneID *string `json:"timezoneId,omitempty"` 8980 // InstancePoolID - The Id of the instance pool this managed server belongs to. 8981 InstancePoolID *string `json:"instancePoolId,omitempty"` 8982 // MaintenanceConfigurationID - Specifies maintenance configuration id to apply to this managed instance. 8983 MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` 8984 // MinimalTLSVersion - Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' 8985 MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` 8986} 8987 8988// MarshalJSON is the custom marshaler for ManagedInstanceProperties. 8989func (mip ManagedInstanceProperties) MarshalJSON() ([]byte, error) { 8990 objectMap := make(map[string]interface{}) 8991 if mip.ManagedInstanceCreateMode != "" { 8992 objectMap["managedInstanceCreateMode"] = mip.ManagedInstanceCreateMode 8993 } 8994 if mip.AdministratorLogin != nil { 8995 objectMap["administratorLogin"] = mip.AdministratorLogin 8996 } 8997 if mip.AdministratorLoginPassword != nil { 8998 objectMap["administratorLoginPassword"] = mip.AdministratorLoginPassword 8999 } 9000 if mip.SubnetID != nil { 9001 objectMap["subnetId"] = mip.SubnetID 9002 } 9003 if mip.LicenseType != "" { 9004 objectMap["licenseType"] = mip.LicenseType 9005 } 9006 if mip.VCores != nil { 9007 objectMap["vCores"] = mip.VCores 9008 } 9009 if mip.StorageSizeInGB != nil { 9010 objectMap["storageSizeInGB"] = mip.StorageSizeInGB 9011 } 9012 if mip.Collation != nil { 9013 objectMap["collation"] = mip.Collation 9014 } 9015 if mip.DNSZonePartner != nil { 9016 objectMap["dnsZonePartner"] = mip.DNSZonePartner 9017 } 9018 if mip.PublicDataEndpointEnabled != nil { 9019 objectMap["publicDataEndpointEnabled"] = mip.PublicDataEndpointEnabled 9020 } 9021 if mip.SourceManagedInstanceID != nil { 9022 objectMap["sourceManagedInstanceId"] = mip.SourceManagedInstanceID 9023 } 9024 if mip.RestorePointInTime != nil { 9025 objectMap["restorePointInTime"] = mip.RestorePointInTime 9026 } 9027 if mip.ProxyOverride != "" { 9028 objectMap["proxyOverride"] = mip.ProxyOverride 9029 } 9030 if mip.TimezoneID != nil { 9031 objectMap["timezoneId"] = mip.TimezoneID 9032 } 9033 if mip.InstancePoolID != nil { 9034 objectMap["instancePoolId"] = mip.InstancePoolID 9035 } 9036 if mip.MaintenanceConfigurationID != nil { 9037 objectMap["maintenanceConfigurationId"] = mip.MaintenanceConfigurationID 9038 } 9039 if mip.MinimalTLSVersion != nil { 9040 objectMap["minimalTlsVersion"] = mip.MinimalTLSVersion 9041 } 9042 return json.Marshal(objectMap) 9043} 9044 9045// ManagedInstancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 9046// long-running operation. 9047type ManagedInstancesCreateOrUpdateFuture struct { 9048 azure.FutureAPI 9049 // Result returns the result of the asynchronous operation. 9050 // If the operation has not completed it will return an error. 9051 Result func(ManagedInstancesClient) (ManagedInstance, error) 9052} 9053 9054// UnmarshalJSON is the custom unmarshaller for CreateFuture. 9055func (future *ManagedInstancesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 9056 var azFuture azure.Future 9057 if err := json.Unmarshal(body, &azFuture); err != nil { 9058 return err 9059 } 9060 future.FutureAPI = &azFuture 9061 future.Result = future.result 9062 return nil 9063} 9064 9065// result is the default implementation for ManagedInstancesCreateOrUpdateFuture.Result. 9066func (future *ManagedInstancesCreateOrUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { 9067 var done bool 9068 done, err = future.DoneWithContext(context.Background(), client) 9069 if err != nil { 9070 err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 9071 return 9072 } 9073 if !done { 9074 mi.Response.Response = future.Response() 9075 err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesCreateOrUpdateFuture") 9076 return 9077 } 9078 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 9079 if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { 9080 mi, err = client.CreateOrUpdateResponder(mi.Response.Response) 9081 if err != nil { 9082 err = autorest.NewErrorWithError(err, "sql.ManagedInstancesCreateOrUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") 9083 } 9084 } 9085 return 9086} 9087 9088// ManagedInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 9089// operation. 9090type ManagedInstancesDeleteFuture struct { 9091 azure.FutureAPI 9092 // Result returns the result of the asynchronous operation. 9093 // If the operation has not completed it will return an error. 9094 Result func(ManagedInstancesClient) (autorest.Response, error) 9095} 9096 9097// UnmarshalJSON is the custom unmarshaller for CreateFuture. 9098func (future *ManagedInstancesDeleteFuture) UnmarshalJSON(body []byte) error { 9099 var azFuture azure.Future 9100 if err := json.Unmarshal(body, &azFuture); err != nil { 9101 return err 9102 } 9103 future.FutureAPI = &azFuture 9104 future.Result = future.result 9105 return nil 9106} 9107 9108// result is the default implementation for ManagedInstancesDeleteFuture.Result. 9109func (future *ManagedInstancesDeleteFuture) result(client ManagedInstancesClient) (ar autorest.Response, err error) { 9110 var done bool 9111 done, err = future.DoneWithContext(context.Background(), client) 9112 if err != nil { 9113 err = autorest.NewErrorWithError(err, "sql.ManagedInstancesDeleteFuture", "Result", future.Response(), "Polling failure") 9114 return 9115 } 9116 if !done { 9117 ar.Response = future.Response() 9118 err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesDeleteFuture") 9119 return 9120 } 9121 ar.Response = future.Response() 9122 return 9123} 9124 9125// ManagedInstancesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 9126// operation. 9127type ManagedInstancesUpdateFuture struct { 9128 azure.FutureAPI 9129 // Result returns the result of the asynchronous operation. 9130 // If the operation has not completed it will return an error. 9131 Result func(ManagedInstancesClient) (ManagedInstance, error) 9132} 9133 9134// UnmarshalJSON is the custom unmarshaller for CreateFuture. 9135func (future *ManagedInstancesUpdateFuture) UnmarshalJSON(body []byte) error { 9136 var azFuture azure.Future 9137 if err := json.Unmarshal(body, &azFuture); err != nil { 9138 return err 9139 } 9140 future.FutureAPI = &azFuture 9141 future.Result = future.result 9142 return nil 9143} 9144 9145// result is the default implementation for ManagedInstancesUpdateFuture.Result. 9146func (future *ManagedInstancesUpdateFuture) result(client ManagedInstancesClient) (mi ManagedInstance, err error) { 9147 var done bool 9148 done, err = future.DoneWithContext(context.Background(), client) 9149 if err != nil { 9150 err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", future.Response(), "Polling failure") 9151 return 9152 } 9153 if !done { 9154 mi.Response.Response = future.Response() 9155 err = azure.NewAsyncOpIncompleteError("sql.ManagedInstancesUpdateFuture") 9156 return 9157 } 9158 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 9159 if mi.Response.Response, err = future.GetResult(sender); err == nil && mi.Response.Response.StatusCode != http.StatusNoContent { 9160 mi, err = client.UpdateResponder(mi.Response.Response) 9161 if err != nil { 9162 err = autorest.NewErrorWithError(err, "sql.ManagedInstancesUpdateFuture", "Result", mi.Response.Response, "Failure responding to request") 9163 } 9164 } 9165 return 9166} 9167 9168// ManagedInstanceUpdate an update request for an Azure SQL Database managed instance. 9169type ManagedInstanceUpdate struct { 9170 // Sku - Managed instance sku 9171 Sku *Sku `json:"sku,omitempty"` 9172 // ManagedInstanceProperties - Resource properties. 9173 *ManagedInstanceProperties `json:"properties,omitempty"` 9174 // Tags - Resource tags. 9175 Tags map[string]*string `json:"tags"` 9176} 9177 9178// MarshalJSON is the custom marshaler for ManagedInstanceUpdate. 9179func (miu ManagedInstanceUpdate) MarshalJSON() ([]byte, error) { 9180 objectMap := make(map[string]interface{}) 9181 if miu.Sku != nil { 9182 objectMap["sku"] = miu.Sku 9183 } 9184 if miu.ManagedInstanceProperties != nil { 9185 objectMap["properties"] = miu.ManagedInstanceProperties 9186 } 9187 if miu.Tags != nil { 9188 objectMap["tags"] = miu.Tags 9189 } 9190 return json.Marshal(objectMap) 9191} 9192 9193// UnmarshalJSON is the custom unmarshaler for ManagedInstanceUpdate struct. 9194func (miu *ManagedInstanceUpdate) UnmarshalJSON(body []byte) error { 9195 var m map[string]*json.RawMessage 9196 err := json.Unmarshal(body, &m) 9197 if err != nil { 9198 return err 9199 } 9200 for k, v := range m { 9201 switch k { 9202 case "sku": 9203 if v != nil { 9204 var sku Sku 9205 err = json.Unmarshal(*v, &sku) 9206 if err != nil { 9207 return err 9208 } 9209 miu.Sku = &sku 9210 } 9211 case "properties": 9212 if v != nil { 9213 var managedInstanceProperties ManagedInstanceProperties 9214 err = json.Unmarshal(*v, &managedInstanceProperties) 9215 if err != nil { 9216 return err 9217 } 9218 miu.ManagedInstanceProperties = &managedInstanceProperties 9219 } 9220 case "tags": 9221 if v != nil { 9222 var tags map[string]*string 9223 err = json.Unmarshal(*v, &tags) 9224 if err != nil { 9225 return err 9226 } 9227 miu.Tags = tags 9228 } 9229 } 9230 } 9231 9232 return nil 9233} 9234 9235// MaxSizeCapability the maximum size limits for a database. 9236type MaxSizeCapability struct { 9237 // Limit - READ-ONLY; The maximum size of the database (see 'unit' for the units). 9238 Limit *int64 `json:"limit,omitempty"` 9239 // Unit - READ-ONLY; The units that the limit is expressed in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' 9240 Unit MaxSizeUnits `json:"unit,omitempty"` 9241 // Status - READ-ONLY; The status of the maximum size capability. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' 9242 Status CapabilityStatus `json:"status,omitempty"` 9243} 9244 9245// MarshalJSON is the custom marshaler for MaxSizeCapability. 9246func (msc MaxSizeCapability) MarshalJSON() ([]byte, error) { 9247 objectMap := make(map[string]interface{}) 9248 return json.Marshal(objectMap) 9249} 9250 9251// Metric database metrics. 9252type Metric struct { 9253 // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). 9254 StartTime *date.Time `json:"startTime,omitempty"` 9255 // EndTime - READ-ONLY; The end time for the metric (ISO-8601 format). 9256 EndTime *date.Time `json:"endTime,omitempty"` 9257 // TimeGrain - READ-ONLY; The time step to be used to summarize the metric values. 9258 TimeGrain *string `json:"timeGrain,omitempty"` 9259 // Unit - READ-ONLY; The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond' 9260 Unit UnitType `json:"unit,omitempty"` 9261 // Name - READ-ONLY; The name information for the metric. 9262 Name *MetricName `json:"name,omitempty"` 9263 // MetricValues - READ-ONLY; The metric values for the specified time window and timestep. 9264 MetricValues *[]MetricValue `json:"metricValues,omitempty"` 9265} 9266 9267// MarshalJSON is the custom marshaler for Metric. 9268func (mVar Metric) MarshalJSON() ([]byte, error) { 9269 objectMap := make(map[string]interface{}) 9270 return json.Marshal(objectMap) 9271} 9272 9273// MetricAvailability a metric availability value. 9274type MetricAvailability struct { 9275 // Retention - READ-ONLY; The length of retention for the database metric. 9276 Retention *string `json:"retention,omitempty"` 9277 // TimeGrain - READ-ONLY; The granularity of the database metric. 9278 TimeGrain *string `json:"timeGrain,omitempty"` 9279} 9280 9281// MarshalJSON is the custom marshaler for MetricAvailability. 9282func (ma MetricAvailability) MarshalJSON() ([]byte, error) { 9283 objectMap := make(map[string]interface{}) 9284 return json.Marshal(objectMap) 9285} 9286 9287// MetricDefinition a database metric definition. 9288type MetricDefinition struct { 9289 // Name - READ-ONLY; The name information for the metric. 9290 Name *MetricName `json:"name,omitempty"` 9291 // PrimaryAggregationType - READ-ONLY; The primary aggregation type defining how metric values are displayed. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' 9292 PrimaryAggregationType PrimaryAggregationType `json:"primaryAggregationType,omitempty"` 9293 // ResourceURI - READ-ONLY; The resource uri of the database. 9294 ResourceURI *string `json:"resourceUri,omitempty"` 9295 // Unit - READ-ONLY; The unit of the metric. Possible values include: 'UnitDefinitionTypeCount', 'UnitDefinitionTypeBytes', 'UnitDefinitionTypeSeconds', 'UnitDefinitionTypePercent', 'UnitDefinitionTypeCountPerSecond', 'UnitDefinitionTypeBytesPerSecond' 9296 Unit UnitDefinitionType `json:"unit,omitempty"` 9297 // MetricAvailabilities - READ-ONLY; The list of database metric availabilities for the metric. 9298 MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` 9299} 9300 9301// MarshalJSON is the custom marshaler for MetricDefinition. 9302func (md MetricDefinition) MarshalJSON() ([]byte, error) { 9303 objectMap := make(map[string]interface{}) 9304 return json.Marshal(objectMap) 9305} 9306 9307// MetricDefinitionListResult the response to a list database metric definitions request. 9308type MetricDefinitionListResult struct { 9309 autorest.Response `json:"-"` 9310 // Value - The list of metric definitions for the database. 9311 Value *[]MetricDefinition `json:"value,omitempty"` 9312} 9313 9314// MetricListResult the response to a list database metrics request. 9315type MetricListResult struct { 9316 autorest.Response `json:"-"` 9317 // Value - The list of metrics for the database. 9318 Value *[]Metric `json:"value,omitempty"` 9319} 9320 9321// MetricName a database metric name. 9322type MetricName struct { 9323 // Value - READ-ONLY; The name of the database metric. 9324 Value *string `json:"value,omitempty"` 9325 // LocalizedValue - READ-ONLY; The friendly name of the database metric. 9326 LocalizedValue *string `json:"localizedValue,omitempty"` 9327} 9328 9329// MarshalJSON is the custom marshaler for MetricName. 9330func (mn MetricName) MarshalJSON() ([]byte, error) { 9331 objectMap := make(map[string]interface{}) 9332 return json.Marshal(objectMap) 9333} 9334 9335// MetricValue represents database metrics. 9336type MetricValue struct { 9337 // Count - READ-ONLY; The number of values for the metric. 9338 Count *float64 `json:"count,omitempty"` 9339 // Average - READ-ONLY; The average value of the metric. 9340 Average *float64 `json:"average,omitempty"` 9341 // Maximum - READ-ONLY; The max value of the metric. 9342 Maximum *float64 `json:"maximum,omitempty"` 9343 // Minimum - READ-ONLY; The min value of the metric. 9344 Minimum *float64 `json:"minimum,omitempty"` 9345 // Timestamp - READ-ONLY; The metric timestamp (ISO-8601 format). 9346 Timestamp *date.Time `json:"timestamp,omitempty"` 9347 // Total - READ-ONLY; The total value of the metric. 9348 Total *float64 `json:"total,omitempty"` 9349} 9350 9351// MarshalJSON is the custom marshaler for MetricValue. 9352func (mv MetricValue) MarshalJSON() ([]byte, error) { 9353 objectMap := make(map[string]interface{}) 9354 return json.Marshal(objectMap) 9355} 9356 9357// Operation SQL REST API operation definition. 9358type Operation struct { 9359 // Name - READ-ONLY; The name of the operation being performed on this particular object. 9360 Name *string `json:"name,omitempty"` 9361 // Display - READ-ONLY; The localized display information for this particular operation / action. 9362 Display *OperationDisplay `json:"display,omitempty"` 9363 // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'OperationOriginUser', 'OperationOriginSystem' 9364 Origin OperationOrigin `json:"origin,omitempty"` 9365 // Properties - READ-ONLY; Additional descriptions for the operation. 9366 Properties map[string]interface{} `json:"properties"` 9367} 9368 9369// MarshalJSON is the custom marshaler for Operation. 9370func (o Operation) MarshalJSON() ([]byte, error) { 9371 objectMap := make(map[string]interface{}) 9372 return json.Marshal(objectMap) 9373} 9374 9375// OperationDisplay display metadata associated with the operation. 9376type OperationDisplay struct { 9377 // Provider - READ-ONLY; The localized friendly form of the resource provider name. 9378 Provider *string `json:"provider,omitempty"` 9379 // Resource - READ-ONLY; The localized friendly form of the resource type related to this action/operation. 9380 Resource *string `json:"resource,omitempty"` 9381 // Operation - READ-ONLY; The localized friendly name for the operation. 9382 Operation *string `json:"operation,omitempty"` 9383 // Description - READ-ONLY; The localized friendly description for the operation. 9384 Description *string `json:"description,omitempty"` 9385} 9386 9387// MarshalJSON is the custom marshaler for OperationDisplay. 9388func (od OperationDisplay) MarshalJSON() ([]byte, error) { 9389 objectMap := make(map[string]interface{}) 9390 return json.Marshal(objectMap) 9391} 9392 9393// OperationImpact the impact of an operation, both in absolute and relative terms. 9394type OperationImpact struct { 9395 // Name - READ-ONLY; The name of the impact dimension. 9396 Name *string `json:"name,omitempty"` 9397 // Unit - READ-ONLY; The unit in which estimated impact to dimension is measured. 9398 Unit *string `json:"unit,omitempty"` 9399 // ChangeValueAbsolute - READ-ONLY; The absolute impact to dimension. 9400 ChangeValueAbsolute *float64 `json:"changeValueAbsolute,omitempty"` 9401 // ChangeValueRelative - READ-ONLY; The relative impact to dimension (null if not applicable) 9402 ChangeValueRelative *float64 `json:"changeValueRelative,omitempty"` 9403} 9404 9405// MarshalJSON is the custom marshaler for OperationImpact. 9406func (oi OperationImpact) MarshalJSON() ([]byte, error) { 9407 objectMap := make(map[string]interface{}) 9408 return json.Marshal(objectMap) 9409} 9410 9411// OperationListResult result of the request to list SQL operations. 9412type OperationListResult struct { 9413 autorest.Response `json:"-"` 9414 // Value - READ-ONLY; Array of results. 9415 Value *[]Operation `json:"value,omitempty"` 9416 // NextLink - READ-ONLY; Link to retrieve next page of results. 9417 NextLink *string `json:"nextLink,omitempty"` 9418} 9419 9420// MarshalJSON is the custom marshaler for OperationListResult. 9421func (olr OperationListResult) MarshalJSON() ([]byte, error) { 9422 objectMap := make(map[string]interface{}) 9423 return json.Marshal(objectMap) 9424} 9425 9426// OperationListResultIterator provides access to a complete listing of Operation values. 9427type OperationListResultIterator struct { 9428 i int 9429 page OperationListResultPage 9430} 9431 9432// NextWithContext advances to the next value. If there was an error making 9433// the request the iterator does not advance and the error is returned. 9434func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 9435 if tracing.IsEnabled() { 9436 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 9437 defer func() { 9438 sc := -1 9439 if iter.Response().Response.Response != nil { 9440 sc = iter.Response().Response.Response.StatusCode 9441 } 9442 tracing.EndSpan(ctx, sc, err) 9443 }() 9444 } 9445 iter.i++ 9446 if iter.i < len(iter.page.Values()) { 9447 return nil 9448 } 9449 err = iter.page.NextWithContext(ctx) 9450 if err != nil { 9451 iter.i-- 9452 return err 9453 } 9454 iter.i = 0 9455 return nil 9456} 9457 9458// Next advances to the next value. If there was an error making 9459// the request the iterator does not advance and the error is returned. 9460// Deprecated: Use NextWithContext() instead. 9461func (iter *OperationListResultIterator) Next() error { 9462 return iter.NextWithContext(context.Background()) 9463} 9464 9465// NotDone returns true if the enumeration should be started or is not yet complete. 9466func (iter OperationListResultIterator) NotDone() bool { 9467 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 9468} 9469 9470// Response returns the raw server response from the last page request. 9471func (iter OperationListResultIterator) Response() OperationListResult { 9472 return iter.page.Response() 9473} 9474 9475// Value returns the current value or a zero-initialized value if the 9476// iterator has advanced beyond the end of the collection. 9477func (iter OperationListResultIterator) Value() Operation { 9478 if !iter.page.NotDone() { 9479 return Operation{} 9480 } 9481 return iter.page.Values()[iter.i] 9482} 9483 9484// Creates a new instance of the OperationListResultIterator type. 9485func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 9486 return OperationListResultIterator{page: page} 9487} 9488 9489// IsEmpty returns true if the ListResult contains no values. 9490func (olr OperationListResult) IsEmpty() bool { 9491 return olr.Value == nil || len(*olr.Value) == 0 9492} 9493 9494// hasNextLink returns true if the NextLink is not empty. 9495func (olr OperationListResult) hasNextLink() bool { 9496 return olr.NextLink != nil && len(*olr.NextLink) != 0 9497} 9498 9499// operationListResultPreparer prepares a request to retrieve the next set of results. 9500// It returns nil if no more results exist. 9501func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 9502 if !olr.hasNextLink() { 9503 return nil, nil 9504 } 9505 return autorest.Prepare((&http.Request{}).WithContext(ctx), 9506 autorest.AsJSON(), 9507 autorest.AsGet(), 9508 autorest.WithBaseURL(to.String(olr.NextLink))) 9509} 9510 9511// OperationListResultPage contains a page of Operation values. 9512type OperationListResultPage struct { 9513 fn func(context.Context, OperationListResult) (OperationListResult, error) 9514 olr OperationListResult 9515} 9516 9517// NextWithContext advances to the next page of values. If there was an error making 9518// the request the page does not advance and the error is returned. 9519func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 9520 if tracing.IsEnabled() { 9521 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 9522 defer func() { 9523 sc := -1 9524 if page.Response().Response.Response != nil { 9525 sc = page.Response().Response.Response.StatusCode 9526 } 9527 tracing.EndSpan(ctx, sc, err) 9528 }() 9529 } 9530 for { 9531 next, err := page.fn(ctx, page.olr) 9532 if err != nil { 9533 return err 9534 } 9535 page.olr = next 9536 if !next.hasNextLink() || !next.IsEmpty() { 9537 break 9538 } 9539 } 9540 return nil 9541} 9542 9543// Next advances to the next page of values. If there was an error making 9544// the request the page does not advance and the error is returned. 9545// Deprecated: Use NextWithContext() instead. 9546func (page *OperationListResultPage) Next() error { 9547 return page.NextWithContext(context.Background()) 9548} 9549 9550// NotDone returns true if the page enumeration should be started or is not yet complete. 9551func (page OperationListResultPage) NotDone() bool { 9552 return !page.olr.IsEmpty() 9553} 9554 9555// Response returns the raw server response from the last page request. 9556func (page OperationListResultPage) Response() OperationListResult { 9557 return page.olr 9558} 9559 9560// Values returns the slice of values for the current page or nil if there are no values. 9561func (page OperationListResultPage) Values() []Operation { 9562 if page.olr.IsEmpty() { 9563 return nil 9564 } 9565 return *page.olr.Value 9566} 9567 9568// Creates a new instance of the OperationListResultPage type. 9569func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 9570 return OperationListResultPage{ 9571 fn: getNextPage, 9572 olr: cur, 9573 } 9574} 9575 9576// PartnerInfo partner server information for the failover group. 9577type PartnerInfo struct { 9578 // ID - Resource identifier of the partner server. 9579 ID *string `json:"id,omitempty"` 9580 // Location - READ-ONLY; Geo location of the partner server. 9581 Location *string `json:"location,omitempty"` 9582 // ReplicationRole - READ-ONLY; Replication role of the partner server. Possible values include: 'Primary', 'Secondary' 9583 ReplicationRole FailoverGroupReplicationRole `json:"replicationRole,omitempty"` 9584} 9585 9586// MarshalJSON is the custom marshaler for PartnerInfo. 9587func (pi PartnerInfo) MarshalJSON() ([]byte, error) { 9588 objectMap := make(map[string]interface{}) 9589 if pi.ID != nil { 9590 objectMap["id"] = pi.ID 9591 } 9592 return json.Marshal(objectMap) 9593} 9594 9595// PerformanceLevel a possible performance level of a service objective capability. 9596type PerformanceLevel struct { 9597 // Unit - READ-ONLY; Unit type used to measure service objective performance level. Possible values include: 'DTU' 9598 Unit PerformanceLevelUnit `json:"unit,omitempty"` 9599 // Value - READ-ONLY; Performance level value. 9600 Value *int32 `json:"value,omitempty"` 9601} 9602 9603// MarshalJSON is the custom marshaler for PerformanceLevel. 9604func (pl PerformanceLevel) MarshalJSON() ([]byte, error) { 9605 objectMap := make(map[string]interface{}) 9606 return json.Marshal(objectMap) 9607} 9608 9609// ProxyResource ARM proxy resource. 9610type ProxyResource struct { 9611 // ID - READ-ONLY; Resource ID. 9612 ID *string `json:"id,omitempty"` 9613 // Name - READ-ONLY; Resource name. 9614 Name *string `json:"name,omitempty"` 9615 // Type - READ-ONLY; Resource type. 9616 Type *string `json:"type,omitempty"` 9617} 9618 9619// MarshalJSON is the custom marshaler for ProxyResource. 9620func (pr ProxyResource) MarshalJSON() ([]byte, error) { 9621 objectMap := make(map[string]interface{}) 9622 return json.Marshal(objectMap) 9623} 9624 9625// RecommendedIndex represents a database recommended index. 9626type RecommendedIndex struct { 9627 // RecommendedIndexProperties - READ-ONLY; The properties representing the resource. 9628 *RecommendedIndexProperties `json:"properties,omitempty"` 9629 // ID - READ-ONLY; Resource ID. 9630 ID *string `json:"id,omitempty"` 9631 // Name - READ-ONLY; Resource name. 9632 Name *string `json:"name,omitempty"` 9633 // Type - READ-ONLY; Resource type. 9634 Type *string `json:"type,omitempty"` 9635} 9636 9637// MarshalJSON is the custom marshaler for RecommendedIndex. 9638func (ri RecommendedIndex) MarshalJSON() ([]byte, error) { 9639 objectMap := make(map[string]interface{}) 9640 return json.Marshal(objectMap) 9641} 9642 9643// UnmarshalJSON is the custom unmarshaler for RecommendedIndex struct. 9644func (ri *RecommendedIndex) UnmarshalJSON(body []byte) error { 9645 var m map[string]*json.RawMessage 9646 err := json.Unmarshal(body, &m) 9647 if err != nil { 9648 return err 9649 } 9650 for k, v := range m { 9651 switch k { 9652 case "properties": 9653 if v != nil { 9654 var recommendedIndexProperties RecommendedIndexProperties 9655 err = json.Unmarshal(*v, &recommendedIndexProperties) 9656 if err != nil { 9657 return err 9658 } 9659 ri.RecommendedIndexProperties = &recommendedIndexProperties 9660 } 9661 case "id": 9662 if v != nil { 9663 var ID string 9664 err = json.Unmarshal(*v, &ID) 9665 if err != nil { 9666 return err 9667 } 9668 ri.ID = &ID 9669 } 9670 case "name": 9671 if v != nil { 9672 var name string 9673 err = json.Unmarshal(*v, &name) 9674 if err != nil { 9675 return err 9676 } 9677 ri.Name = &name 9678 } 9679 case "type": 9680 if v != nil { 9681 var typeVar string 9682 err = json.Unmarshal(*v, &typeVar) 9683 if err != nil { 9684 return err 9685 } 9686 ri.Type = &typeVar 9687 } 9688 } 9689 } 9690 9691 return nil 9692} 9693 9694// RecommendedIndexProperties represents the properties of a database recommended index. 9695type RecommendedIndexProperties struct { 9696 // Action - READ-ONLY; The proposed index action. You can create a missing index, drop an unused index, or rebuild an existing index to improve its performance. Possible values include: 'Create', 'Drop', 'Rebuild' 9697 Action RecommendedIndexAction `json:"action,omitempty"` 9698 // State - READ-ONLY; The current recommendation state. Possible values include: 'Active', 'Pending', 'Executing', 'Verifying', 'PendingRevert', 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success' 9699 State RecommendedIndexState `json:"state,omitempty"` 9700 // Created - READ-ONLY; The UTC datetime showing when this resource was created (ISO8601 format). 9701 Created *date.Time `json:"created,omitempty"` 9702 // LastModified - READ-ONLY; The UTC datetime of when was this resource last changed (ISO8601 format). 9703 LastModified *date.Time `json:"lastModified,omitempty"` 9704 // IndexType - READ-ONLY; The type of index (CLUSTERED, NONCLUSTERED, COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTEREDCOLUMNSTORE' 9705 IndexType RecommendedIndexType `json:"indexType,omitempty"` 9706 // Schema - READ-ONLY; The schema where table to build index over resides 9707 Schema *string `json:"schema,omitempty"` 9708 // Table - READ-ONLY; The table on which to build index. 9709 Table *string `json:"table,omitempty"` 9710 // Columns - READ-ONLY; Columns over which to build index 9711 Columns *[]string `json:"columns,omitempty"` 9712 // IncludedColumns - READ-ONLY; The list of column names to be included in the index 9713 IncludedColumns *[]string `json:"includedColumns,omitempty"` 9714 // IndexScript - READ-ONLY; The full build index script 9715 IndexScript *string `json:"indexScript,omitempty"` 9716 // EstimatedImpact - READ-ONLY; The estimated impact of doing recommended index action. 9717 EstimatedImpact *[]OperationImpact `json:"estimatedImpact,omitempty"` 9718 // ReportedImpact - READ-ONLY; The values reported after index action is complete. 9719 ReportedImpact *[]OperationImpact `json:"reportedImpact,omitempty"` 9720} 9721 9722// MarshalJSON is the custom marshaler for RecommendedIndexProperties. 9723func (rip RecommendedIndexProperties) MarshalJSON() ([]byte, error) { 9724 objectMap := make(map[string]interface{}) 9725 return json.Marshal(objectMap) 9726} 9727 9728// RecoverableDatabase a recoverable database 9729type RecoverableDatabase struct { 9730 autorest.Response `json:"-"` 9731 // RecoverableDatabaseProperties - The properties of a recoverable database 9732 *RecoverableDatabaseProperties `json:"properties,omitempty"` 9733 // ID - READ-ONLY; Resource ID. 9734 ID *string `json:"id,omitempty"` 9735 // Name - READ-ONLY; Resource name. 9736 Name *string `json:"name,omitempty"` 9737 // Type - READ-ONLY; Resource type. 9738 Type *string `json:"type,omitempty"` 9739} 9740 9741// MarshalJSON is the custom marshaler for RecoverableDatabase. 9742func (rd RecoverableDatabase) MarshalJSON() ([]byte, error) { 9743 objectMap := make(map[string]interface{}) 9744 if rd.RecoverableDatabaseProperties != nil { 9745 objectMap["properties"] = rd.RecoverableDatabaseProperties 9746 } 9747 return json.Marshal(objectMap) 9748} 9749 9750// UnmarshalJSON is the custom unmarshaler for RecoverableDatabase struct. 9751func (rd *RecoverableDatabase) UnmarshalJSON(body []byte) error { 9752 var m map[string]*json.RawMessage 9753 err := json.Unmarshal(body, &m) 9754 if err != nil { 9755 return err 9756 } 9757 for k, v := range m { 9758 switch k { 9759 case "properties": 9760 if v != nil { 9761 var recoverableDatabaseProperties RecoverableDatabaseProperties 9762 err = json.Unmarshal(*v, &recoverableDatabaseProperties) 9763 if err != nil { 9764 return err 9765 } 9766 rd.RecoverableDatabaseProperties = &recoverableDatabaseProperties 9767 } 9768 case "id": 9769 if v != nil { 9770 var ID string 9771 err = json.Unmarshal(*v, &ID) 9772 if err != nil { 9773 return err 9774 } 9775 rd.ID = &ID 9776 } 9777 case "name": 9778 if v != nil { 9779 var name string 9780 err = json.Unmarshal(*v, &name) 9781 if err != nil { 9782 return err 9783 } 9784 rd.Name = &name 9785 } 9786 case "type": 9787 if v != nil { 9788 var typeVar string 9789 err = json.Unmarshal(*v, &typeVar) 9790 if err != nil { 9791 return err 9792 } 9793 rd.Type = &typeVar 9794 } 9795 } 9796 } 9797 9798 return nil 9799} 9800 9801// RecoverableDatabaseListResult the response to a list recoverable databases request 9802type RecoverableDatabaseListResult struct { 9803 autorest.Response `json:"-"` 9804 // Value - A list of recoverable databases 9805 Value *[]RecoverableDatabase `json:"value,omitempty"` 9806} 9807 9808// RecoverableDatabaseProperties the properties of a recoverable database 9809type RecoverableDatabaseProperties struct { 9810 // Edition - READ-ONLY; The edition of the database 9811 Edition *string `json:"edition,omitempty"` 9812 // ServiceLevelObjective - READ-ONLY; The service level objective name of the database 9813 ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` 9814 // ElasticPoolName - READ-ONLY; The elastic pool name of the database 9815 ElasticPoolName *string `json:"elasticPoolName,omitempty"` 9816 // LastAvailableBackupDate - READ-ONLY; The last available backup date of the database (ISO8601 format) 9817 LastAvailableBackupDate *date.Time `json:"lastAvailableBackupDate,omitempty"` 9818} 9819 9820// MarshalJSON is the custom marshaler for RecoverableDatabaseProperties. 9821func (rdp RecoverableDatabaseProperties) MarshalJSON() ([]byte, error) { 9822 objectMap := make(map[string]interface{}) 9823 return json.Marshal(objectMap) 9824} 9825 9826// ReplicationLink represents a database replication link. 9827type ReplicationLink struct { 9828 autorest.Response `json:"-"` 9829 // Location - READ-ONLY; Location of the server that contains this firewall rule. 9830 Location *string `json:"location,omitempty"` 9831 // ReplicationLinkProperties - The properties representing the resource. 9832 *ReplicationLinkProperties `json:"properties,omitempty"` 9833 // ID - READ-ONLY; Resource ID. 9834 ID *string `json:"id,omitempty"` 9835 // Name - READ-ONLY; Resource name. 9836 Name *string `json:"name,omitempty"` 9837 // Type - READ-ONLY; Resource type. 9838 Type *string `json:"type,omitempty"` 9839} 9840 9841// MarshalJSON is the custom marshaler for ReplicationLink. 9842func (rl ReplicationLink) MarshalJSON() ([]byte, error) { 9843 objectMap := make(map[string]interface{}) 9844 if rl.ReplicationLinkProperties != nil { 9845 objectMap["properties"] = rl.ReplicationLinkProperties 9846 } 9847 return json.Marshal(objectMap) 9848} 9849 9850// UnmarshalJSON is the custom unmarshaler for ReplicationLink struct. 9851func (rl *ReplicationLink) UnmarshalJSON(body []byte) error { 9852 var m map[string]*json.RawMessage 9853 err := json.Unmarshal(body, &m) 9854 if err != nil { 9855 return err 9856 } 9857 for k, v := range m { 9858 switch k { 9859 case "location": 9860 if v != nil { 9861 var location string 9862 err = json.Unmarshal(*v, &location) 9863 if err != nil { 9864 return err 9865 } 9866 rl.Location = &location 9867 } 9868 case "properties": 9869 if v != nil { 9870 var replicationLinkProperties ReplicationLinkProperties 9871 err = json.Unmarshal(*v, &replicationLinkProperties) 9872 if err != nil { 9873 return err 9874 } 9875 rl.ReplicationLinkProperties = &replicationLinkProperties 9876 } 9877 case "id": 9878 if v != nil { 9879 var ID string 9880 err = json.Unmarshal(*v, &ID) 9881 if err != nil { 9882 return err 9883 } 9884 rl.ID = &ID 9885 } 9886 case "name": 9887 if v != nil { 9888 var name string 9889 err = json.Unmarshal(*v, &name) 9890 if err != nil { 9891 return err 9892 } 9893 rl.Name = &name 9894 } 9895 case "type": 9896 if v != nil { 9897 var typeVar string 9898 err = json.Unmarshal(*v, &typeVar) 9899 if err != nil { 9900 return err 9901 } 9902 rl.Type = &typeVar 9903 } 9904 } 9905 } 9906 9907 return nil 9908} 9909 9910// ReplicationLinkListResult represents the response to a List database replication link request. 9911type ReplicationLinkListResult struct { 9912 autorest.Response `json:"-"` 9913 // Value - The list of database replication links housed in the database. 9914 Value *[]ReplicationLink `json:"value,omitempty"` 9915} 9916 9917// ReplicationLinkProperties represents the properties of a database replication link. 9918type ReplicationLinkProperties struct { 9919 // IsTerminationAllowed - READ-ONLY; Legacy value indicating whether termination is allowed. Currently always returns true. 9920 IsTerminationAllowed *bool `json:"isTerminationAllowed,omitempty"` 9921 // ReplicationMode - READ-ONLY; Replication mode of this replication link. 9922 ReplicationMode *string `json:"replicationMode,omitempty"` 9923 // PartnerServer - READ-ONLY; The name of the server hosting the partner database. 9924 PartnerServer *string `json:"partnerServer,omitempty"` 9925 // PartnerDatabase - READ-ONLY; The name of the partner database. 9926 PartnerDatabase *string `json:"partnerDatabase,omitempty"` 9927 // PartnerLocation - READ-ONLY; The Azure Region of the partner database. 9928 PartnerLocation *string `json:"partnerLocation,omitempty"` 9929 // Role - READ-ONLY; The role of the database in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' 9930 Role ReplicationRole `json:"role,omitempty"` 9931 // PartnerRole - READ-ONLY; The role of the partner database in the replication link. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary', 'ReplicationRoleNonReadableSecondary', 'ReplicationRoleSource', 'ReplicationRoleCopy' 9932 PartnerRole ReplicationRole `json:"partnerRole,omitempty"` 9933 // StartTime - READ-ONLY; The start time for the replication link. 9934 StartTime *date.Time `json:"startTime,omitempty"` 9935 // PercentComplete - READ-ONLY; The percentage of seeding complete for the replication link. 9936 PercentComplete *int32 `json:"percentComplete,omitempty"` 9937 // ReplicationState - READ-ONLY; The replication state for the replication link. Possible values include: 'PENDING', 'SEEDING', 'CATCHUP', 'SUSPENDED' 9938 ReplicationState ReplicationState `json:"replicationState,omitempty"` 9939} 9940 9941// MarshalJSON is the custom marshaler for ReplicationLinkProperties. 9942func (rlp ReplicationLinkProperties) MarshalJSON() ([]byte, error) { 9943 objectMap := make(map[string]interface{}) 9944 return json.Marshal(objectMap) 9945} 9946 9947// ReplicationLinksFailoverAllowDataLossFuture an abstraction for monitoring and retrieving the results of 9948// a long-running operation. 9949type ReplicationLinksFailoverAllowDataLossFuture struct { 9950 azure.FutureAPI 9951 // Result returns the result of the asynchronous operation. 9952 // If the operation has not completed it will return an error. 9953 Result func(ReplicationLinksClient) (autorest.Response, error) 9954} 9955 9956// UnmarshalJSON is the custom unmarshaller for CreateFuture. 9957func (future *ReplicationLinksFailoverAllowDataLossFuture) UnmarshalJSON(body []byte) error { 9958 var azFuture azure.Future 9959 if err := json.Unmarshal(body, &azFuture); err != nil { 9960 return err 9961 } 9962 future.FutureAPI = &azFuture 9963 future.Result = future.result 9964 return nil 9965} 9966 9967// result is the default implementation for ReplicationLinksFailoverAllowDataLossFuture.Result. 9968func (future *ReplicationLinksFailoverAllowDataLossFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { 9969 var done bool 9970 done, err = future.DoneWithContext(context.Background(), client) 9971 if err != nil { 9972 err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverAllowDataLossFuture", "Result", future.Response(), "Polling failure") 9973 return 9974 } 9975 if !done { 9976 ar.Response = future.Response() 9977 err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverAllowDataLossFuture") 9978 return 9979 } 9980 ar.Response = future.Response() 9981 return 9982} 9983 9984// ReplicationLinksFailoverFuture an abstraction for monitoring and retrieving the results of a 9985// long-running operation. 9986type ReplicationLinksFailoverFuture struct { 9987 azure.FutureAPI 9988 // Result returns the result of the asynchronous operation. 9989 // If the operation has not completed it will return an error. 9990 Result func(ReplicationLinksClient) (autorest.Response, error) 9991} 9992 9993// UnmarshalJSON is the custom unmarshaller for CreateFuture. 9994func (future *ReplicationLinksFailoverFuture) UnmarshalJSON(body []byte) error { 9995 var azFuture azure.Future 9996 if err := json.Unmarshal(body, &azFuture); err != nil { 9997 return err 9998 } 9999 future.FutureAPI = &azFuture 10000 future.Result = future.result 10001 return nil 10002} 10003 10004// result is the default implementation for ReplicationLinksFailoverFuture.Result. 10005func (future *ReplicationLinksFailoverFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { 10006 var done bool 10007 done, err = future.DoneWithContext(context.Background(), client) 10008 if err != nil { 10009 err = autorest.NewErrorWithError(err, "sql.ReplicationLinksFailoverFuture", "Result", future.Response(), "Polling failure") 10010 return 10011 } 10012 if !done { 10013 ar.Response = future.Response() 10014 err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksFailoverFuture") 10015 return 10016 } 10017 ar.Response = future.Response() 10018 return 10019} 10020 10021// ReplicationLinksUnlinkFuture an abstraction for monitoring and retrieving the results of a long-running 10022// operation. 10023type ReplicationLinksUnlinkFuture struct { 10024 azure.FutureAPI 10025 // Result returns the result of the asynchronous operation. 10026 // If the operation has not completed it will return an error. 10027 Result func(ReplicationLinksClient) (autorest.Response, error) 10028} 10029 10030// UnmarshalJSON is the custom unmarshaller for CreateFuture. 10031func (future *ReplicationLinksUnlinkFuture) UnmarshalJSON(body []byte) error { 10032 var azFuture azure.Future 10033 if err := json.Unmarshal(body, &azFuture); err != nil { 10034 return err 10035 } 10036 future.FutureAPI = &azFuture 10037 future.Result = future.result 10038 return nil 10039} 10040 10041// result is the default implementation for ReplicationLinksUnlinkFuture.Result. 10042func (future *ReplicationLinksUnlinkFuture) result(client ReplicationLinksClient) (ar autorest.Response, err error) { 10043 var done bool 10044 done, err = future.DoneWithContext(context.Background(), client) 10045 if err != nil { 10046 err = autorest.NewErrorWithError(err, "sql.ReplicationLinksUnlinkFuture", "Result", future.Response(), "Polling failure") 10047 return 10048 } 10049 if !done { 10050 ar.Response = future.Response() 10051 err = azure.NewAsyncOpIncompleteError("sql.ReplicationLinksUnlinkFuture") 10052 return 10053 } 10054 ar.Response = future.Response() 10055 return 10056} 10057 10058// Resource ARM resource. 10059type Resource struct { 10060 // ID - READ-ONLY; Resource ID. 10061 ID *string `json:"id,omitempty"` 10062 // Name - READ-ONLY; Resource name. 10063 Name *string `json:"name,omitempty"` 10064 // Type - READ-ONLY; Resource type. 10065 Type *string `json:"type,omitempty"` 10066} 10067 10068// MarshalJSON is the custom marshaler for Resource. 10069func (r Resource) MarshalJSON() ([]byte, error) { 10070 objectMap := make(map[string]interface{}) 10071 return json.Marshal(objectMap) 10072} 10073 10074// ResourceIdentity azure Active Directory identity configuration for a resource. 10075type ResourceIdentity struct { 10076 // PrincipalID - READ-ONLY; The Azure Active Directory principal id. 10077 PrincipalID *uuid.UUID `json:"principalId,omitempty"` 10078 // 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' 10079 Type IdentityType `json:"type,omitempty"` 10080 // TenantID - READ-ONLY; The Azure Active Directory tenant id. 10081 TenantID *uuid.UUID `json:"tenantId,omitempty"` 10082} 10083 10084// MarshalJSON is the custom marshaler for ResourceIdentity. 10085func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { 10086 objectMap := make(map[string]interface{}) 10087 if ri.Type != "" { 10088 objectMap["type"] = ri.Type 10089 } 10090 return json.Marshal(objectMap) 10091} 10092 10093// ResourceMoveDefinition contains the information necessary to perform a resource move (rename). 10094type ResourceMoveDefinition struct { 10095 // ID - The target ID for the resource 10096 ID *string `json:"id,omitempty"` 10097} 10098 10099// RestorableDroppedDatabase a restorable dropped database 10100type RestorableDroppedDatabase struct { 10101 autorest.Response `json:"-"` 10102 // Location - READ-ONLY; The geo-location where the resource lives 10103 Location *string `json:"location,omitempty"` 10104 // RestorableDroppedDatabaseProperties - The properties of a restorable dropped database 10105 *RestorableDroppedDatabaseProperties `json:"properties,omitempty"` 10106 // ID - READ-ONLY; Resource ID. 10107 ID *string `json:"id,omitempty"` 10108 // Name - READ-ONLY; Resource name. 10109 Name *string `json:"name,omitempty"` 10110 // Type - READ-ONLY; Resource type. 10111 Type *string `json:"type,omitempty"` 10112} 10113 10114// MarshalJSON is the custom marshaler for RestorableDroppedDatabase. 10115func (rdd RestorableDroppedDatabase) MarshalJSON() ([]byte, error) { 10116 objectMap := make(map[string]interface{}) 10117 if rdd.RestorableDroppedDatabaseProperties != nil { 10118 objectMap["properties"] = rdd.RestorableDroppedDatabaseProperties 10119 } 10120 return json.Marshal(objectMap) 10121} 10122 10123// UnmarshalJSON is the custom unmarshaler for RestorableDroppedDatabase struct. 10124func (rdd *RestorableDroppedDatabase) UnmarshalJSON(body []byte) error { 10125 var m map[string]*json.RawMessage 10126 err := json.Unmarshal(body, &m) 10127 if err != nil { 10128 return err 10129 } 10130 for k, v := range m { 10131 switch k { 10132 case "location": 10133 if v != nil { 10134 var location string 10135 err = json.Unmarshal(*v, &location) 10136 if err != nil { 10137 return err 10138 } 10139 rdd.Location = &location 10140 } 10141 case "properties": 10142 if v != nil { 10143 var restorableDroppedDatabaseProperties RestorableDroppedDatabaseProperties 10144 err = json.Unmarshal(*v, &restorableDroppedDatabaseProperties) 10145 if err != nil { 10146 return err 10147 } 10148 rdd.RestorableDroppedDatabaseProperties = &restorableDroppedDatabaseProperties 10149 } 10150 case "id": 10151 if v != nil { 10152 var ID string 10153 err = json.Unmarshal(*v, &ID) 10154 if err != nil { 10155 return err 10156 } 10157 rdd.ID = &ID 10158 } 10159 case "name": 10160 if v != nil { 10161 var name string 10162 err = json.Unmarshal(*v, &name) 10163 if err != nil { 10164 return err 10165 } 10166 rdd.Name = &name 10167 } 10168 case "type": 10169 if v != nil { 10170 var typeVar string 10171 err = json.Unmarshal(*v, &typeVar) 10172 if err != nil { 10173 return err 10174 } 10175 rdd.Type = &typeVar 10176 } 10177 } 10178 } 10179 10180 return nil 10181} 10182 10183// RestorableDroppedDatabaseListResult the response to a list restorable dropped databases request 10184type RestorableDroppedDatabaseListResult struct { 10185 autorest.Response `json:"-"` 10186 // Value - A list of restorable dropped databases 10187 Value *[]RestorableDroppedDatabase `json:"value,omitempty"` 10188} 10189 10190// RestorableDroppedDatabaseProperties the properties of a restorable dropped database 10191type RestorableDroppedDatabaseProperties struct { 10192 // DatabaseName - READ-ONLY; The name of the database 10193 DatabaseName *string `json:"databaseName,omitempty"` 10194 // Edition - READ-ONLY; The edition of the database 10195 Edition *string `json:"edition,omitempty"` 10196 // MaxSizeBytes - READ-ONLY; The max size in bytes of the database 10197 MaxSizeBytes *string `json:"maxSizeBytes,omitempty"` 10198 // ServiceLevelObjective - READ-ONLY; The service level objective name of the database 10199 ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` 10200 // ElasticPoolName - READ-ONLY; The elastic pool name of the database 10201 ElasticPoolName *string `json:"elasticPoolName,omitempty"` 10202 // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format) 10203 CreationDate *date.Time `json:"creationDate,omitempty"` 10204 // DeletionDate - READ-ONLY; The deletion date of the database (ISO8601 format) 10205 DeletionDate *date.Time `json:"deletionDate,omitempty"` 10206 // EarliestRestoreDate - READ-ONLY; The earliest restore date of the database (ISO8601 format) 10207 EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` 10208} 10209 10210// MarshalJSON is the custom marshaler for RestorableDroppedDatabaseProperties. 10211func (rddp RestorableDroppedDatabaseProperties) MarshalJSON() ([]byte, error) { 10212 objectMap := make(map[string]interface{}) 10213 return json.Marshal(objectMap) 10214} 10215 10216// RestorableDroppedManagedDatabase a restorable dropped managed database resource. 10217type RestorableDroppedManagedDatabase struct { 10218 autorest.Response `json:"-"` 10219 // RestorableDroppedManagedDatabaseProperties - Resource properties. 10220 *RestorableDroppedManagedDatabaseProperties `json:"properties,omitempty"` 10221 // Location - Resource location. 10222 Location *string `json:"location,omitempty"` 10223 // Tags - Resource tags. 10224 Tags map[string]*string `json:"tags"` 10225 // ID - READ-ONLY; Resource ID. 10226 ID *string `json:"id,omitempty"` 10227 // Name - READ-ONLY; Resource name. 10228 Name *string `json:"name,omitempty"` 10229 // Type - READ-ONLY; Resource type. 10230 Type *string `json:"type,omitempty"` 10231} 10232 10233// MarshalJSON is the custom marshaler for RestorableDroppedManagedDatabase. 10234func (rdmd RestorableDroppedManagedDatabase) MarshalJSON() ([]byte, error) { 10235 objectMap := make(map[string]interface{}) 10236 if rdmd.RestorableDroppedManagedDatabaseProperties != nil { 10237 objectMap["properties"] = rdmd.RestorableDroppedManagedDatabaseProperties 10238 } 10239 if rdmd.Location != nil { 10240 objectMap["location"] = rdmd.Location 10241 } 10242 if rdmd.Tags != nil { 10243 objectMap["tags"] = rdmd.Tags 10244 } 10245 return json.Marshal(objectMap) 10246} 10247 10248// UnmarshalJSON is the custom unmarshaler for RestorableDroppedManagedDatabase struct. 10249func (rdmd *RestorableDroppedManagedDatabase) UnmarshalJSON(body []byte) error { 10250 var m map[string]*json.RawMessage 10251 err := json.Unmarshal(body, &m) 10252 if err != nil { 10253 return err 10254 } 10255 for k, v := range m { 10256 switch k { 10257 case "properties": 10258 if v != nil { 10259 var restorableDroppedManagedDatabaseProperties RestorableDroppedManagedDatabaseProperties 10260 err = json.Unmarshal(*v, &restorableDroppedManagedDatabaseProperties) 10261 if err != nil { 10262 return err 10263 } 10264 rdmd.RestorableDroppedManagedDatabaseProperties = &restorableDroppedManagedDatabaseProperties 10265 } 10266 case "location": 10267 if v != nil { 10268 var location string 10269 err = json.Unmarshal(*v, &location) 10270 if err != nil { 10271 return err 10272 } 10273 rdmd.Location = &location 10274 } 10275 case "tags": 10276 if v != nil { 10277 var tags map[string]*string 10278 err = json.Unmarshal(*v, &tags) 10279 if err != nil { 10280 return err 10281 } 10282 rdmd.Tags = tags 10283 } 10284 case "id": 10285 if v != nil { 10286 var ID string 10287 err = json.Unmarshal(*v, &ID) 10288 if err != nil { 10289 return err 10290 } 10291 rdmd.ID = &ID 10292 } 10293 case "name": 10294 if v != nil { 10295 var name string 10296 err = json.Unmarshal(*v, &name) 10297 if err != nil { 10298 return err 10299 } 10300 rdmd.Name = &name 10301 } 10302 case "type": 10303 if v != nil { 10304 var typeVar string 10305 err = json.Unmarshal(*v, &typeVar) 10306 if err != nil { 10307 return err 10308 } 10309 rdmd.Type = &typeVar 10310 } 10311 } 10312 } 10313 10314 return nil 10315} 10316 10317// RestorableDroppedManagedDatabaseListResult a list of restorable dropped managed databases. 10318type RestorableDroppedManagedDatabaseListResult struct { 10319 autorest.Response `json:"-"` 10320 // Value - READ-ONLY; Array of results. 10321 Value *[]RestorableDroppedManagedDatabase `json:"value,omitempty"` 10322 // NextLink - READ-ONLY; Link to retrieve next page of results. 10323 NextLink *string `json:"nextLink,omitempty"` 10324} 10325 10326// MarshalJSON is the custom marshaler for RestorableDroppedManagedDatabaseListResult. 10327func (rdmdlr RestorableDroppedManagedDatabaseListResult) MarshalJSON() ([]byte, error) { 10328 objectMap := make(map[string]interface{}) 10329 return json.Marshal(objectMap) 10330} 10331 10332// RestorableDroppedManagedDatabaseListResultIterator provides access to a complete listing of 10333// RestorableDroppedManagedDatabase values. 10334type RestorableDroppedManagedDatabaseListResultIterator struct { 10335 i int 10336 page RestorableDroppedManagedDatabaseListResultPage 10337} 10338 10339// NextWithContext advances to the next value. If there was an error making 10340// the request the iterator does not advance and the error is returned. 10341func (iter *RestorableDroppedManagedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { 10342 if tracing.IsEnabled() { 10343 ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedManagedDatabaseListResultIterator.NextWithContext") 10344 defer func() { 10345 sc := -1 10346 if iter.Response().Response.Response != nil { 10347 sc = iter.Response().Response.Response.StatusCode 10348 } 10349 tracing.EndSpan(ctx, sc, err) 10350 }() 10351 } 10352 iter.i++ 10353 if iter.i < len(iter.page.Values()) { 10354 return nil 10355 } 10356 err = iter.page.NextWithContext(ctx) 10357 if err != nil { 10358 iter.i-- 10359 return err 10360 } 10361 iter.i = 0 10362 return nil 10363} 10364 10365// Next advances to the next value. If there was an error making 10366// the request the iterator does not advance and the error is returned. 10367// Deprecated: Use NextWithContext() instead. 10368func (iter *RestorableDroppedManagedDatabaseListResultIterator) Next() error { 10369 return iter.NextWithContext(context.Background()) 10370} 10371 10372// NotDone returns true if the enumeration should be started or is not yet complete. 10373func (iter RestorableDroppedManagedDatabaseListResultIterator) NotDone() bool { 10374 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 10375} 10376 10377// Response returns the raw server response from the last page request. 10378func (iter RestorableDroppedManagedDatabaseListResultIterator) Response() RestorableDroppedManagedDatabaseListResult { 10379 return iter.page.Response() 10380} 10381 10382// Value returns the current value or a zero-initialized value if the 10383// iterator has advanced beyond the end of the collection. 10384func (iter RestorableDroppedManagedDatabaseListResultIterator) Value() RestorableDroppedManagedDatabase { 10385 if !iter.page.NotDone() { 10386 return RestorableDroppedManagedDatabase{} 10387 } 10388 return iter.page.Values()[iter.i] 10389} 10390 10391// Creates a new instance of the RestorableDroppedManagedDatabaseListResultIterator type. 10392func NewRestorableDroppedManagedDatabaseListResultIterator(page RestorableDroppedManagedDatabaseListResultPage) RestorableDroppedManagedDatabaseListResultIterator { 10393 return RestorableDroppedManagedDatabaseListResultIterator{page: page} 10394} 10395 10396// IsEmpty returns true if the ListResult contains no values. 10397func (rdmdlr RestorableDroppedManagedDatabaseListResult) IsEmpty() bool { 10398 return rdmdlr.Value == nil || len(*rdmdlr.Value) == 0 10399} 10400 10401// hasNextLink returns true if the NextLink is not empty. 10402func (rdmdlr RestorableDroppedManagedDatabaseListResult) hasNextLink() bool { 10403 return rdmdlr.NextLink != nil && len(*rdmdlr.NextLink) != 0 10404} 10405 10406// restorableDroppedManagedDatabaseListResultPreparer prepares a request to retrieve the next set of results. 10407// It returns nil if no more results exist. 10408func (rdmdlr RestorableDroppedManagedDatabaseListResult) restorableDroppedManagedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { 10409 if !rdmdlr.hasNextLink() { 10410 return nil, nil 10411 } 10412 return autorest.Prepare((&http.Request{}).WithContext(ctx), 10413 autorest.AsJSON(), 10414 autorest.AsGet(), 10415 autorest.WithBaseURL(to.String(rdmdlr.NextLink))) 10416} 10417 10418// RestorableDroppedManagedDatabaseListResultPage contains a page of RestorableDroppedManagedDatabase 10419// values. 10420type RestorableDroppedManagedDatabaseListResultPage struct { 10421 fn func(context.Context, RestorableDroppedManagedDatabaseListResult) (RestorableDroppedManagedDatabaseListResult, error) 10422 rdmdlr RestorableDroppedManagedDatabaseListResult 10423} 10424 10425// NextWithContext advances to the next page of values. If there was an error making 10426// the request the page does not advance and the error is returned. 10427func (page *RestorableDroppedManagedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { 10428 if tracing.IsEnabled() { 10429 ctx = tracing.StartSpan(ctx, fqdn+"/RestorableDroppedManagedDatabaseListResultPage.NextWithContext") 10430 defer func() { 10431 sc := -1 10432 if page.Response().Response.Response != nil { 10433 sc = page.Response().Response.Response.StatusCode 10434 } 10435 tracing.EndSpan(ctx, sc, err) 10436 }() 10437 } 10438 for { 10439 next, err := page.fn(ctx, page.rdmdlr) 10440 if err != nil { 10441 return err 10442 } 10443 page.rdmdlr = next 10444 if !next.hasNextLink() || !next.IsEmpty() { 10445 break 10446 } 10447 } 10448 return nil 10449} 10450 10451// Next advances to the next page of values. If there was an error making 10452// the request the page does not advance and the error is returned. 10453// Deprecated: Use NextWithContext() instead. 10454func (page *RestorableDroppedManagedDatabaseListResultPage) Next() error { 10455 return page.NextWithContext(context.Background()) 10456} 10457 10458// NotDone returns true if the page enumeration should be started or is not yet complete. 10459func (page RestorableDroppedManagedDatabaseListResultPage) NotDone() bool { 10460 return !page.rdmdlr.IsEmpty() 10461} 10462 10463// Response returns the raw server response from the last page request. 10464func (page RestorableDroppedManagedDatabaseListResultPage) Response() RestorableDroppedManagedDatabaseListResult { 10465 return page.rdmdlr 10466} 10467 10468// Values returns the slice of values for the current page or nil if there are no values. 10469func (page RestorableDroppedManagedDatabaseListResultPage) Values() []RestorableDroppedManagedDatabase { 10470 if page.rdmdlr.IsEmpty() { 10471 return nil 10472 } 10473 return *page.rdmdlr.Value 10474} 10475 10476// Creates a new instance of the RestorableDroppedManagedDatabaseListResultPage type. 10477func NewRestorableDroppedManagedDatabaseListResultPage(cur RestorableDroppedManagedDatabaseListResult, getNextPage func(context.Context, RestorableDroppedManagedDatabaseListResult) (RestorableDroppedManagedDatabaseListResult, error)) RestorableDroppedManagedDatabaseListResultPage { 10478 return RestorableDroppedManagedDatabaseListResultPage{ 10479 fn: getNextPage, 10480 rdmdlr: cur, 10481 } 10482} 10483 10484// RestorableDroppedManagedDatabaseProperties the restorable dropped managed database's properties. 10485type RestorableDroppedManagedDatabaseProperties struct { 10486 // DatabaseName - READ-ONLY; The name of the database. 10487 DatabaseName *string `json:"databaseName,omitempty"` 10488 // CreationDate - READ-ONLY; The creation date of the database (ISO8601 format). 10489 CreationDate *date.Time `json:"creationDate,omitempty"` 10490 // DeletionDate - READ-ONLY; The deletion date of the database (ISO8601 format). 10491 DeletionDate *date.Time `json:"deletionDate,omitempty"` 10492 // EarliestRestoreDate - READ-ONLY; The earliest restore date of the database (ISO8601 format). 10493 EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` 10494} 10495 10496// MarshalJSON is the custom marshaler for RestorableDroppedManagedDatabaseProperties. 10497func (rdmdp RestorableDroppedManagedDatabaseProperties) MarshalJSON() ([]byte, error) { 10498 objectMap := make(map[string]interface{}) 10499 return json.Marshal(objectMap) 10500} 10501 10502// RestorePoint database restore points. 10503type RestorePoint struct { 10504 autorest.Response `json:"-"` 10505 // Location - READ-ONLY; Resource location. 10506 Location *string `json:"location,omitempty"` 10507 // RestorePointProperties - Resource properties. 10508 *RestorePointProperties `json:"properties,omitempty"` 10509 // ID - READ-ONLY; Resource ID. 10510 ID *string `json:"id,omitempty"` 10511 // Name - READ-ONLY; Resource name. 10512 Name *string `json:"name,omitempty"` 10513 // Type - READ-ONLY; Resource type. 10514 Type *string `json:"type,omitempty"` 10515} 10516 10517// MarshalJSON is the custom marshaler for RestorePoint. 10518func (rp RestorePoint) MarshalJSON() ([]byte, error) { 10519 objectMap := make(map[string]interface{}) 10520 if rp.RestorePointProperties != nil { 10521 objectMap["properties"] = rp.RestorePointProperties 10522 } 10523 return json.Marshal(objectMap) 10524} 10525 10526// UnmarshalJSON is the custom unmarshaler for RestorePoint struct. 10527func (rp *RestorePoint) UnmarshalJSON(body []byte) error { 10528 var m map[string]*json.RawMessage 10529 err := json.Unmarshal(body, &m) 10530 if err != nil { 10531 return err 10532 } 10533 for k, v := range m { 10534 switch k { 10535 case "location": 10536 if v != nil { 10537 var location string 10538 err = json.Unmarshal(*v, &location) 10539 if err != nil { 10540 return err 10541 } 10542 rp.Location = &location 10543 } 10544 case "properties": 10545 if v != nil { 10546 var restorePointProperties RestorePointProperties 10547 err = json.Unmarshal(*v, &restorePointProperties) 10548 if err != nil { 10549 return err 10550 } 10551 rp.RestorePointProperties = &restorePointProperties 10552 } 10553 case "id": 10554 if v != nil { 10555 var ID string 10556 err = json.Unmarshal(*v, &ID) 10557 if err != nil { 10558 return err 10559 } 10560 rp.ID = &ID 10561 } 10562 case "name": 10563 if v != nil { 10564 var name string 10565 err = json.Unmarshal(*v, &name) 10566 if err != nil { 10567 return err 10568 } 10569 rp.Name = &name 10570 } 10571 case "type": 10572 if v != nil { 10573 var typeVar string 10574 err = json.Unmarshal(*v, &typeVar) 10575 if err != nil { 10576 return err 10577 } 10578 rp.Type = &typeVar 10579 } 10580 } 10581 } 10582 10583 return nil 10584} 10585 10586// RestorePointListResult a list of long term retention backups. 10587type RestorePointListResult struct { 10588 autorest.Response `json:"-"` 10589 // Value - READ-ONLY; Array of results. 10590 Value *[]RestorePoint `json:"value,omitempty"` 10591 // NextLink - READ-ONLY; Link to retrieve next page of results. 10592 NextLink *string `json:"nextLink,omitempty"` 10593} 10594 10595// MarshalJSON is the custom marshaler for RestorePointListResult. 10596func (rplr RestorePointListResult) MarshalJSON() ([]byte, error) { 10597 objectMap := make(map[string]interface{}) 10598 return json.Marshal(objectMap) 10599} 10600 10601// RestorePointProperties properties of a database restore point 10602type RestorePointProperties struct { 10603 // RestorePointType - READ-ONLY; The type of restore point. Possible values include: 'CONTINUOUS', 'DISCRETE' 10604 RestorePointType RestorePointType `json:"restorePointType,omitempty"` 10605 // EarliestRestoreDate - READ-ONLY; The earliest time to which this database can be restored 10606 EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` 10607 // RestorePointCreationDate - READ-ONLY; The time the backup was taken 10608 RestorePointCreationDate *date.Time `json:"restorePointCreationDate,omitempty"` 10609 // RestorePointLabel - READ-ONLY; The label of restore point for backup request by user 10610 RestorePointLabel *string `json:"restorePointLabel,omitempty"` 10611} 10612 10613// MarshalJSON is the custom marshaler for RestorePointProperties. 10614func (rpp RestorePointProperties) MarshalJSON() ([]byte, error) { 10615 objectMap := make(map[string]interface{}) 10616 return json.Marshal(objectMap) 10617} 10618 10619// RestorePointsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 10620// operation. 10621type RestorePointsCreateFuture struct { 10622 azure.FutureAPI 10623 // Result returns the result of the asynchronous operation. 10624 // If the operation has not completed it will return an error. 10625 Result func(RestorePointsClient) (RestorePoint, error) 10626} 10627 10628// UnmarshalJSON is the custom unmarshaller for CreateFuture. 10629func (future *RestorePointsCreateFuture) UnmarshalJSON(body []byte) error { 10630 var azFuture azure.Future 10631 if err := json.Unmarshal(body, &azFuture); err != nil { 10632 return err 10633 } 10634 future.FutureAPI = &azFuture 10635 future.Result = future.result 10636 return nil 10637} 10638 10639// result is the default implementation for RestorePointsCreateFuture.Result. 10640func (future *RestorePointsCreateFuture) result(client RestorePointsClient) (rp RestorePoint, err error) { 10641 var done bool 10642 done, err = future.DoneWithContext(context.Background(), client) 10643 if err != nil { 10644 err = autorest.NewErrorWithError(err, "sql.RestorePointsCreateFuture", "Result", future.Response(), "Polling failure") 10645 return 10646 } 10647 if !done { 10648 rp.Response.Response = future.Response() 10649 err = azure.NewAsyncOpIncompleteError("sql.RestorePointsCreateFuture") 10650 return 10651 } 10652 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 10653 if rp.Response.Response, err = future.GetResult(sender); err == nil && rp.Response.Response.StatusCode != http.StatusNoContent { 10654 rp, err = client.CreateResponder(rp.Response.Response) 10655 if err != nil { 10656 err = autorest.NewErrorWithError(err, "sql.RestorePointsCreateFuture", "Result", rp.Response.Response, "Failure responding to request") 10657 } 10658 } 10659 return 10660} 10661 10662// SecurityAlertPolicyProperties properties of a security alert policy. 10663type SecurityAlertPolicyProperties struct { 10664 // State - Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database. Possible values include: 'SecurityAlertPolicyStateNew', 'SecurityAlertPolicyStateEnabled', 'SecurityAlertPolicyStateDisabled' 10665 State SecurityAlertPolicyState `json:"state,omitempty"` 10666 // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action 10667 DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` 10668 // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. 10669 EmailAddresses *[]string `json:"emailAddresses,omitempty"` 10670 // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. 10671 EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` 10672 // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. 10673 StorageEndpoint *string `json:"storageEndpoint,omitempty"` 10674 // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. 10675 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 10676 // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. 10677 RetentionDays *int32 `json:"retentionDays,omitempty"` 10678 // CreationTime - READ-ONLY; Specifies the UTC creation time of the policy. 10679 CreationTime *date.Time `json:"creationTime,omitempty"` 10680} 10681 10682// MarshalJSON is the custom marshaler for SecurityAlertPolicyProperties. 10683func (sapp SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { 10684 objectMap := make(map[string]interface{}) 10685 if sapp.State != "" { 10686 objectMap["state"] = sapp.State 10687 } 10688 if sapp.DisabledAlerts != nil { 10689 objectMap["disabledAlerts"] = sapp.DisabledAlerts 10690 } 10691 if sapp.EmailAddresses != nil { 10692 objectMap["emailAddresses"] = sapp.EmailAddresses 10693 } 10694 if sapp.EmailAccountAdmins != nil { 10695 objectMap["emailAccountAdmins"] = sapp.EmailAccountAdmins 10696 } 10697 if sapp.StorageEndpoint != nil { 10698 objectMap["storageEndpoint"] = sapp.StorageEndpoint 10699 } 10700 if sapp.StorageAccountAccessKey != nil { 10701 objectMap["storageAccountAccessKey"] = sapp.StorageAccountAccessKey 10702 } 10703 if sapp.RetentionDays != nil { 10704 objectMap["retentionDays"] = sapp.RetentionDays 10705 } 10706 return json.Marshal(objectMap) 10707} 10708 10709// SensitivityLabel a sensitivity label. 10710type SensitivityLabel struct { 10711 autorest.Response `json:"-"` 10712 // SensitivityLabelProperties - Resource properties. 10713 *SensitivityLabelProperties `json:"properties,omitempty"` 10714 // ID - READ-ONLY; Resource ID. 10715 ID *string `json:"id,omitempty"` 10716 // Name - READ-ONLY; Resource name. 10717 Name *string `json:"name,omitempty"` 10718 // Type - READ-ONLY; Resource type. 10719 Type *string `json:"type,omitempty"` 10720} 10721 10722// MarshalJSON is the custom marshaler for SensitivityLabel. 10723func (sl SensitivityLabel) MarshalJSON() ([]byte, error) { 10724 objectMap := make(map[string]interface{}) 10725 if sl.SensitivityLabelProperties != nil { 10726 objectMap["properties"] = sl.SensitivityLabelProperties 10727 } 10728 return json.Marshal(objectMap) 10729} 10730 10731// UnmarshalJSON is the custom unmarshaler for SensitivityLabel struct. 10732func (sl *SensitivityLabel) UnmarshalJSON(body []byte) error { 10733 var m map[string]*json.RawMessage 10734 err := json.Unmarshal(body, &m) 10735 if err != nil { 10736 return err 10737 } 10738 for k, v := range m { 10739 switch k { 10740 case "properties": 10741 if v != nil { 10742 var sensitivityLabelProperties SensitivityLabelProperties 10743 err = json.Unmarshal(*v, &sensitivityLabelProperties) 10744 if err != nil { 10745 return err 10746 } 10747 sl.SensitivityLabelProperties = &sensitivityLabelProperties 10748 } 10749 case "id": 10750 if v != nil { 10751 var ID string 10752 err = json.Unmarshal(*v, &ID) 10753 if err != nil { 10754 return err 10755 } 10756 sl.ID = &ID 10757 } 10758 case "name": 10759 if v != nil { 10760 var name string 10761 err = json.Unmarshal(*v, &name) 10762 if err != nil { 10763 return err 10764 } 10765 sl.Name = &name 10766 } 10767 case "type": 10768 if v != nil { 10769 var typeVar string 10770 err = json.Unmarshal(*v, &typeVar) 10771 if err != nil { 10772 return err 10773 } 10774 sl.Type = &typeVar 10775 } 10776 } 10777 } 10778 10779 return nil 10780} 10781 10782// SensitivityLabelListResult a list of sensitivity labels. 10783type SensitivityLabelListResult struct { 10784 autorest.Response `json:"-"` 10785 // Value - READ-ONLY; Array of results. 10786 Value *[]SensitivityLabel `json:"value,omitempty"` 10787 // NextLink - READ-ONLY; Link to retrieve next page of results. 10788 NextLink *string `json:"nextLink,omitempty"` 10789} 10790 10791// MarshalJSON is the custom marshaler for SensitivityLabelListResult. 10792func (sllr SensitivityLabelListResult) MarshalJSON() ([]byte, error) { 10793 objectMap := make(map[string]interface{}) 10794 return json.Marshal(objectMap) 10795} 10796 10797// SensitivityLabelListResultIterator provides access to a complete listing of SensitivityLabel values. 10798type SensitivityLabelListResultIterator struct { 10799 i int 10800 page SensitivityLabelListResultPage 10801} 10802 10803// NextWithContext advances to the next value. If there was an error making 10804// the request the iterator does not advance and the error is returned. 10805func (iter *SensitivityLabelListResultIterator) NextWithContext(ctx context.Context) (err error) { 10806 if tracing.IsEnabled() { 10807 ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultIterator.NextWithContext") 10808 defer func() { 10809 sc := -1 10810 if iter.Response().Response.Response != nil { 10811 sc = iter.Response().Response.Response.StatusCode 10812 } 10813 tracing.EndSpan(ctx, sc, err) 10814 }() 10815 } 10816 iter.i++ 10817 if iter.i < len(iter.page.Values()) { 10818 return nil 10819 } 10820 err = iter.page.NextWithContext(ctx) 10821 if err != nil { 10822 iter.i-- 10823 return err 10824 } 10825 iter.i = 0 10826 return nil 10827} 10828 10829// Next advances to the next value. If there was an error making 10830// the request the iterator does not advance and the error is returned. 10831// Deprecated: Use NextWithContext() instead. 10832func (iter *SensitivityLabelListResultIterator) Next() error { 10833 return iter.NextWithContext(context.Background()) 10834} 10835 10836// NotDone returns true if the enumeration should be started or is not yet complete. 10837func (iter SensitivityLabelListResultIterator) NotDone() bool { 10838 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 10839} 10840 10841// Response returns the raw server response from the last page request. 10842func (iter SensitivityLabelListResultIterator) Response() SensitivityLabelListResult { 10843 return iter.page.Response() 10844} 10845 10846// Value returns the current value or a zero-initialized value if the 10847// iterator has advanced beyond the end of the collection. 10848func (iter SensitivityLabelListResultIterator) Value() SensitivityLabel { 10849 if !iter.page.NotDone() { 10850 return SensitivityLabel{} 10851 } 10852 return iter.page.Values()[iter.i] 10853} 10854 10855// Creates a new instance of the SensitivityLabelListResultIterator type. 10856func NewSensitivityLabelListResultIterator(page SensitivityLabelListResultPage) SensitivityLabelListResultIterator { 10857 return SensitivityLabelListResultIterator{page: page} 10858} 10859 10860// IsEmpty returns true if the ListResult contains no values. 10861func (sllr SensitivityLabelListResult) IsEmpty() bool { 10862 return sllr.Value == nil || len(*sllr.Value) == 0 10863} 10864 10865// hasNextLink returns true if the NextLink is not empty. 10866func (sllr SensitivityLabelListResult) hasNextLink() bool { 10867 return sllr.NextLink != nil && len(*sllr.NextLink) != 0 10868} 10869 10870// sensitivityLabelListResultPreparer prepares a request to retrieve the next set of results. 10871// It returns nil if no more results exist. 10872func (sllr SensitivityLabelListResult) sensitivityLabelListResultPreparer(ctx context.Context) (*http.Request, error) { 10873 if !sllr.hasNextLink() { 10874 return nil, nil 10875 } 10876 return autorest.Prepare((&http.Request{}).WithContext(ctx), 10877 autorest.AsJSON(), 10878 autorest.AsGet(), 10879 autorest.WithBaseURL(to.String(sllr.NextLink))) 10880} 10881 10882// SensitivityLabelListResultPage contains a page of SensitivityLabel values. 10883type SensitivityLabelListResultPage struct { 10884 fn func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error) 10885 sllr SensitivityLabelListResult 10886} 10887 10888// NextWithContext advances to the next page of values. If there was an error making 10889// the request the page does not advance and the error is returned. 10890func (page *SensitivityLabelListResultPage) NextWithContext(ctx context.Context) (err error) { 10891 if tracing.IsEnabled() { 10892 ctx = tracing.StartSpan(ctx, fqdn+"/SensitivityLabelListResultPage.NextWithContext") 10893 defer func() { 10894 sc := -1 10895 if page.Response().Response.Response != nil { 10896 sc = page.Response().Response.Response.StatusCode 10897 } 10898 tracing.EndSpan(ctx, sc, err) 10899 }() 10900 } 10901 for { 10902 next, err := page.fn(ctx, page.sllr) 10903 if err != nil { 10904 return err 10905 } 10906 page.sllr = next 10907 if !next.hasNextLink() || !next.IsEmpty() { 10908 break 10909 } 10910 } 10911 return nil 10912} 10913 10914// Next advances to the next page of values. If there was an error making 10915// the request the page does not advance and the error is returned. 10916// Deprecated: Use NextWithContext() instead. 10917func (page *SensitivityLabelListResultPage) Next() error { 10918 return page.NextWithContext(context.Background()) 10919} 10920 10921// NotDone returns true if the page enumeration should be started or is not yet complete. 10922func (page SensitivityLabelListResultPage) NotDone() bool { 10923 return !page.sllr.IsEmpty() 10924} 10925 10926// Response returns the raw server response from the last page request. 10927func (page SensitivityLabelListResultPage) Response() SensitivityLabelListResult { 10928 return page.sllr 10929} 10930 10931// Values returns the slice of values for the current page or nil if there are no values. 10932func (page SensitivityLabelListResultPage) Values() []SensitivityLabel { 10933 if page.sllr.IsEmpty() { 10934 return nil 10935 } 10936 return *page.sllr.Value 10937} 10938 10939// Creates a new instance of the SensitivityLabelListResultPage type. 10940func NewSensitivityLabelListResultPage(cur SensitivityLabelListResult, getNextPage func(context.Context, SensitivityLabelListResult) (SensitivityLabelListResult, error)) SensitivityLabelListResultPage { 10941 return SensitivityLabelListResultPage{ 10942 fn: getNextPage, 10943 sllr: cur, 10944 } 10945} 10946 10947// SensitivityLabelProperties properties of a sensitivity label. 10948type SensitivityLabelProperties struct { 10949 // LabelName - The label name. 10950 LabelName *string `json:"labelName,omitempty"` 10951 // LabelID - The label ID. 10952 LabelID *string `json:"labelId,omitempty"` 10953 // InformationType - The information type. 10954 InformationType *string `json:"informationType,omitempty"` 10955 // InformationTypeID - The information type ID. 10956 InformationTypeID *string `json:"informationTypeId,omitempty"` 10957 // IsDisabled - READ-ONLY; Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. 10958 IsDisabled *bool `json:"isDisabled,omitempty"` 10959 // Rank - Possible values include: 'SensitivityLabelRankNone', 'SensitivityLabelRankLow', 'SensitivityLabelRankMedium', 'SensitivityLabelRankHigh', 'SensitivityLabelRankCritical' 10960 Rank SensitivityLabelRank `json:"rank,omitempty"` 10961} 10962 10963// MarshalJSON is the custom marshaler for SensitivityLabelProperties. 10964func (slp SensitivityLabelProperties) MarshalJSON() ([]byte, error) { 10965 objectMap := make(map[string]interface{}) 10966 if slp.LabelName != nil { 10967 objectMap["labelName"] = slp.LabelName 10968 } 10969 if slp.LabelID != nil { 10970 objectMap["labelId"] = slp.LabelID 10971 } 10972 if slp.InformationType != nil { 10973 objectMap["informationType"] = slp.InformationType 10974 } 10975 if slp.InformationTypeID != nil { 10976 objectMap["informationTypeId"] = slp.InformationTypeID 10977 } 10978 if slp.Rank != "" { 10979 objectMap["rank"] = slp.Rank 10980 } 10981 return json.Marshal(objectMap) 10982} 10983 10984// Server an Azure SQL Database server. 10985type Server struct { 10986 autorest.Response `json:"-"` 10987 // Identity - The Azure Active Directory identity of the server. 10988 Identity *ResourceIdentity `json:"identity,omitempty"` 10989 // Kind - READ-ONLY; Kind of sql server. This is metadata used for the Azure portal experience. 10990 Kind *string `json:"kind,omitempty"` 10991 // ServerProperties - Resource properties. 10992 *ServerProperties `json:"properties,omitempty"` 10993 // Location - Resource location. 10994 Location *string `json:"location,omitempty"` 10995 // Tags - Resource tags. 10996 Tags map[string]*string `json:"tags"` 10997 // ID - READ-ONLY; Resource ID. 10998 ID *string `json:"id,omitempty"` 10999 // Name - READ-ONLY; Resource name. 11000 Name *string `json:"name,omitempty"` 11001 // Type - READ-ONLY; Resource type. 11002 Type *string `json:"type,omitempty"` 11003} 11004 11005// MarshalJSON is the custom marshaler for Server. 11006func (s Server) MarshalJSON() ([]byte, error) { 11007 objectMap := make(map[string]interface{}) 11008 if s.Identity != nil { 11009 objectMap["identity"] = s.Identity 11010 } 11011 if s.ServerProperties != nil { 11012 objectMap["properties"] = s.ServerProperties 11013 } 11014 if s.Location != nil { 11015 objectMap["location"] = s.Location 11016 } 11017 if s.Tags != nil { 11018 objectMap["tags"] = s.Tags 11019 } 11020 return json.Marshal(objectMap) 11021} 11022 11023// UnmarshalJSON is the custom unmarshaler for Server struct. 11024func (s *Server) UnmarshalJSON(body []byte) error { 11025 var m map[string]*json.RawMessage 11026 err := json.Unmarshal(body, &m) 11027 if err != nil { 11028 return err 11029 } 11030 for k, v := range m { 11031 switch k { 11032 case "identity": 11033 if v != nil { 11034 var identity ResourceIdentity 11035 err = json.Unmarshal(*v, &identity) 11036 if err != nil { 11037 return err 11038 } 11039 s.Identity = &identity 11040 } 11041 case "kind": 11042 if v != nil { 11043 var kind string 11044 err = json.Unmarshal(*v, &kind) 11045 if err != nil { 11046 return err 11047 } 11048 s.Kind = &kind 11049 } 11050 case "properties": 11051 if v != nil { 11052 var serverProperties ServerProperties 11053 err = json.Unmarshal(*v, &serverProperties) 11054 if err != nil { 11055 return err 11056 } 11057 s.ServerProperties = &serverProperties 11058 } 11059 case "location": 11060 if v != nil { 11061 var location string 11062 err = json.Unmarshal(*v, &location) 11063 if err != nil { 11064 return err 11065 } 11066 s.Location = &location 11067 } 11068 case "tags": 11069 if v != nil { 11070 var tags map[string]*string 11071 err = json.Unmarshal(*v, &tags) 11072 if err != nil { 11073 return err 11074 } 11075 s.Tags = tags 11076 } 11077 case "id": 11078 if v != nil { 11079 var ID string 11080 err = json.Unmarshal(*v, &ID) 11081 if err != nil { 11082 return err 11083 } 11084 s.ID = &ID 11085 } 11086 case "name": 11087 if v != nil { 11088 var name string 11089 err = json.Unmarshal(*v, &name) 11090 if err != nil { 11091 return err 11092 } 11093 s.Name = &name 11094 } 11095 case "type": 11096 if v != nil { 11097 var typeVar string 11098 err = json.Unmarshal(*v, &typeVar) 11099 if err != nil { 11100 return err 11101 } 11102 s.Type = &typeVar 11103 } 11104 } 11105 } 11106 11107 return nil 11108} 11109 11110// ServerAdministratorListResult the response to a list Active Directory Administrators request. 11111type ServerAdministratorListResult struct { 11112 autorest.Response `json:"-"` 11113 // Value - The list of server Active Directory Administrators for the server. 11114 Value *[]ServerAzureADAdministrator `json:"value,omitempty"` 11115} 11116 11117// ServerAdministratorProperties the properties of an server Administrator. 11118type ServerAdministratorProperties struct { 11119 // AdministratorType - The type of administrator. 11120 AdministratorType *string `json:"administratorType,omitempty"` 11121 // Login - The server administrator login value. 11122 Login *string `json:"login,omitempty"` 11123 // Sid - The server administrator Sid (Secure ID). 11124 Sid *uuid.UUID `json:"sid,omitempty"` 11125 // TenantID - The server Active Directory Administrator tenant id. 11126 TenantID *uuid.UUID `json:"tenantId,omitempty"` 11127} 11128 11129// ServerAutomaticTuning server-level Automatic Tuning. 11130type ServerAutomaticTuning struct { 11131 autorest.Response `json:"-"` 11132 // AutomaticTuningServerProperties - Resource properties. 11133 *AutomaticTuningServerProperties `json:"properties,omitempty"` 11134 // ID - READ-ONLY; Resource ID. 11135 ID *string `json:"id,omitempty"` 11136 // Name - READ-ONLY; Resource name. 11137 Name *string `json:"name,omitempty"` 11138 // Type - READ-ONLY; Resource type. 11139 Type *string `json:"type,omitempty"` 11140} 11141 11142// MarshalJSON is the custom marshaler for ServerAutomaticTuning. 11143func (sat ServerAutomaticTuning) MarshalJSON() ([]byte, error) { 11144 objectMap := make(map[string]interface{}) 11145 if sat.AutomaticTuningServerProperties != nil { 11146 objectMap["properties"] = sat.AutomaticTuningServerProperties 11147 } 11148 return json.Marshal(objectMap) 11149} 11150 11151// UnmarshalJSON is the custom unmarshaler for ServerAutomaticTuning struct. 11152func (sat *ServerAutomaticTuning) UnmarshalJSON(body []byte) error { 11153 var m map[string]*json.RawMessage 11154 err := json.Unmarshal(body, &m) 11155 if err != nil { 11156 return err 11157 } 11158 for k, v := range m { 11159 switch k { 11160 case "properties": 11161 if v != nil { 11162 var automaticTuningServerProperties AutomaticTuningServerProperties 11163 err = json.Unmarshal(*v, &automaticTuningServerProperties) 11164 if err != nil { 11165 return err 11166 } 11167 sat.AutomaticTuningServerProperties = &automaticTuningServerProperties 11168 } 11169 case "id": 11170 if v != nil { 11171 var ID string 11172 err = json.Unmarshal(*v, &ID) 11173 if err != nil { 11174 return err 11175 } 11176 sat.ID = &ID 11177 } 11178 case "name": 11179 if v != nil { 11180 var name string 11181 err = json.Unmarshal(*v, &name) 11182 if err != nil { 11183 return err 11184 } 11185 sat.Name = &name 11186 } 11187 case "type": 11188 if v != nil { 11189 var typeVar string 11190 err = json.Unmarshal(*v, &typeVar) 11191 if err != nil { 11192 return err 11193 } 11194 sat.Type = &typeVar 11195 } 11196 } 11197 } 11198 11199 return nil 11200} 11201 11202// ServerAzureADAdministrator an server Active Directory Administrator. 11203type ServerAzureADAdministrator struct { 11204 autorest.Response `json:"-"` 11205 // ServerAdministratorProperties - The properties of the resource. 11206 *ServerAdministratorProperties `json:"properties,omitempty"` 11207 // ID - READ-ONLY; Resource ID. 11208 ID *string `json:"id,omitempty"` 11209 // Name - READ-ONLY; Resource name. 11210 Name *string `json:"name,omitempty"` 11211 // Type - READ-ONLY; Resource type. 11212 Type *string `json:"type,omitempty"` 11213} 11214 11215// MarshalJSON is the custom marshaler for ServerAzureADAdministrator. 11216func (saaa ServerAzureADAdministrator) MarshalJSON() ([]byte, error) { 11217 objectMap := make(map[string]interface{}) 11218 if saaa.ServerAdministratorProperties != nil { 11219 objectMap["properties"] = saaa.ServerAdministratorProperties 11220 } 11221 return json.Marshal(objectMap) 11222} 11223 11224// UnmarshalJSON is the custom unmarshaler for ServerAzureADAdministrator struct. 11225func (saaa *ServerAzureADAdministrator) UnmarshalJSON(body []byte) error { 11226 var m map[string]*json.RawMessage 11227 err := json.Unmarshal(body, &m) 11228 if err != nil { 11229 return err 11230 } 11231 for k, v := range m { 11232 switch k { 11233 case "properties": 11234 if v != nil { 11235 var serverAdministratorProperties ServerAdministratorProperties 11236 err = json.Unmarshal(*v, &serverAdministratorProperties) 11237 if err != nil { 11238 return err 11239 } 11240 saaa.ServerAdministratorProperties = &serverAdministratorProperties 11241 } 11242 case "id": 11243 if v != nil { 11244 var ID string 11245 err = json.Unmarshal(*v, &ID) 11246 if err != nil { 11247 return err 11248 } 11249 saaa.ID = &ID 11250 } 11251 case "name": 11252 if v != nil { 11253 var name string 11254 err = json.Unmarshal(*v, &name) 11255 if err != nil { 11256 return err 11257 } 11258 saaa.Name = &name 11259 } 11260 case "type": 11261 if v != nil { 11262 var typeVar string 11263 err = json.Unmarshal(*v, &typeVar) 11264 if err != nil { 11265 return err 11266 } 11267 saaa.Type = &typeVar 11268 } 11269 } 11270 } 11271 11272 return nil 11273} 11274 11275// ServerAzureADAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 11276// of a long-running operation. 11277type ServerAzureADAdministratorsCreateOrUpdateFuture struct { 11278 azure.FutureAPI 11279 // Result returns the result of the asynchronous operation. 11280 // If the operation has not completed it will return an error. 11281 Result func(ServerAzureADAdministratorsClient) (ServerAzureADAdministrator, error) 11282} 11283 11284// UnmarshalJSON is the custom unmarshaller for CreateFuture. 11285func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 11286 var azFuture azure.Future 11287 if err := json.Unmarshal(body, &azFuture); err != nil { 11288 return err 11289 } 11290 future.FutureAPI = &azFuture 11291 future.Result = future.result 11292 return nil 11293} 11294 11295// result is the default implementation for ServerAzureADAdministratorsCreateOrUpdateFuture.Result. 11296func (future *ServerAzureADAdministratorsCreateOrUpdateFuture) result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { 11297 var done bool 11298 done, err = future.DoneWithContext(context.Background(), client) 11299 if err != nil { 11300 err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 11301 return 11302 } 11303 if !done { 11304 saaa.Response.Response = future.Response() 11305 err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsCreateOrUpdateFuture") 11306 return 11307 } 11308 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 11309 if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent { 11310 saaa, err = client.CreateOrUpdateResponder(saaa.Response.Response) 11311 if err != nil { 11312 err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsCreateOrUpdateFuture", "Result", saaa.Response.Response, "Failure responding to request") 11313 } 11314 } 11315 return 11316} 11317 11318// ServerAzureADAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a 11319// long-running operation. 11320type ServerAzureADAdministratorsDeleteFuture struct { 11321 azure.FutureAPI 11322 // Result returns the result of the asynchronous operation. 11323 // If the operation has not completed it will return an error. 11324 Result func(ServerAzureADAdministratorsClient) (ServerAzureADAdministrator, error) 11325} 11326 11327// UnmarshalJSON is the custom unmarshaller for CreateFuture. 11328func (future *ServerAzureADAdministratorsDeleteFuture) UnmarshalJSON(body []byte) error { 11329 var azFuture azure.Future 11330 if err := json.Unmarshal(body, &azFuture); err != nil { 11331 return err 11332 } 11333 future.FutureAPI = &azFuture 11334 future.Result = future.result 11335 return nil 11336} 11337 11338// result is the default implementation for ServerAzureADAdministratorsDeleteFuture.Result. 11339func (future *ServerAzureADAdministratorsDeleteFuture) result(client ServerAzureADAdministratorsClient) (saaa ServerAzureADAdministrator, err error) { 11340 var done bool 11341 done, err = future.DoneWithContext(context.Background(), client) 11342 if err != nil { 11343 err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") 11344 return 11345 } 11346 if !done { 11347 saaa.Response.Response = future.Response() 11348 err = azure.NewAsyncOpIncompleteError("sql.ServerAzureADAdministratorsDeleteFuture") 11349 return 11350 } 11351 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 11352 if saaa.Response.Response, err = future.GetResult(sender); err == nil && saaa.Response.Response.StatusCode != http.StatusNoContent { 11353 saaa, err = client.DeleteResponder(saaa.Response.Response) 11354 if err != nil { 11355 err = autorest.NewErrorWithError(err, "sql.ServerAzureADAdministratorsDeleteFuture", "Result", saaa.Response.Response, "Failure responding to request") 11356 } 11357 } 11358 return 11359} 11360 11361// ServerBlobAuditingPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 11362// of a long-running operation. 11363type ServerBlobAuditingPoliciesCreateOrUpdateFuture struct { 11364 azure.FutureAPI 11365 // Result returns the result of the asynchronous operation. 11366 // If the operation has not completed it will return an error. 11367 Result func(ServerBlobAuditingPoliciesClient) (ServerBlobAuditingPolicy, error) 11368} 11369 11370// UnmarshalJSON is the custom unmarshaller for CreateFuture. 11371func (future *ServerBlobAuditingPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 11372 var azFuture azure.Future 11373 if err := json.Unmarshal(body, &azFuture); err != nil { 11374 return err 11375 } 11376 future.FutureAPI = &azFuture 11377 future.Result = future.result 11378 return nil 11379} 11380 11381// result is the default implementation for ServerBlobAuditingPoliciesCreateOrUpdateFuture.Result. 11382func (future *ServerBlobAuditingPoliciesCreateOrUpdateFuture) result(client ServerBlobAuditingPoliciesClient) (sbap ServerBlobAuditingPolicy, err error) { 11383 var done bool 11384 done, err = future.DoneWithContext(context.Background(), client) 11385 if err != nil { 11386 err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 11387 return 11388 } 11389 if !done { 11390 sbap.Response.Response = future.Response() 11391 err = azure.NewAsyncOpIncompleteError("sql.ServerBlobAuditingPoliciesCreateOrUpdateFuture") 11392 return 11393 } 11394 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 11395 if sbap.Response.Response, err = future.GetResult(sender); err == nil && sbap.Response.Response.StatusCode != http.StatusNoContent { 11396 sbap, err = client.CreateOrUpdateResponder(sbap.Response.Response) 11397 if err != nil { 11398 err = autorest.NewErrorWithError(err, "sql.ServerBlobAuditingPoliciesCreateOrUpdateFuture", "Result", sbap.Response.Response, "Failure responding to request") 11399 } 11400 } 11401 return 11402} 11403 11404// ServerBlobAuditingPolicy a server blob auditing policy. 11405type ServerBlobAuditingPolicy struct { 11406 autorest.Response `json:"-"` 11407 // ServerBlobAuditingPolicyProperties - Resource properties. 11408 *ServerBlobAuditingPolicyProperties `json:"properties,omitempty"` 11409 // ID - READ-ONLY; Resource ID. 11410 ID *string `json:"id,omitempty"` 11411 // Name - READ-ONLY; Resource name. 11412 Name *string `json:"name,omitempty"` 11413 // Type - READ-ONLY; Resource type. 11414 Type *string `json:"type,omitempty"` 11415} 11416 11417// MarshalJSON is the custom marshaler for ServerBlobAuditingPolicy. 11418func (sbap ServerBlobAuditingPolicy) MarshalJSON() ([]byte, error) { 11419 objectMap := make(map[string]interface{}) 11420 if sbap.ServerBlobAuditingPolicyProperties != nil { 11421 objectMap["properties"] = sbap.ServerBlobAuditingPolicyProperties 11422 } 11423 return json.Marshal(objectMap) 11424} 11425 11426// UnmarshalJSON is the custom unmarshaler for ServerBlobAuditingPolicy struct. 11427func (sbap *ServerBlobAuditingPolicy) UnmarshalJSON(body []byte) error { 11428 var m map[string]*json.RawMessage 11429 err := json.Unmarshal(body, &m) 11430 if err != nil { 11431 return err 11432 } 11433 for k, v := range m { 11434 switch k { 11435 case "properties": 11436 if v != nil { 11437 var serverBlobAuditingPolicyProperties ServerBlobAuditingPolicyProperties 11438 err = json.Unmarshal(*v, &serverBlobAuditingPolicyProperties) 11439 if err != nil { 11440 return err 11441 } 11442 sbap.ServerBlobAuditingPolicyProperties = &serverBlobAuditingPolicyProperties 11443 } 11444 case "id": 11445 if v != nil { 11446 var ID string 11447 err = json.Unmarshal(*v, &ID) 11448 if err != nil { 11449 return err 11450 } 11451 sbap.ID = &ID 11452 } 11453 case "name": 11454 if v != nil { 11455 var name string 11456 err = json.Unmarshal(*v, &name) 11457 if err != nil { 11458 return err 11459 } 11460 sbap.Name = &name 11461 } 11462 case "type": 11463 if v != nil { 11464 var typeVar string 11465 err = json.Unmarshal(*v, &typeVar) 11466 if err != nil { 11467 return err 11468 } 11469 sbap.Type = &typeVar 11470 } 11471 } 11472 } 11473 11474 return nil 11475} 11476 11477// ServerBlobAuditingPolicyListResult a list of server auditing settings. 11478type ServerBlobAuditingPolicyListResult struct { 11479 autorest.Response `json:"-"` 11480 // Value - READ-ONLY; Array of results. 11481 Value *[]ServerBlobAuditingPolicy `json:"value,omitempty"` 11482 // NextLink - READ-ONLY; Link to retrieve next page of results. 11483 NextLink *string `json:"nextLink,omitempty"` 11484} 11485 11486// MarshalJSON is the custom marshaler for ServerBlobAuditingPolicyListResult. 11487func (sbaplr ServerBlobAuditingPolicyListResult) MarshalJSON() ([]byte, error) { 11488 objectMap := make(map[string]interface{}) 11489 return json.Marshal(objectMap) 11490} 11491 11492// ServerBlobAuditingPolicyListResultIterator provides access to a complete listing of 11493// ServerBlobAuditingPolicy values. 11494type ServerBlobAuditingPolicyListResultIterator struct { 11495 i int 11496 page ServerBlobAuditingPolicyListResultPage 11497} 11498 11499// NextWithContext advances to the next value. If there was an error making 11500// the request the iterator does not advance and the error is returned. 11501func (iter *ServerBlobAuditingPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { 11502 if tracing.IsEnabled() { 11503 ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPolicyListResultIterator.NextWithContext") 11504 defer func() { 11505 sc := -1 11506 if iter.Response().Response.Response != nil { 11507 sc = iter.Response().Response.Response.StatusCode 11508 } 11509 tracing.EndSpan(ctx, sc, err) 11510 }() 11511 } 11512 iter.i++ 11513 if iter.i < len(iter.page.Values()) { 11514 return nil 11515 } 11516 err = iter.page.NextWithContext(ctx) 11517 if err != nil { 11518 iter.i-- 11519 return err 11520 } 11521 iter.i = 0 11522 return nil 11523} 11524 11525// Next advances to the next value. If there was an error making 11526// the request the iterator does not advance and the error is returned. 11527// Deprecated: Use NextWithContext() instead. 11528func (iter *ServerBlobAuditingPolicyListResultIterator) Next() error { 11529 return iter.NextWithContext(context.Background()) 11530} 11531 11532// NotDone returns true if the enumeration should be started or is not yet complete. 11533func (iter ServerBlobAuditingPolicyListResultIterator) NotDone() bool { 11534 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 11535} 11536 11537// Response returns the raw server response from the last page request. 11538func (iter ServerBlobAuditingPolicyListResultIterator) Response() ServerBlobAuditingPolicyListResult { 11539 return iter.page.Response() 11540} 11541 11542// Value returns the current value or a zero-initialized value if the 11543// iterator has advanced beyond the end of the collection. 11544func (iter ServerBlobAuditingPolicyListResultIterator) Value() ServerBlobAuditingPolicy { 11545 if !iter.page.NotDone() { 11546 return ServerBlobAuditingPolicy{} 11547 } 11548 return iter.page.Values()[iter.i] 11549} 11550 11551// Creates a new instance of the ServerBlobAuditingPolicyListResultIterator type. 11552func NewServerBlobAuditingPolicyListResultIterator(page ServerBlobAuditingPolicyListResultPage) ServerBlobAuditingPolicyListResultIterator { 11553 return ServerBlobAuditingPolicyListResultIterator{page: page} 11554} 11555 11556// IsEmpty returns true if the ListResult contains no values. 11557func (sbaplr ServerBlobAuditingPolicyListResult) IsEmpty() bool { 11558 return sbaplr.Value == nil || len(*sbaplr.Value) == 0 11559} 11560 11561// hasNextLink returns true if the NextLink is not empty. 11562func (sbaplr ServerBlobAuditingPolicyListResult) hasNextLink() bool { 11563 return sbaplr.NextLink != nil && len(*sbaplr.NextLink) != 0 11564} 11565 11566// serverBlobAuditingPolicyListResultPreparer prepares a request to retrieve the next set of results. 11567// It returns nil if no more results exist. 11568func (sbaplr ServerBlobAuditingPolicyListResult) serverBlobAuditingPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { 11569 if !sbaplr.hasNextLink() { 11570 return nil, nil 11571 } 11572 return autorest.Prepare((&http.Request{}).WithContext(ctx), 11573 autorest.AsJSON(), 11574 autorest.AsGet(), 11575 autorest.WithBaseURL(to.String(sbaplr.NextLink))) 11576} 11577 11578// ServerBlobAuditingPolicyListResultPage contains a page of ServerBlobAuditingPolicy values. 11579type ServerBlobAuditingPolicyListResultPage struct { 11580 fn func(context.Context, ServerBlobAuditingPolicyListResult) (ServerBlobAuditingPolicyListResult, error) 11581 sbaplr ServerBlobAuditingPolicyListResult 11582} 11583 11584// NextWithContext advances to the next page of values. If there was an error making 11585// the request the page does not advance and the error is returned. 11586func (page *ServerBlobAuditingPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { 11587 if tracing.IsEnabled() { 11588 ctx = tracing.StartSpan(ctx, fqdn+"/ServerBlobAuditingPolicyListResultPage.NextWithContext") 11589 defer func() { 11590 sc := -1 11591 if page.Response().Response.Response != nil { 11592 sc = page.Response().Response.Response.StatusCode 11593 } 11594 tracing.EndSpan(ctx, sc, err) 11595 }() 11596 } 11597 for { 11598 next, err := page.fn(ctx, page.sbaplr) 11599 if err != nil { 11600 return err 11601 } 11602 page.sbaplr = next 11603 if !next.hasNextLink() || !next.IsEmpty() { 11604 break 11605 } 11606 } 11607 return nil 11608} 11609 11610// Next advances to the next page of values. If there was an error making 11611// the request the page does not advance and the error is returned. 11612// Deprecated: Use NextWithContext() instead. 11613func (page *ServerBlobAuditingPolicyListResultPage) Next() error { 11614 return page.NextWithContext(context.Background()) 11615} 11616 11617// NotDone returns true if the page enumeration should be started or is not yet complete. 11618func (page ServerBlobAuditingPolicyListResultPage) NotDone() bool { 11619 return !page.sbaplr.IsEmpty() 11620} 11621 11622// Response returns the raw server response from the last page request. 11623func (page ServerBlobAuditingPolicyListResultPage) Response() ServerBlobAuditingPolicyListResult { 11624 return page.sbaplr 11625} 11626 11627// Values returns the slice of values for the current page or nil if there are no values. 11628func (page ServerBlobAuditingPolicyListResultPage) Values() []ServerBlobAuditingPolicy { 11629 if page.sbaplr.IsEmpty() { 11630 return nil 11631 } 11632 return *page.sbaplr.Value 11633} 11634 11635// Creates a new instance of the ServerBlobAuditingPolicyListResultPage type. 11636func NewServerBlobAuditingPolicyListResultPage(cur ServerBlobAuditingPolicyListResult, getNextPage func(context.Context, ServerBlobAuditingPolicyListResult) (ServerBlobAuditingPolicyListResult, error)) ServerBlobAuditingPolicyListResultPage { 11637 return ServerBlobAuditingPolicyListResultPage{ 11638 fn: getNextPage, 11639 sbaplr: cur, 11640 } 11641} 11642 11643// ServerBlobAuditingPolicyProperties properties of a server blob auditing policy. 11644type ServerBlobAuditingPolicyProperties struct { 11645 // State - Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: 'BlobAuditingPolicyStateEnabled', 'BlobAuditingPolicyStateDisabled' 11646 State BlobAuditingPolicyState `json:"state,omitempty"` 11647 // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. 11648 StorageEndpoint *string `json:"storageEndpoint,omitempty"` 11649 // StorageAccountAccessKey - Specifies the identifier key of the auditing storage account. 11650 // If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. 11651 // Prerequisites for using managed identity authentication: 11652 // 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 11653 // 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server identity. 11654 // For more information, see [Auditing to storage using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355) 11655 StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` 11656 // RetentionDays - Specifies the number of days to keep in the audit logs in the storage account. 11657 RetentionDays *int32 `json:"retentionDays,omitempty"` 11658 // AuditActionsAndGroups - Specifies the Actions-Groups and Actions to audit. 11659 // 11660 // The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and failed logins: 11661 // 11662 // BATCH_COMPLETED_GROUP, 11663 // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, 11664 // FAILED_DATABASE_AUTHENTICATION_GROUP. 11665 // 11666 // This above combination is also the set that is configured by default when enabling auditing from the Azure portal. 11667 // 11668 // The supported action groups to audit are (note: choose only specific groups that cover your auditing needs. Using unnecessary groups could lead to very large quantities of audit records): 11669 // 11670 // APPLICATION_ROLE_CHANGE_PASSWORD_GROUP 11671 // BACKUP_RESTORE_GROUP 11672 // DATABASE_LOGOUT_GROUP 11673 // DATABASE_OBJECT_CHANGE_GROUP 11674 // DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP 11675 // DATABASE_OBJECT_PERMISSION_CHANGE_GROUP 11676 // DATABASE_OPERATION_GROUP 11677 // DATABASE_PERMISSION_CHANGE_GROUP 11678 // DATABASE_PRINCIPAL_CHANGE_GROUP 11679 // DATABASE_PRINCIPAL_IMPERSONATION_GROUP 11680 // DATABASE_ROLE_MEMBER_CHANGE_GROUP 11681 // FAILED_DATABASE_AUTHENTICATION_GROUP 11682 // SCHEMA_OBJECT_ACCESS_GROUP 11683 // SCHEMA_OBJECT_CHANGE_GROUP 11684 // SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP 11685 // SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP 11686 // SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP 11687 // USER_CHANGE_PASSWORD_GROUP 11688 // BATCH_STARTED_GROUP 11689 // BATCH_COMPLETED_GROUP 11690 // 11691 // These are groups that cover all sql statements and stored procedures executed against the database, and should not be used in combination with other groups as this will result in duplicate audit logs. 11692 // 11693 // For more information, see [Database-Level Audit Action Groups](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-action-groups). 11694 // 11695 // For Database auditing policy, specific Actions can also be specified (note that Actions cannot be specified for Server auditing policy). The supported actions to audit are: 11696 // SELECT 11697 // UPDATE 11698 // INSERT 11699 // DELETE 11700 // EXECUTE 11701 // RECEIVE 11702 // REFERENCES 11703 // 11704 // The general form for defining an action to be audited is: 11705 // {action} ON {object} BY {principal} 11706 // 11707 // Note that <object> in the above format can refer to an object like a table, view, or stored procedure, or an entire database or schema. For the latter cases, the forms DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. 11708 // 11709 // For example: 11710 // SELECT on dbo.myTable by public 11711 // SELECT on DATABASE::myDatabase by public 11712 // SELECT on SCHEMA::mySchema by public 11713 // 11714 // For more information, see [Database-Level Audit Actions](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) 11715 AuditActionsAndGroups *[]string `json:"auditActionsAndGroups,omitempty"` 11716 // StorageAccountSubscriptionID - Specifies the blob storage subscription Id. 11717 StorageAccountSubscriptionID *uuid.UUID `json:"storageAccountSubscriptionId,omitempty"` 11718 // IsStorageSecondaryKeyInUse - Specifies whether storageAccountAccessKey value is the storage's secondary key. 11719 IsStorageSecondaryKeyInUse *bool `json:"isStorageSecondaryKeyInUse,omitempty"` 11720 // IsAzureMonitorTargetEnabled - Specifies whether audit events are sent to Azure Monitor. 11721 // In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. 11722 // 11723 // When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. 11724 // Note that for server level audit you should use the 'master' database as {databaseName}. 11725 // 11726 // Diagnostic Settings URI format: 11727 // PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview 11728 // 11729 // For more information, see [Diagnostic Settings REST API](https://go.microsoft.com/fwlink/?linkid=2033207) 11730 // or [Diagnostic Settings PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) 11731 IsAzureMonitorTargetEnabled *bool `json:"isAzureMonitorTargetEnabled,omitempty"` 11732 // QueueDelayMs - Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. 11733 // The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. 11734 QueueDelayMs *int32 `json:"queueDelayMs,omitempty"` 11735} 11736 11737// ServerCommunicationLink server communication link. 11738type ServerCommunicationLink struct { 11739 autorest.Response `json:"-"` 11740 // ServerCommunicationLinkProperties - The properties of resource. 11741 *ServerCommunicationLinkProperties `json:"properties,omitempty"` 11742 // Location - READ-ONLY; Communication link location. 11743 Location *string `json:"location,omitempty"` 11744 // Kind - READ-ONLY; Communication link kind. This property is used for Azure Portal metadata. 11745 Kind *string `json:"kind,omitempty"` 11746 // ID - READ-ONLY; Resource ID. 11747 ID *string `json:"id,omitempty"` 11748 // Name - READ-ONLY; Resource name. 11749 Name *string `json:"name,omitempty"` 11750 // Type - READ-ONLY; Resource type. 11751 Type *string `json:"type,omitempty"` 11752} 11753 11754// MarshalJSON is the custom marshaler for ServerCommunicationLink. 11755func (scl ServerCommunicationLink) MarshalJSON() ([]byte, error) { 11756 objectMap := make(map[string]interface{}) 11757 if scl.ServerCommunicationLinkProperties != nil { 11758 objectMap["properties"] = scl.ServerCommunicationLinkProperties 11759 } 11760 return json.Marshal(objectMap) 11761} 11762 11763// UnmarshalJSON is the custom unmarshaler for ServerCommunicationLink struct. 11764func (scl *ServerCommunicationLink) UnmarshalJSON(body []byte) error { 11765 var m map[string]*json.RawMessage 11766 err := json.Unmarshal(body, &m) 11767 if err != nil { 11768 return err 11769 } 11770 for k, v := range m { 11771 switch k { 11772 case "properties": 11773 if v != nil { 11774 var serverCommunicationLinkProperties ServerCommunicationLinkProperties 11775 err = json.Unmarshal(*v, &serverCommunicationLinkProperties) 11776 if err != nil { 11777 return err 11778 } 11779 scl.ServerCommunicationLinkProperties = &serverCommunicationLinkProperties 11780 } 11781 case "location": 11782 if v != nil { 11783 var location string 11784 err = json.Unmarshal(*v, &location) 11785 if err != nil { 11786 return err 11787 } 11788 scl.Location = &location 11789 } 11790 case "kind": 11791 if v != nil { 11792 var kind string 11793 err = json.Unmarshal(*v, &kind) 11794 if err != nil { 11795 return err 11796 } 11797 scl.Kind = &kind 11798 } 11799 case "id": 11800 if v != nil { 11801 var ID string 11802 err = json.Unmarshal(*v, &ID) 11803 if err != nil { 11804 return err 11805 } 11806 scl.ID = &ID 11807 } 11808 case "name": 11809 if v != nil { 11810 var name string 11811 err = json.Unmarshal(*v, &name) 11812 if err != nil { 11813 return err 11814 } 11815 scl.Name = &name 11816 } 11817 case "type": 11818 if v != nil { 11819 var typeVar string 11820 err = json.Unmarshal(*v, &typeVar) 11821 if err != nil { 11822 return err 11823 } 11824 scl.Type = &typeVar 11825 } 11826 } 11827 } 11828 11829 return nil 11830} 11831 11832// ServerCommunicationLinkListResult a list of server communication links. 11833type ServerCommunicationLinkListResult struct { 11834 autorest.Response `json:"-"` 11835 // Value - The list of server communication links. 11836 Value *[]ServerCommunicationLink `json:"value,omitempty"` 11837} 11838 11839// ServerCommunicationLinkProperties the properties of a server communication link. 11840type ServerCommunicationLinkProperties struct { 11841 // State - READ-ONLY; The state. 11842 State *string `json:"state,omitempty"` 11843 // PartnerServer - The name of the partner server. 11844 PartnerServer *string `json:"partnerServer,omitempty"` 11845} 11846 11847// MarshalJSON is the custom marshaler for ServerCommunicationLinkProperties. 11848func (sclp ServerCommunicationLinkProperties) MarshalJSON() ([]byte, error) { 11849 objectMap := make(map[string]interface{}) 11850 if sclp.PartnerServer != nil { 11851 objectMap["partnerServer"] = sclp.PartnerServer 11852 } 11853 return json.Marshal(objectMap) 11854} 11855 11856// ServerCommunicationLinksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of 11857// a long-running operation. 11858type ServerCommunicationLinksCreateOrUpdateFuture struct { 11859 azure.FutureAPI 11860 // Result returns the result of the asynchronous operation. 11861 // If the operation has not completed it will return an error. 11862 Result func(ServerCommunicationLinksClient) (ServerCommunicationLink, error) 11863} 11864 11865// UnmarshalJSON is the custom unmarshaller for CreateFuture. 11866func (future *ServerCommunicationLinksCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 11867 var azFuture azure.Future 11868 if err := json.Unmarshal(body, &azFuture); err != nil { 11869 return err 11870 } 11871 future.FutureAPI = &azFuture 11872 future.Result = future.result 11873 return nil 11874} 11875 11876// result is the default implementation for ServerCommunicationLinksCreateOrUpdateFuture.Result. 11877func (future *ServerCommunicationLinksCreateOrUpdateFuture) result(client ServerCommunicationLinksClient) (scl ServerCommunicationLink, err error) { 11878 var done bool 11879 done, err = future.DoneWithContext(context.Background(), client) 11880 if err != nil { 11881 err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 11882 return 11883 } 11884 if !done { 11885 scl.Response.Response = future.Response() 11886 err = azure.NewAsyncOpIncompleteError("sql.ServerCommunicationLinksCreateOrUpdateFuture") 11887 return 11888 } 11889 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 11890 if scl.Response.Response, err = future.GetResult(sender); err == nil && scl.Response.Response.StatusCode != http.StatusNoContent { 11891 scl, err = client.CreateOrUpdateResponder(scl.Response.Response) 11892 if err != nil { 11893 err = autorest.NewErrorWithError(err, "sql.ServerCommunicationLinksCreateOrUpdateFuture", "Result", scl.Response.Response, "Failure responding to request") 11894 } 11895 } 11896 return 11897} 11898 11899// ServerConnectionPolicy a server secure connection policy. 11900type ServerConnectionPolicy struct { 11901 autorest.Response `json:"-"` 11902 // Kind - READ-ONLY; Metadata used for the Azure portal experience. 11903 Kind *string `json:"kind,omitempty"` 11904 // Location - READ-ONLY; Resource location. 11905 Location *string `json:"location,omitempty"` 11906 // ServerConnectionPolicyProperties - The properties of the server secure connection policy. 11907 *ServerConnectionPolicyProperties `json:"properties,omitempty"` 11908 // ID - READ-ONLY; Resource ID. 11909 ID *string `json:"id,omitempty"` 11910 // Name - READ-ONLY; Resource name. 11911 Name *string `json:"name,omitempty"` 11912 // Type - READ-ONLY; Resource type. 11913 Type *string `json:"type,omitempty"` 11914} 11915 11916// MarshalJSON is the custom marshaler for ServerConnectionPolicy. 11917func (scp ServerConnectionPolicy) MarshalJSON() ([]byte, error) { 11918 objectMap := make(map[string]interface{}) 11919 if scp.ServerConnectionPolicyProperties != nil { 11920 objectMap["properties"] = scp.ServerConnectionPolicyProperties 11921 } 11922 return json.Marshal(objectMap) 11923} 11924 11925// UnmarshalJSON is the custom unmarshaler for ServerConnectionPolicy struct. 11926func (scp *ServerConnectionPolicy) UnmarshalJSON(body []byte) error { 11927 var m map[string]*json.RawMessage 11928 err := json.Unmarshal(body, &m) 11929 if err != nil { 11930 return err 11931 } 11932 for k, v := range m { 11933 switch k { 11934 case "kind": 11935 if v != nil { 11936 var kind string 11937 err = json.Unmarshal(*v, &kind) 11938 if err != nil { 11939 return err 11940 } 11941 scp.Kind = &kind 11942 } 11943 case "location": 11944 if v != nil { 11945 var location string 11946 err = json.Unmarshal(*v, &location) 11947 if err != nil { 11948 return err 11949 } 11950 scp.Location = &location 11951 } 11952 case "properties": 11953 if v != nil { 11954 var serverConnectionPolicyProperties ServerConnectionPolicyProperties 11955 err = json.Unmarshal(*v, &serverConnectionPolicyProperties) 11956 if err != nil { 11957 return err 11958 } 11959 scp.ServerConnectionPolicyProperties = &serverConnectionPolicyProperties 11960 } 11961 case "id": 11962 if v != nil { 11963 var ID string 11964 err = json.Unmarshal(*v, &ID) 11965 if err != nil { 11966 return err 11967 } 11968 scp.ID = &ID 11969 } 11970 case "name": 11971 if v != nil { 11972 var name string 11973 err = json.Unmarshal(*v, &name) 11974 if err != nil { 11975 return err 11976 } 11977 scp.Name = &name 11978 } 11979 case "type": 11980 if v != nil { 11981 var typeVar string 11982 err = json.Unmarshal(*v, &typeVar) 11983 if err != nil { 11984 return err 11985 } 11986 scp.Type = &typeVar 11987 } 11988 } 11989 } 11990 11991 return nil 11992} 11993 11994// ServerConnectionPolicyProperties the properties of a server secure connection policy. 11995type ServerConnectionPolicyProperties struct { 11996 // ConnectionType - The server connection type. Possible values include: 'ServerConnectionTypeDefault', 'ServerConnectionTypeProxy', 'ServerConnectionTypeRedirect' 11997 ConnectionType ServerConnectionType `json:"connectionType,omitempty"` 11998} 11999 12000// ServerDNSAlias a server DNS alias. 12001type ServerDNSAlias struct { 12002 autorest.Response `json:"-"` 12003 // ServerDNSAliasProperties - Resource properties. 12004 *ServerDNSAliasProperties `json:"properties,omitempty"` 12005 // ID - READ-ONLY; Resource ID. 12006 ID *string `json:"id,omitempty"` 12007 // Name - READ-ONLY; Resource name. 12008 Name *string `json:"name,omitempty"` 12009 // Type - READ-ONLY; Resource type. 12010 Type *string `json:"type,omitempty"` 12011} 12012 12013// MarshalJSON is the custom marshaler for ServerDNSAlias. 12014func (sda ServerDNSAlias) MarshalJSON() ([]byte, error) { 12015 objectMap := make(map[string]interface{}) 12016 if sda.ServerDNSAliasProperties != nil { 12017 objectMap["properties"] = sda.ServerDNSAliasProperties 12018 } 12019 return json.Marshal(objectMap) 12020} 12021 12022// UnmarshalJSON is the custom unmarshaler for ServerDNSAlias struct. 12023func (sda *ServerDNSAlias) UnmarshalJSON(body []byte) error { 12024 var m map[string]*json.RawMessage 12025 err := json.Unmarshal(body, &m) 12026 if err != nil { 12027 return err 12028 } 12029 for k, v := range m { 12030 switch k { 12031 case "properties": 12032 if v != nil { 12033 var serverDNSAliasProperties ServerDNSAliasProperties 12034 err = json.Unmarshal(*v, &serverDNSAliasProperties) 12035 if err != nil { 12036 return err 12037 } 12038 sda.ServerDNSAliasProperties = &serverDNSAliasProperties 12039 } 12040 case "id": 12041 if v != nil { 12042 var ID string 12043 err = json.Unmarshal(*v, &ID) 12044 if err != nil { 12045 return err 12046 } 12047 sda.ID = &ID 12048 } 12049 case "name": 12050 if v != nil { 12051 var name string 12052 err = json.Unmarshal(*v, &name) 12053 if err != nil { 12054 return err 12055 } 12056 sda.Name = &name 12057 } 12058 case "type": 12059 if v != nil { 12060 var typeVar string 12061 err = json.Unmarshal(*v, &typeVar) 12062 if err != nil { 12063 return err 12064 } 12065 sda.Type = &typeVar 12066 } 12067 } 12068 } 12069 12070 return nil 12071} 12072 12073// ServerDNSAliasAcquisition a server DNS alias acquisition request. 12074type ServerDNSAliasAcquisition struct { 12075 // OldServerDNSAliasID - The id of the server alias that will be acquired to point to this server instead. 12076 OldServerDNSAliasID *string `json:"oldServerDnsAliasId,omitempty"` 12077} 12078 12079// ServerDNSAliasesAcquireFuture an abstraction for monitoring and retrieving the results of a long-running 12080// operation. 12081type ServerDNSAliasesAcquireFuture struct { 12082 azure.FutureAPI 12083 // Result returns the result of the asynchronous operation. 12084 // If the operation has not completed it will return an error. 12085 Result func(ServerDNSAliasesClient) (autorest.Response, error) 12086} 12087 12088// UnmarshalJSON is the custom unmarshaller for CreateFuture. 12089func (future *ServerDNSAliasesAcquireFuture) UnmarshalJSON(body []byte) error { 12090 var azFuture azure.Future 12091 if err := json.Unmarshal(body, &azFuture); err != nil { 12092 return err 12093 } 12094 future.FutureAPI = &azFuture 12095 future.Result = future.result 12096 return nil 12097} 12098 12099// result is the default implementation for ServerDNSAliasesAcquireFuture.Result. 12100func (future *ServerDNSAliasesAcquireFuture) result(client ServerDNSAliasesClient) (ar autorest.Response, err error) { 12101 var done bool 12102 done, err = future.DoneWithContext(context.Background(), client) 12103 if err != nil { 12104 err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesAcquireFuture", "Result", future.Response(), "Polling failure") 12105 return 12106 } 12107 if !done { 12108 ar.Response = future.Response() 12109 err = azure.NewAsyncOpIncompleteError("sql.ServerDNSAliasesAcquireFuture") 12110 return 12111 } 12112 ar.Response = future.Response() 12113 return 12114} 12115 12116// ServerDNSAliasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 12117// long-running operation. 12118type ServerDNSAliasesCreateOrUpdateFuture struct { 12119 azure.FutureAPI 12120 // Result returns the result of the asynchronous operation. 12121 // If the operation has not completed it will return an error. 12122 Result func(ServerDNSAliasesClient) (ServerDNSAlias, error) 12123} 12124 12125// UnmarshalJSON is the custom unmarshaller for CreateFuture. 12126func (future *ServerDNSAliasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 12127 var azFuture azure.Future 12128 if err := json.Unmarshal(body, &azFuture); err != nil { 12129 return err 12130 } 12131 future.FutureAPI = &azFuture 12132 future.Result = future.result 12133 return nil 12134} 12135 12136// result is the default implementation for ServerDNSAliasesCreateOrUpdateFuture.Result. 12137func (future *ServerDNSAliasesCreateOrUpdateFuture) result(client ServerDNSAliasesClient) (sda ServerDNSAlias, err error) { 12138 var done bool 12139 done, err = future.DoneWithContext(context.Background(), client) 12140 if err != nil { 12141 err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 12142 return 12143 } 12144 if !done { 12145 sda.Response.Response = future.Response() 12146 err = azure.NewAsyncOpIncompleteError("sql.ServerDNSAliasesCreateOrUpdateFuture") 12147 return 12148 } 12149 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 12150 if sda.Response.Response, err = future.GetResult(sender); err == nil && sda.Response.Response.StatusCode != http.StatusNoContent { 12151 sda, err = client.CreateOrUpdateResponder(sda.Response.Response) 12152 if err != nil { 12153 err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesCreateOrUpdateFuture", "Result", sda.Response.Response, "Failure responding to request") 12154 } 12155 } 12156 return 12157} 12158 12159// ServerDNSAliasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 12160// operation. 12161type ServerDNSAliasesDeleteFuture struct { 12162 azure.FutureAPI 12163 // Result returns the result of the asynchronous operation. 12164 // If the operation has not completed it will return an error. 12165 Result func(ServerDNSAliasesClient) (autorest.Response, error) 12166} 12167 12168// UnmarshalJSON is the custom unmarshaller for CreateFuture. 12169func (future *ServerDNSAliasesDeleteFuture) UnmarshalJSON(body []byte) error { 12170 var azFuture azure.Future 12171 if err := json.Unmarshal(body, &azFuture); err != nil { 12172 return err 12173 } 12174 future.FutureAPI = &azFuture 12175 future.Result = future.result 12176 return nil 12177} 12178 12179// result is the default implementation for ServerDNSAliasesDeleteFuture.Result. 12180func (future *ServerDNSAliasesDeleteFuture) result(client ServerDNSAliasesClient) (ar autorest.Response, err error) { 12181 var done bool 12182 done, err = future.DoneWithContext(context.Background(), client) 12183 if err != nil { 12184 err = autorest.NewErrorWithError(err, "sql.ServerDNSAliasesDeleteFuture", "Result", future.Response(), "Polling failure") 12185 return 12186 } 12187 if !done { 12188 ar.Response = future.Response() 12189 err = azure.NewAsyncOpIncompleteError("sql.ServerDNSAliasesDeleteFuture") 12190 return 12191 } 12192 ar.Response = future.Response() 12193 return 12194} 12195 12196// ServerDNSAliasListResult a list of server DNS aliases. 12197type ServerDNSAliasListResult struct { 12198 autorest.Response `json:"-"` 12199 // Value - READ-ONLY; Array of results. 12200 Value *[]ServerDNSAlias `json:"value,omitempty"` 12201 // NextLink - READ-ONLY; Link to retrieve next page of results. 12202 NextLink *string `json:"nextLink,omitempty"` 12203} 12204 12205// MarshalJSON is the custom marshaler for ServerDNSAliasListResult. 12206func (sdalr ServerDNSAliasListResult) MarshalJSON() ([]byte, error) { 12207 objectMap := make(map[string]interface{}) 12208 return json.Marshal(objectMap) 12209} 12210 12211// ServerDNSAliasListResultIterator provides access to a complete listing of ServerDNSAlias values. 12212type ServerDNSAliasListResultIterator struct { 12213 i int 12214 page ServerDNSAliasListResultPage 12215} 12216 12217// NextWithContext advances to the next value. If there was an error making 12218// the request the iterator does not advance and the error is returned. 12219func (iter *ServerDNSAliasListResultIterator) NextWithContext(ctx context.Context) (err error) { 12220 if tracing.IsEnabled() { 12221 ctx = tracing.StartSpan(ctx, fqdn+"/ServerDNSAliasListResultIterator.NextWithContext") 12222 defer func() { 12223 sc := -1 12224 if iter.Response().Response.Response != nil { 12225 sc = iter.Response().Response.Response.StatusCode 12226 } 12227 tracing.EndSpan(ctx, sc, err) 12228 }() 12229 } 12230 iter.i++ 12231 if iter.i < len(iter.page.Values()) { 12232 return nil 12233 } 12234 err = iter.page.NextWithContext(ctx) 12235 if err != nil { 12236 iter.i-- 12237 return err 12238 } 12239 iter.i = 0 12240 return nil 12241} 12242 12243// Next advances to the next value. If there was an error making 12244// the request the iterator does not advance and the error is returned. 12245// Deprecated: Use NextWithContext() instead. 12246func (iter *ServerDNSAliasListResultIterator) Next() error { 12247 return iter.NextWithContext(context.Background()) 12248} 12249 12250// NotDone returns true if the enumeration should be started or is not yet complete. 12251func (iter ServerDNSAliasListResultIterator) NotDone() bool { 12252 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 12253} 12254 12255// Response returns the raw server response from the last page request. 12256func (iter ServerDNSAliasListResultIterator) Response() ServerDNSAliasListResult { 12257 return iter.page.Response() 12258} 12259 12260// Value returns the current value or a zero-initialized value if the 12261// iterator has advanced beyond the end of the collection. 12262func (iter ServerDNSAliasListResultIterator) Value() ServerDNSAlias { 12263 if !iter.page.NotDone() { 12264 return ServerDNSAlias{} 12265 } 12266 return iter.page.Values()[iter.i] 12267} 12268 12269// Creates a new instance of the ServerDNSAliasListResultIterator type. 12270func NewServerDNSAliasListResultIterator(page ServerDNSAliasListResultPage) ServerDNSAliasListResultIterator { 12271 return ServerDNSAliasListResultIterator{page: page} 12272} 12273 12274// IsEmpty returns true if the ListResult contains no values. 12275func (sdalr ServerDNSAliasListResult) IsEmpty() bool { 12276 return sdalr.Value == nil || len(*sdalr.Value) == 0 12277} 12278 12279// hasNextLink returns true if the NextLink is not empty. 12280func (sdalr ServerDNSAliasListResult) hasNextLink() bool { 12281 return sdalr.NextLink != nil && len(*sdalr.NextLink) != 0 12282} 12283 12284// serverDNSAliasListResultPreparer prepares a request to retrieve the next set of results. 12285// It returns nil if no more results exist. 12286func (sdalr ServerDNSAliasListResult) serverDNSAliasListResultPreparer(ctx context.Context) (*http.Request, error) { 12287 if !sdalr.hasNextLink() { 12288 return nil, nil 12289 } 12290 return autorest.Prepare((&http.Request{}).WithContext(ctx), 12291 autorest.AsJSON(), 12292 autorest.AsGet(), 12293 autorest.WithBaseURL(to.String(sdalr.NextLink))) 12294} 12295 12296// ServerDNSAliasListResultPage contains a page of ServerDNSAlias values. 12297type ServerDNSAliasListResultPage struct { 12298 fn func(context.Context, ServerDNSAliasListResult) (ServerDNSAliasListResult, error) 12299 sdalr ServerDNSAliasListResult 12300} 12301 12302// NextWithContext advances to the next page of values. If there was an error making 12303// the request the page does not advance and the error is returned. 12304func (page *ServerDNSAliasListResultPage) NextWithContext(ctx context.Context) (err error) { 12305 if tracing.IsEnabled() { 12306 ctx = tracing.StartSpan(ctx, fqdn+"/ServerDNSAliasListResultPage.NextWithContext") 12307 defer func() { 12308 sc := -1 12309 if page.Response().Response.Response != nil { 12310 sc = page.Response().Response.Response.StatusCode 12311 } 12312 tracing.EndSpan(ctx, sc, err) 12313 }() 12314 } 12315 for { 12316 next, err := page.fn(ctx, page.sdalr) 12317 if err != nil { 12318 return err 12319 } 12320 page.sdalr = next 12321 if !next.hasNextLink() || !next.IsEmpty() { 12322 break 12323 } 12324 } 12325 return nil 12326} 12327 12328// Next advances to the next page of values. If there was an error making 12329// the request the page does not advance and the error is returned. 12330// Deprecated: Use NextWithContext() instead. 12331func (page *ServerDNSAliasListResultPage) Next() error { 12332 return page.NextWithContext(context.Background()) 12333} 12334 12335// NotDone returns true if the page enumeration should be started or is not yet complete. 12336func (page ServerDNSAliasListResultPage) NotDone() bool { 12337 return !page.sdalr.IsEmpty() 12338} 12339 12340// Response returns the raw server response from the last page request. 12341func (page ServerDNSAliasListResultPage) Response() ServerDNSAliasListResult { 12342 return page.sdalr 12343} 12344 12345// Values returns the slice of values for the current page or nil if there are no values. 12346func (page ServerDNSAliasListResultPage) Values() []ServerDNSAlias { 12347 if page.sdalr.IsEmpty() { 12348 return nil 12349 } 12350 return *page.sdalr.Value 12351} 12352 12353// Creates a new instance of the ServerDNSAliasListResultPage type. 12354func NewServerDNSAliasListResultPage(cur ServerDNSAliasListResult, getNextPage func(context.Context, ServerDNSAliasListResult) (ServerDNSAliasListResult, error)) ServerDNSAliasListResultPage { 12355 return ServerDNSAliasListResultPage{ 12356 fn: getNextPage, 12357 sdalr: cur, 12358 } 12359} 12360 12361// ServerDNSAliasProperties properties of a server DNS alias. 12362type ServerDNSAliasProperties struct { 12363 // AzureDNSRecord - READ-ONLY; The fully qualified DNS record for alias 12364 AzureDNSRecord *string `json:"azureDnsRecord,omitempty"` 12365} 12366 12367// MarshalJSON is the custom marshaler for ServerDNSAliasProperties. 12368func (sdap ServerDNSAliasProperties) MarshalJSON() ([]byte, error) { 12369 objectMap := make(map[string]interface{}) 12370 return json.Marshal(objectMap) 12371} 12372 12373// ServerKey a server key. 12374type ServerKey struct { 12375 autorest.Response `json:"-"` 12376 // Kind - Kind of encryption protector. This is metadata used for the Azure portal experience. 12377 Kind *string `json:"kind,omitempty"` 12378 // Location - READ-ONLY; Resource location. 12379 Location *string `json:"location,omitempty"` 12380 // ServerKeyProperties - Resource properties. 12381 *ServerKeyProperties `json:"properties,omitempty"` 12382 // ID - READ-ONLY; Resource ID. 12383 ID *string `json:"id,omitempty"` 12384 // Name - READ-ONLY; Resource name. 12385 Name *string `json:"name,omitempty"` 12386 // Type - READ-ONLY; Resource type. 12387 Type *string `json:"type,omitempty"` 12388} 12389 12390// MarshalJSON is the custom marshaler for ServerKey. 12391func (sk ServerKey) MarshalJSON() ([]byte, error) { 12392 objectMap := make(map[string]interface{}) 12393 if sk.Kind != nil { 12394 objectMap["kind"] = sk.Kind 12395 } 12396 if sk.ServerKeyProperties != nil { 12397 objectMap["properties"] = sk.ServerKeyProperties 12398 } 12399 return json.Marshal(objectMap) 12400} 12401 12402// UnmarshalJSON is the custom unmarshaler for ServerKey struct. 12403func (sk *ServerKey) UnmarshalJSON(body []byte) error { 12404 var m map[string]*json.RawMessage 12405 err := json.Unmarshal(body, &m) 12406 if err != nil { 12407 return err 12408 } 12409 for k, v := range m { 12410 switch k { 12411 case "kind": 12412 if v != nil { 12413 var kind string 12414 err = json.Unmarshal(*v, &kind) 12415 if err != nil { 12416 return err 12417 } 12418 sk.Kind = &kind 12419 } 12420 case "location": 12421 if v != nil { 12422 var location string 12423 err = json.Unmarshal(*v, &location) 12424 if err != nil { 12425 return err 12426 } 12427 sk.Location = &location 12428 } 12429 case "properties": 12430 if v != nil { 12431 var serverKeyProperties ServerKeyProperties 12432 err = json.Unmarshal(*v, &serverKeyProperties) 12433 if err != nil { 12434 return err 12435 } 12436 sk.ServerKeyProperties = &serverKeyProperties 12437 } 12438 case "id": 12439 if v != nil { 12440 var ID string 12441 err = json.Unmarshal(*v, &ID) 12442 if err != nil { 12443 return err 12444 } 12445 sk.ID = &ID 12446 } 12447 case "name": 12448 if v != nil { 12449 var name string 12450 err = json.Unmarshal(*v, &name) 12451 if err != nil { 12452 return err 12453 } 12454 sk.Name = &name 12455 } 12456 case "type": 12457 if v != nil { 12458 var typeVar string 12459 err = json.Unmarshal(*v, &typeVar) 12460 if err != nil { 12461 return err 12462 } 12463 sk.Type = &typeVar 12464 } 12465 } 12466 } 12467 12468 return nil 12469} 12470 12471// ServerKeyListResult a list of server keys. 12472type ServerKeyListResult struct { 12473 autorest.Response `json:"-"` 12474 // Value - READ-ONLY; Array of results. 12475 Value *[]ServerKey `json:"value,omitempty"` 12476 // NextLink - READ-ONLY; Link to retrieve next page of results. 12477 NextLink *string `json:"nextLink,omitempty"` 12478} 12479 12480// MarshalJSON is the custom marshaler for ServerKeyListResult. 12481func (sklr ServerKeyListResult) MarshalJSON() ([]byte, error) { 12482 objectMap := make(map[string]interface{}) 12483 return json.Marshal(objectMap) 12484} 12485 12486// ServerKeyListResultIterator provides access to a complete listing of ServerKey values. 12487type ServerKeyListResultIterator struct { 12488 i int 12489 page ServerKeyListResultPage 12490} 12491 12492// NextWithContext advances to the next value. If there was an error making 12493// the request the iterator does not advance and the error is returned. 12494func (iter *ServerKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { 12495 if tracing.IsEnabled() { 12496 ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultIterator.NextWithContext") 12497 defer func() { 12498 sc := -1 12499 if iter.Response().Response.Response != nil { 12500 sc = iter.Response().Response.Response.StatusCode 12501 } 12502 tracing.EndSpan(ctx, sc, err) 12503 }() 12504 } 12505 iter.i++ 12506 if iter.i < len(iter.page.Values()) { 12507 return nil 12508 } 12509 err = iter.page.NextWithContext(ctx) 12510 if err != nil { 12511 iter.i-- 12512 return err 12513 } 12514 iter.i = 0 12515 return nil 12516} 12517 12518// Next advances to the next value. If there was an error making 12519// the request the iterator does not advance and the error is returned. 12520// Deprecated: Use NextWithContext() instead. 12521func (iter *ServerKeyListResultIterator) Next() error { 12522 return iter.NextWithContext(context.Background()) 12523} 12524 12525// NotDone returns true if the enumeration should be started or is not yet complete. 12526func (iter ServerKeyListResultIterator) NotDone() bool { 12527 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 12528} 12529 12530// Response returns the raw server response from the last page request. 12531func (iter ServerKeyListResultIterator) Response() ServerKeyListResult { 12532 return iter.page.Response() 12533} 12534 12535// Value returns the current value or a zero-initialized value if the 12536// iterator has advanced beyond the end of the collection. 12537func (iter ServerKeyListResultIterator) Value() ServerKey { 12538 if !iter.page.NotDone() { 12539 return ServerKey{} 12540 } 12541 return iter.page.Values()[iter.i] 12542} 12543 12544// Creates a new instance of the ServerKeyListResultIterator type. 12545func NewServerKeyListResultIterator(page ServerKeyListResultPage) ServerKeyListResultIterator { 12546 return ServerKeyListResultIterator{page: page} 12547} 12548 12549// IsEmpty returns true if the ListResult contains no values. 12550func (sklr ServerKeyListResult) IsEmpty() bool { 12551 return sklr.Value == nil || len(*sklr.Value) == 0 12552} 12553 12554// hasNextLink returns true if the NextLink is not empty. 12555func (sklr ServerKeyListResult) hasNextLink() bool { 12556 return sklr.NextLink != nil && len(*sklr.NextLink) != 0 12557} 12558 12559// serverKeyListResultPreparer prepares a request to retrieve the next set of results. 12560// It returns nil if no more results exist. 12561func (sklr ServerKeyListResult) serverKeyListResultPreparer(ctx context.Context) (*http.Request, error) { 12562 if !sklr.hasNextLink() { 12563 return nil, nil 12564 } 12565 return autorest.Prepare((&http.Request{}).WithContext(ctx), 12566 autorest.AsJSON(), 12567 autorest.AsGet(), 12568 autorest.WithBaseURL(to.String(sklr.NextLink))) 12569} 12570 12571// ServerKeyListResultPage contains a page of ServerKey values. 12572type ServerKeyListResultPage struct { 12573 fn func(context.Context, ServerKeyListResult) (ServerKeyListResult, error) 12574 sklr ServerKeyListResult 12575} 12576 12577// NextWithContext advances to the next page of values. If there was an error making 12578// the request the page does not advance and the error is returned. 12579func (page *ServerKeyListResultPage) NextWithContext(ctx context.Context) (err error) { 12580 if tracing.IsEnabled() { 12581 ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultPage.NextWithContext") 12582 defer func() { 12583 sc := -1 12584 if page.Response().Response.Response != nil { 12585 sc = page.Response().Response.Response.StatusCode 12586 } 12587 tracing.EndSpan(ctx, sc, err) 12588 }() 12589 } 12590 for { 12591 next, err := page.fn(ctx, page.sklr) 12592 if err != nil { 12593 return err 12594 } 12595 page.sklr = next 12596 if !next.hasNextLink() || !next.IsEmpty() { 12597 break 12598 } 12599 } 12600 return nil 12601} 12602 12603// Next advances to the next page of values. If there was an error making 12604// the request the page does not advance and the error is returned. 12605// Deprecated: Use NextWithContext() instead. 12606func (page *ServerKeyListResultPage) Next() error { 12607 return page.NextWithContext(context.Background()) 12608} 12609 12610// NotDone returns true if the page enumeration should be started or is not yet complete. 12611func (page ServerKeyListResultPage) NotDone() bool { 12612 return !page.sklr.IsEmpty() 12613} 12614 12615// Response returns the raw server response from the last page request. 12616func (page ServerKeyListResultPage) Response() ServerKeyListResult { 12617 return page.sklr 12618} 12619 12620// Values returns the slice of values for the current page or nil if there are no values. 12621func (page ServerKeyListResultPage) Values() []ServerKey { 12622 if page.sklr.IsEmpty() { 12623 return nil 12624 } 12625 return *page.sklr.Value 12626} 12627 12628// Creates a new instance of the ServerKeyListResultPage type. 12629func NewServerKeyListResultPage(cur ServerKeyListResult, getNextPage func(context.Context, ServerKeyListResult) (ServerKeyListResult, error)) ServerKeyListResultPage { 12630 return ServerKeyListResultPage{ 12631 fn: getNextPage, 12632 sklr: cur, 12633 } 12634} 12635 12636// ServerKeyProperties properties for a server key execution. 12637type ServerKeyProperties struct { 12638 // Subregion - READ-ONLY; Subregion of the server key. 12639 Subregion *string `json:"subregion,omitempty"` 12640 // ServerKeyType - The server key type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' 12641 ServerKeyType ServerKeyType `json:"serverKeyType,omitempty"` 12642 // URI - The URI of the server key. 12643 URI *string `json:"uri,omitempty"` 12644 // Thumbprint - Thumbprint of the server key. 12645 Thumbprint *string `json:"thumbprint,omitempty"` 12646 // CreationDate - The server key creation date. 12647 CreationDate *date.Time `json:"creationDate,omitempty"` 12648} 12649 12650// MarshalJSON is the custom marshaler for ServerKeyProperties. 12651func (skp ServerKeyProperties) MarshalJSON() ([]byte, error) { 12652 objectMap := make(map[string]interface{}) 12653 if skp.ServerKeyType != "" { 12654 objectMap["serverKeyType"] = skp.ServerKeyType 12655 } 12656 if skp.URI != nil { 12657 objectMap["uri"] = skp.URI 12658 } 12659 if skp.Thumbprint != nil { 12660 objectMap["thumbprint"] = skp.Thumbprint 12661 } 12662 if skp.CreationDate != nil { 12663 objectMap["creationDate"] = skp.CreationDate 12664 } 12665 return json.Marshal(objectMap) 12666} 12667 12668// ServerKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 12669// long-running operation. 12670type ServerKeysCreateOrUpdateFuture struct { 12671 azure.FutureAPI 12672 // Result returns the result of the asynchronous operation. 12673 // If the operation has not completed it will return an error. 12674 Result func(ServerKeysClient) (ServerKey, error) 12675} 12676 12677// UnmarshalJSON is the custom unmarshaller for CreateFuture. 12678func (future *ServerKeysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 12679 var azFuture azure.Future 12680 if err := json.Unmarshal(body, &azFuture); err != nil { 12681 return err 12682 } 12683 future.FutureAPI = &azFuture 12684 future.Result = future.result 12685 return nil 12686} 12687 12688// result is the default implementation for ServerKeysCreateOrUpdateFuture.Result. 12689func (future *ServerKeysCreateOrUpdateFuture) result(client ServerKeysClient) (sk ServerKey, err error) { 12690 var done bool 12691 done, err = future.DoneWithContext(context.Background(), client) 12692 if err != nil { 12693 err = autorest.NewErrorWithError(err, "sql.ServerKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 12694 return 12695 } 12696 if !done { 12697 sk.Response.Response = future.Response() 12698 err = azure.NewAsyncOpIncompleteError("sql.ServerKeysCreateOrUpdateFuture") 12699 return 12700 } 12701 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 12702 if sk.Response.Response, err = future.GetResult(sender); err == nil && sk.Response.Response.StatusCode != http.StatusNoContent { 12703 sk, err = client.CreateOrUpdateResponder(sk.Response.Response) 12704 if err != nil { 12705 err = autorest.NewErrorWithError(err, "sql.ServerKeysCreateOrUpdateFuture", "Result", sk.Response.Response, "Failure responding to request") 12706 } 12707 } 12708 return 12709} 12710 12711// ServerKeysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 12712// operation. 12713type ServerKeysDeleteFuture struct { 12714 azure.FutureAPI 12715 // Result returns the result of the asynchronous operation. 12716 // If the operation has not completed it will return an error. 12717 Result func(ServerKeysClient) (autorest.Response, error) 12718} 12719 12720// UnmarshalJSON is the custom unmarshaller for CreateFuture. 12721func (future *ServerKeysDeleteFuture) UnmarshalJSON(body []byte) error { 12722 var azFuture azure.Future 12723 if err := json.Unmarshal(body, &azFuture); err != nil { 12724 return err 12725 } 12726 future.FutureAPI = &azFuture 12727 future.Result = future.result 12728 return nil 12729} 12730 12731// result is the default implementation for ServerKeysDeleteFuture.Result. 12732func (future *ServerKeysDeleteFuture) result(client ServerKeysClient) (ar autorest.Response, err error) { 12733 var done bool 12734 done, err = future.DoneWithContext(context.Background(), client) 12735 if err != nil { 12736 err = autorest.NewErrorWithError(err, "sql.ServerKeysDeleteFuture", "Result", future.Response(), "Polling failure") 12737 return 12738 } 12739 if !done { 12740 ar.Response = future.Response() 12741 err = azure.NewAsyncOpIncompleteError("sql.ServerKeysDeleteFuture") 12742 return 12743 } 12744 ar.Response = future.Response() 12745 return 12746} 12747 12748// ServerListResult a list of servers. 12749type ServerListResult struct { 12750 autorest.Response `json:"-"` 12751 // Value - READ-ONLY; Array of results. 12752 Value *[]Server `json:"value,omitempty"` 12753 // NextLink - READ-ONLY; Link to retrieve next page of results. 12754 NextLink *string `json:"nextLink,omitempty"` 12755} 12756 12757// MarshalJSON is the custom marshaler for ServerListResult. 12758func (slr ServerListResult) MarshalJSON() ([]byte, error) { 12759 objectMap := make(map[string]interface{}) 12760 return json.Marshal(objectMap) 12761} 12762 12763// ServerListResultIterator provides access to a complete listing of Server values. 12764type ServerListResultIterator struct { 12765 i int 12766 page ServerListResultPage 12767} 12768 12769// NextWithContext advances to the next value. If there was an error making 12770// the request the iterator does not advance and the error is returned. 12771func (iter *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) { 12772 if tracing.IsEnabled() { 12773 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.NextWithContext") 12774 defer func() { 12775 sc := -1 12776 if iter.Response().Response.Response != nil { 12777 sc = iter.Response().Response.Response.StatusCode 12778 } 12779 tracing.EndSpan(ctx, sc, err) 12780 }() 12781 } 12782 iter.i++ 12783 if iter.i < len(iter.page.Values()) { 12784 return nil 12785 } 12786 err = iter.page.NextWithContext(ctx) 12787 if err != nil { 12788 iter.i-- 12789 return err 12790 } 12791 iter.i = 0 12792 return nil 12793} 12794 12795// Next advances to the next value. If there was an error making 12796// the request the iterator does not advance and the error is returned. 12797// Deprecated: Use NextWithContext() instead. 12798func (iter *ServerListResultIterator) Next() error { 12799 return iter.NextWithContext(context.Background()) 12800} 12801 12802// NotDone returns true if the enumeration should be started or is not yet complete. 12803func (iter ServerListResultIterator) NotDone() bool { 12804 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 12805} 12806 12807// Response returns the raw server response from the last page request. 12808func (iter ServerListResultIterator) Response() ServerListResult { 12809 return iter.page.Response() 12810} 12811 12812// Value returns the current value or a zero-initialized value if the 12813// iterator has advanced beyond the end of the collection. 12814func (iter ServerListResultIterator) Value() Server { 12815 if !iter.page.NotDone() { 12816 return Server{} 12817 } 12818 return iter.page.Values()[iter.i] 12819} 12820 12821// Creates a new instance of the ServerListResultIterator type. 12822func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator { 12823 return ServerListResultIterator{page: page} 12824} 12825 12826// IsEmpty returns true if the ListResult contains no values. 12827func (slr ServerListResult) IsEmpty() bool { 12828 return slr.Value == nil || len(*slr.Value) == 0 12829} 12830 12831// hasNextLink returns true if the NextLink is not empty. 12832func (slr ServerListResult) hasNextLink() bool { 12833 return slr.NextLink != nil && len(*slr.NextLink) != 0 12834} 12835 12836// serverListResultPreparer prepares a request to retrieve the next set of results. 12837// It returns nil if no more results exist. 12838func (slr ServerListResult) serverListResultPreparer(ctx context.Context) (*http.Request, error) { 12839 if !slr.hasNextLink() { 12840 return nil, nil 12841 } 12842 return autorest.Prepare((&http.Request{}).WithContext(ctx), 12843 autorest.AsJSON(), 12844 autorest.AsGet(), 12845 autorest.WithBaseURL(to.String(slr.NextLink))) 12846} 12847 12848// ServerListResultPage contains a page of Server values. 12849type ServerListResultPage struct { 12850 fn func(context.Context, ServerListResult) (ServerListResult, error) 12851 slr ServerListResult 12852} 12853 12854// NextWithContext advances to the next page of values. If there was an error making 12855// the request the page does not advance and the error is returned. 12856func (page *ServerListResultPage) NextWithContext(ctx context.Context) (err error) { 12857 if tracing.IsEnabled() { 12858 ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.NextWithContext") 12859 defer func() { 12860 sc := -1 12861 if page.Response().Response.Response != nil { 12862 sc = page.Response().Response.Response.StatusCode 12863 } 12864 tracing.EndSpan(ctx, sc, err) 12865 }() 12866 } 12867 for { 12868 next, err := page.fn(ctx, page.slr) 12869 if err != nil { 12870 return err 12871 } 12872 page.slr = next 12873 if !next.hasNextLink() || !next.IsEmpty() { 12874 break 12875 } 12876 } 12877 return nil 12878} 12879 12880// Next advances to the next page of values. If there was an error making 12881// the request the page does not advance and the error is returned. 12882// Deprecated: Use NextWithContext() instead. 12883func (page *ServerListResultPage) Next() error { 12884 return page.NextWithContext(context.Background()) 12885} 12886 12887// NotDone returns true if the page enumeration should be started or is not yet complete. 12888func (page ServerListResultPage) NotDone() bool { 12889 return !page.slr.IsEmpty() 12890} 12891 12892// Response returns the raw server response from the last page request. 12893func (page ServerListResultPage) Response() ServerListResult { 12894 return page.slr 12895} 12896 12897// Values returns the slice of values for the current page or nil if there are no values. 12898func (page ServerListResultPage) Values() []Server { 12899 if page.slr.IsEmpty() { 12900 return nil 12901 } 12902 return *page.slr.Value 12903} 12904 12905// Creates a new instance of the ServerListResultPage type. 12906func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage { 12907 return ServerListResultPage{ 12908 fn: getNextPage, 12909 slr: cur, 12910 } 12911} 12912 12913// ServerProperties the properties of a server. 12914type ServerProperties struct { 12915 // AdministratorLogin - Administrator username for the server. Once created it cannot be changed. 12916 AdministratorLogin *string `json:"administratorLogin,omitempty"` 12917 // AdministratorLoginPassword - The administrator login password (required for server creation). 12918 AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` 12919 // Version - The version of the server. 12920 Version *string `json:"version,omitempty"` 12921 // State - READ-ONLY; The state of the server. 12922 State *string `json:"state,omitempty"` 12923 // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of the server. 12924 FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` 12925} 12926 12927// MarshalJSON is the custom marshaler for ServerProperties. 12928func (sp ServerProperties) MarshalJSON() ([]byte, error) { 12929 objectMap := make(map[string]interface{}) 12930 if sp.AdministratorLogin != nil { 12931 objectMap["administratorLogin"] = sp.AdministratorLogin 12932 } 12933 if sp.AdministratorLoginPassword != nil { 12934 objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword 12935 } 12936 if sp.Version != nil { 12937 objectMap["version"] = sp.Version 12938 } 12939 return json.Marshal(objectMap) 12940} 12941 12942// ServersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 12943// operation. 12944type ServersCreateOrUpdateFuture struct { 12945 azure.FutureAPI 12946 // Result returns the result of the asynchronous operation. 12947 // If the operation has not completed it will return an error. 12948 Result func(ServersClient) (Server, error) 12949} 12950 12951// UnmarshalJSON is the custom unmarshaller for CreateFuture. 12952func (future *ServersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 12953 var azFuture azure.Future 12954 if err := json.Unmarshal(body, &azFuture); err != nil { 12955 return err 12956 } 12957 future.FutureAPI = &azFuture 12958 future.Result = future.result 12959 return nil 12960} 12961 12962// result is the default implementation for ServersCreateOrUpdateFuture.Result. 12963func (future *ServersCreateOrUpdateFuture) result(client ServersClient) (s Server, err error) { 12964 var done bool 12965 done, err = future.DoneWithContext(context.Background(), client) 12966 if err != nil { 12967 err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 12968 return 12969 } 12970 if !done { 12971 s.Response.Response = future.Response() 12972 err = azure.NewAsyncOpIncompleteError("sql.ServersCreateOrUpdateFuture") 12973 return 12974 } 12975 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 12976 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 12977 s, err = client.CreateOrUpdateResponder(s.Response.Response) 12978 if err != nil { 12979 err = autorest.NewErrorWithError(err, "sql.ServersCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") 12980 } 12981 } 12982 return 12983} 12984 12985// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 12986// operation. 12987type ServersDeleteFuture struct { 12988 azure.FutureAPI 12989 // Result returns the result of the asynchronous operation. 12990 // If the operation has not completed it will return an error. 12991 Result func(ServersClient) (autorest.Response, error) 12992} 12993 12994// UnmarshalJSON is the custom unmarshaller for CreateFuture. 12995func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error { 12996 var azFuture azure.Future 12997 if err := json.Unmarshal(body, &azFuture); err != nil { 12998 return err 12999 } 13000 future.FutureAPI = &azFuture 13001 future.Result = future.result 13002 return nil 13003} 13004 13005// result is the default implementation for ServersDeleteFuture.Result. 13006func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { 13007 var done bool 13008 done, err = future.DoneWithContext(context.Background(), client) 13009 if err != nil { 13010 err = autorest.NewErrorWithError(err, "sql.ServersDeleteFuture", "Result", future.Response(), "Polling failure") 13011 return 13012 } 13013 if !done { 13014 ar.Response = future.Response() 13015 err = azure.NewAsyncOpIncompleteError("sql.ServersDeleteFuture") 13016 return 13017 } 13018 ar.Response = future.Response() 13019 return 13020} 13021 13022// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 13023// of a long-running operation. 13024type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct { 13025 azure.FutureAPI 13026 // Result returns the result of the asynchronous operation. 13027 // If the operation has not completed it will return an error. 13028 Result func(ServerSecurityAlertPoliciesClient) (ServerSecurityAlertPolicy, error) 13029} 13030 13031// UnmarshalJSON is the custom unmarshaller for CreateFuture. 13032func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 13033 var azFuture azure.Future 13034 if err := json.Unmarshal(body, &azFuture); err != nil { 13035 return err 13036 } 13037 future.FutureAPI = &azFuture 13038 future.Result = future.result 13039 return nil 13040} 13041 13042// result is the default implementation for ServerSecurityAlertPoliciesCreateOrUpdateFuture.Result. 13043func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) { 13044 var done bool 13045 done, err = future.DoneWithContext(context.Background(), client) 13046 if err != nil { 13047 err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 13048 return 13049 } 13050 if !done { 13051 ssap.Response.Response = future.Response() 13052 err = azure.NewAsyncOpIncompleteError("sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture") 13053 return 13054 } 13055 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 13056 if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { 13057 ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) 13058 if err != nil { 13059 err = autorest.NewErrorWithError(err, "sql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") 13060 } 13061 } 13062 return 13063} 13064 13065// ServerSecurityAlertPolicy a server security alert policy. 13066type ServerSecurityAlertPolicy struct { 13067 autorest.Response `json:"-"` 13068 // SecurityAlertPolicyProperties - Resource properties. 13069 *SecurityAlertPolicyProperties `json:"properties,omitempty"` 13070 // ID - READ-ONLY; Resource ID. 13071 ID *string `json:"id,omitempty"` 13072 // Name - READ-ONLY; Resource name. 13073 Name *string `json:"name,omitempty"` 13074 // Type - READ-ONLY; Resource type. 13075 Type *string `json:"type,omitempty"` 13076} 13077 13078// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy. 13079func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { 13080 objectMap := make(map[string]interface{}) 13081 if ssap.SecurityAlertPolicyProperties != nil { 13082 objectMap["properties"] = ssap.SecurityAlertPolicyProperties 13083 } 13084 return json.Marshal(objectMap) 13085} 13086 13087// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. 13088func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { 13089 var m map[string]*json.RawMessage 13090 err := json.Unmarshal(body, &m) 13091 if err != nil { 13092 return err 13093 } 13094 for k, v := range m { 13095 switch k { 13096 case "properties": 13097 if v != nil { 13098 var securityAlertPolicyProperties SecurityAlertPolicyProperties 13099 err = json.Unmarshal(*v, &securityAlertPolicyProperties) 13100 if err != nil { 13101 return err 13102 } 13103 ssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties 13104 } 13105 case "id": 13106 if v != nil { 13107 var ID string 13108 err = json.Unmarshal(*v, &ID) 13109 if err != nil { 13110 return err 13111 } 13112 ssap.ID = &ID 13113 } 13114 case "name": 13115 if v != nil { 13116 var name string 13117 err = json.Unmarshal(*v, &name) 13118 if err != nil { 13119 return err 13120 } 13121 ssap.Name = &name 13122 } 13123 case "type": 13124 if v != nil { 13125 var typeVar string 13126 err = json.Unmarshal(*v, &typeVar) 13127 if err != nil { 13128 return err 13129 } 13130 ssap.Type = &typeVar 13131 } 13132 } 13133 } 13134 13135 return nil 13136} 13137 13138// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 13139// operation. 13140type ServersUpdateFuture struct { 13141 azure.FutureAPI 13142 // Result returns the result of the asynchronous operation. 13143 // If the operation has not completed it will return an error. 13144 Result func(ServersClient) (Server, error) 13145} 13146 13147// UnmarshalJSON is the custom unmarshaller for CreateFuture. 13148func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error { 13149 var azFuture azure.Future 13150 if err := json.Unmarshal(body, &azFuture); err != nil { 13151 return err 13152 } 13153 future.FutureAPI = &azFuture 13154 future.Result = future.result 13155 return nil 13156} 13157 13158// result is the default implementation for ServersUpdateFuture.Result. 13159func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { 13160 var done bool 13161 done, err = future.DoneWithContext(context.Background(), client) 13162 if err != nil { 13163 err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", future.Response(), "Polling failure") 13164 return 13165 } 13166 if !done { 13167 s.Response.Response = future.Response() 13168 err = azure.NewAsyncOpIncompleteError("sql.ServersUpdateFuture") 13169 return 13170 } 13171 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 13172 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 13173 s, err = client.UpdateResponder(s.Response.Response) 13174 if err != nil { 13175 err = autorest.NewErrorWithError(err, "sql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") 13176 } 13177 } 13178 return 13179} 13180 13181// ServerUpdate an update request for an Azure SQL Database server. 13182type ServerUpdate struct { 13183 // ServerProperties - Resource properties. 13184 *ServerProperties `json:"properties,omitempty"` 13185 // Tags - Resource tags. 13186 Tags map[string]*string `json:"tags"` 13187} 13188 13189// MarshalJSON is the custom marshaler for ServerUpdate. 13190func (su ServerUpdate) MarshalJSON() ([]byte, error) { 13191 objectMap := make(map[string]interface{}) 13192 if su.ServerProperties != nil { 13193 objectMap["properties"] = su.ServerProperties 13194 } 13195 if su.Tags != nil { 13196 objectMap["tags"] = su.Tags 13197 } 13198 return json.Marshal(objectMap) 13199} 13200 13201// UnmarshalJSON is the custom unmarshaler for ServerUpdate struct. 13202func (su *ServerUpdate) UnmarshalJSON(body []byte) error { 13203 var m map[string]*json.RawMessage 13204 err := json.Unmarshal(body, &m) 13205 if err != nil { 13206 return err 13207 } 13208 for k, v := range m { 13209 switch k { 13210 case "properties": 13211 if v != nil { 13212 var serverProperties ServerProperties 13213 err = json.Unmarshal(*v, &serverProperties) 13214 if err != nil { 13215 return err 13216 } 13217 su.ServerProperties = &serverProperties 13218 } 13219 case "tags": 13220 if v != nil { 13221 var tags map[string]*string 13222 err = json.Unmarshal(*v, &tags) 13223 if err != nil { 13224 return err 13225 } 13226 su.Tags = tags 13227 } 13228 } 13229 } 13230 13231 return nil 13232} 13233 13234// ServerUsage represents server metrics. 13235type ServerUsage struct { 13236 // Name - READ-ONLY; Name of the server usage metric. 13237 Name *string `json:"name,omitempty"` 13238 // ResourceName - READ-ONLY; The name of the resource. 13239 ResourceName *string `json:"resourceName,omitempty"` 13240 // DisplayName - READ-ONLY; The metric display name. 13241 DisplayName *string `json:"displayName,omitempty"` 13242 // CurrentValue - READ-ONLY; The current value of the metric. 13243 CurrentValue *float64 `json:"currentValue,omitempty"` 13244 // Limit - READ-ONLY; The current limit of the metric. 13245 Limit *float64 `json:"limit,omitempty"` 13246 // Unit - READ-ONLY; The units of the metric. 13247 Unit *string `json:"unit,omitempty"` 13248 // NextResetTime - READ-ONLY; The next reset time for the metric (ISO8601 format). 13249 NextResetTime *date.Time `json:"nextResetTime,omitempty"` 13250} 13251 13252// MarshalJSON is the custom marshaler for ServerUsage. 13253func (su ServerUsage) MarshalJSON() ([]byte, error) { 13254 objectMap := make(map[string]interface{}) 13255 return json.Marshal(objectMap) 13256} 13257 13258// ServerUsageListResult represents the response to a list server metrics request. 13259type ServerUsageListResult struct { 13260 autorest.Response `json:"-"` 13261 // Value - The list of server metrics for the server. 13262 Value *[]ServerUsage `json:"value,omitempty"` 13263} 13264 13265// ServerVersionCapability the server capabilities. 13266type ServerVersionCapability struct { 13267 // Name - READ-ONLY; The server version name. 13268 Name *string `json:"name,omitempty"` 13269 // Status - READ-ONLY; The status of the server version. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' 13270 Status CapabilityStatus `json:"status,omitempty"` 13271 // SupportedEditions - READ-ONLY; The list of supported database editions. 13272 SupportedEditions *[]EditionCapability `json:"supportedEditions,omitempty"` 13273 // SupportedElasticPoolEditions - READ-ONLY; The list of supported elastic pool editions. 13274 SupportedElasticPoolEditions *[]ElasticPoolEditionCapability `json:"supportedElasticPoolEditions,omitempty"` 13275} 13276 13277// MarshalJSON is the custom marshaler for ServerVersionCapability. 13278func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) { 13279 objectMap := make(map[string]interface{}) 13280 return json.Marshal(objectMap) 13281} 13282 13283// ServiceObjective represents a database service objective. 13284type ServiceObjective struct { 13285 autorest.Response `json:"-"` 13286 // ServiceObjectiveProperties - Represents the properties of the resource. 13287 *ServiceObjectiveProperties `json:"properties,omitempty"` 13288 // ID - READ-ONLY; Resource ID. 13289 ID *string `json:"id,omitempty"` 13290 // Name - READ-ONLY; Resource name. 13291 Name *string `json:"name,omitempty"` 13292 // Type - READ-ONLY; Resource type. 13293 Type *string `json:"type,omitempty"` 13294} 13295 13296// MarshalJSON is the custom marshaler for ServiceObjective. 13297func (so ServiceObjective) MarshalJSON() ([]byte, error) { 13298 objectMap := make(map[string]interface{}) 13299 if so.ServiceObjectiveProperties != nil { 13300 objectMap["properties"] = so.ServiceObjectiveProperties 13301 } 13302 return json.Marshal(objectMap) 13303} 13304 13305// UnmarshalJSON is the custom unmarshaler for ServiceObjective struct. 13306func (so *ServiceObjective) UnmarshalJSON(body []byte) error { 13307 var m map[string]*json.RawMessage 13308 err := json.Unmarshal(body, &m) 13309 if err != nil { 13310 return err 13311 } 13312 for k, v := range m { 13313 switch k { 13314 case "properties": 13315 if v != nil { 13316 var serviceObjectiveProperties ServiceObjectiveProperties 13317 err = json.Unmarshal(*v, &serviceObjectiveProperties) 13318 if err != nil { 13319 return err 13320 } 13321 so.ServiceObjectiveProperties = &serviceObjectiveProperties 13322 } 13323 case "id": 13324 if v != nil { 13325 var ID string 13326 err = json.Unmarshal(*v, &ID) 13327 if err != nil { 13328 return err 13329 } 13330 so.ID = &ID 13331 } 13332 case "name": 13333 if v != nil { 13334 var name string 13335 err = json.Unmarshal(*v, &name) 13336 if err != nil { 13337 return err 13338 } 13339 so.Name = &name 13340 } 13341 case "type": 13342 if v != nil { 13343 var typeVar string 13344 err = json.Unmarshal(*v, &typeVar) 13345 if err != nil { 13346 return err 13347 } 13348 so.Type = &typeVar 13349 } 13350 } 13351 } 13352 13353 return nil 13354} 13355 13356// ServiceObjectiveCapability the service objectives capability. 13357type ServiceObjectiveCapability struct { 13358 // Name - READ-ONLY; The service objective name. 13359 Name *string `json:"name,omitempty"` 13360 // Status - READ-ONLY; The status of the service objective. Possible values include: 'CapabilityStatusVisible', 'CapabilityStatusAvailable', 'CapabilityStatusDefault', 'CapabilityStatusDisabled' 13361 Status CapabilityStatus `json:"status,omitempty"` 13362 // PerformanceLevel - READ-ONLY; The performance level of the service objective capability. 13363 *PerformanceLevel `json:"performanceLevel,omitempty"` 13364 // ID - READ-ONLY; The unique ID of the service objective. 13365 ID *uuid.UUID `json:"id,omitempty"` 13366 // SupportedMaxSizes - READ-ONLY; The list of supported maximum database sizes for this service objective. 13367 SupportedMaxSizes *[]MaxSizeCapability `json:"supportedMaxSizes,omitempty"` 13368 // IncludedMaxSize - READ-ONLY; The included (free) max size for this service level objective. 13369 IncludedMaxSize *MaxSizeCapability `json:"includedMaxSize,omitempty"` 13370} 13371 13372// MarshalJSON is the custom marshaler for ServiceObjectiveCapability. 13373func (soc ServiceObjectiveCapability) MarshalJSON() ([]byte, error) { 13374 objectMap := make(map[string]interface{}) 13375 return json.Marshal(objectMap) 13376} 13377 13378// UnmarshalJSON is the custom unmarshaler for ServiceObjectiveCapability struct. 13379func (soc *ServiceObjectiveCapability) UnmarshalJSON(body []byte) error { 13380 var m map[string]*json.RawMessage 13381 err := json.Unmarshal(body, &m) 13382 if err != nil { 13383 return err 13384 } 13385 for k, v := range m { 13386 switch k { 13387 case "name": 13388 if v != nil { 13389 var name string 13390 err = json.Unmarshal(*v, &name) 13391 if err != nil { 13392 return err 13393 } 13394 soc.Name = &name 13395 } 13396 case "status": 13397 if v != nil { 13398 var status CapabilityStatus 13399 err = json.Unmarshal(*v, &status) 13400 if err != nil { 13401 return err 13402 } 13403 soc.Status = status 13404 } 13405 case "performanceLevel": 13406 if v != nil { 13407 var performanceLevel PerformanceLevel 13408 err = json.Unmarshal(*v, &performanceLevel) 13409 if err != nil { 13410 return err 13411 } 13412 soc.PerformanceLevel = &performanceLevel 13413 } 13414 case "id": 13415 if v != nil { 13416 var ID uuid.UUID 13417 err = json.Unmarshal(*v, &ID) 13418 if err != nil { 13419 return err 13420 } 13421 soc.ID = &ID 13422 } 13423 case "supportedMaxSizes": 13424 if v != nil { 13425 var supportedMaxSizes []MaxSizeCapability 13426 err = json.Unmarshal(*v, &supportedMaxSizes) 13427 if err != nil { 13428 return err 13429 } 13430 soc.SupportedMaxSizes = &supportedMaxSizes 13431 } 13432 case "includedMaxSize": 13433 if v != nil { 13434 var includedMaxSize MaxSizeCapability 13435 err = json.Unmarshal(*v, &includedMaxSize) 13436 if err != nil { 13437 return err 13438 } 13439 soc.IncludedMaxSize = &includedMaxSize 13440 } 13441 } 13442 } 13443 13444 return nil 13445} 13446 13447// ServiceObjectiveListResult represents the response to a get database service objectives request. 13448type ServiceObjectiveListResult struct { 13449 autorest.Response `json:"-"` 13450 // Value - The list of database service objectives. 13451 Value *[]ServiceObjective `json:"value,omitempty"` 13452} 13453 13454// ServiceObjectiveProperties represents the properties of a database service objective. 13455type ServiceObjectiveProperties struct { 13456 // ServiceObjectiveName - READ-ONLY; The name for the service objective. 13457 ServiceObjectiveName *string `json:"serviceObjectiveName,omitempty"` 13458 // IsDefault - READ-ONLY; Gets whether the service level objective is the default service objective. 13459 IsDefault *bool `json:"isDefault,omitempty"` 13460 // IsSystem - READ-ONLY; Gets whether the service level objective is a system service objective. 13461 IsSystem *bool `json:"isSystem,omitempty"` 13462 // Description - READ-ONLY; The description for the service level objective. 13463 Description *string `json:"description,omitempty"` 13464 // Enabled - READ-ONLY; Gets whether the service level objective is enabled. 13465 Enabled *bool `json:"enabled,omitempty"` 13466} 13467 13468// MarshalJSON is the custom marshaler for ServiceObjectiveProperties. 13469func (sop ServiceObjectiveProperties) MarshalJSON() ([]byte, error) { 13470 objectMap := make(map[string]interface{}) 13471 return json.Marshal(objectMap) 13472} 13473 13474// ServiceTierAdvisor represents a Service Tier Advisor. 13475type ServiceTierAdvisor struct { 13476 autorest.Response `json:"-"` 13477 // ServiceTierAdvisorProperties - READ-ONLY; The properties representing the resource. 13478 *ServiceTierAdvisorProperties `json:"properties,omitempty"` 13479 // ID - READ-ONLY; Resource ID. 13480 ID *string `json:"id,omitempty"` 13481 // Name - READ-ONLY; Resource name. 13482 Name *string `json:"name,omitempty"` 13483 // Type - READ-ONLY; Resource type. 13484 Type *string `json:"type,omitempty"` 13485} 13486 13487// MarshalJSON is the custom marshaler for ServiceTierAdvisor. 13488func (sta ServiceTierAdvisor) MarshalJSON() ([]byte, error) { 13489 objectMap := make(map[string]interface{}) 13490 return json.Marshal(objectMap) 13491} 13492 13493// UnmarshalJSON is the custom unmarshaler for ServiceTierAdvisor struct. 13494func (sta *ServiceTierAdvisor) UnmarshalJSON(body []byte) error { 13495 var m map[string]*json.RawMessage 13496 err := json.Unmarshal(body, &m) 13497 if err != nil { 13498 return err 13499 } 13500 for k, v := range m { 13501 switch k { 13502 case "properties": 13503 if v != nil { 13504 var serviceTierAdvisorProperties ServiceTierAdvisorProperties 13505 err = json.Unmarshal(*v, &serviceTierAdvisorProperties) 13506 if err != nil { 13507 return err 13508 } 13509 sta.ServiceTierAdvisorProperties = &serviceTierAdvisorProperties 13510 } 13511 case "id": 13512 if v != nil { 13513 var ID string 13514 err = json.Unmarshal(*v, &ID) 13515 if err != nil { 13516 return err 13517 } 13518 sta.ID = &ID 13519 } 13520 case "name": 13521 if v != nil { 13522 var name string 13523 err = json.Unmarshal(*v, &name) 13524 if err != nil { 13525 return err 13526 } 13527 sta.Name = &name 13528 } 13529 case "type": 13530 if v != nil { 13531 var typeVar string 13532 err = json.Unmarshal(*v, &typeVar) 13533 if err != nil { 13534 return err 13535 } 13536 sta.Type = &typeVar 13537 } 13538 } 13539 } 13540 13541 return nil 13542} 13543 13544// ServiceTierAdvisorListResult represents the response to a list service tier advisor request. 13545type ServiceTierAdvisorListResult struct { 13546 autorest.Response `json:"-"` 13547 // Value - The list of service tier advisors for specified database. 13548 Value *[]ServiceTierAdvisor `json:"value,omitempty"` 13549} 13550 13551// ServiceTierAdvisorProperties represents the properties of a Service Tier Advisor. 13552type ServiceTierAdvisorProperties struct { 13553 // ObservationPeriodStart - READ-ONLY; The observation period start (ISO8601 format). 13554 ObservationPeriodStart *date.Time `json:"observationPeriodStart,omitempty"` 13555 // ObservationPeriodEnd - READ-ONLY; The observation period start (ISO8601 format). 13556 ObservationPeriodEnd *date.Time `json:"observationPeriodEnd,omitempty"` 13557 // ActiveTimeRatio - READ-ONLY; The activeTimeRatio for service tier advisor. 13558 ActiveTimeRatio *float64 `json:"activeTimeRatio,omitempty"` 13559 // MinDtu - READ-ONLY; Gets or sets minDtu for service tier advisor. 13560 MinDtu *float64 `json:"minDtu,omitempty"` 13561 // AvgDtu - READ-ONLY; Gets or sets avgDtu for service tier advisor. 13562 AvgDtu *float64 `json:"avgDtu,omitempty"` 13563 // MaxDtu - READ-ONLY; Gets or sets maxDtu for service tier advisor. 13564 MaxDtu *float64 `json:"maxDtu,omitempty"` 13565 // MaxSizeInGB - READ-ONLY; Gets or sets maxSizeInGB for service tier advisor. 13566 MaxSizeInGB *float64 `json:"maxSizeInGB,omitempty"` 13567 // ServiceLevelObjectiveUsageMetrics - READ-ONLY; Gets or sets serviceLevelObjectiveUsageMetrics for the service tier advisor. 13568 ServiceLevelObjectiveUsageMetrics *[]SloUsageMetric `json:"serviceLevelObjectiveUsageMetrics,omitempty"` 13569 // CurrentServiceLevelObjective - READ-ONLY; Gets or sets currentServiceLevelObjective for service tier advisor. 13570 CurrentServiceLevelObjective *string `json:"currentServiceLevelObjective,omitempty"` 13571 // CurrentServiceLevelObjectiveID - READ-ONLY; Gets or sets currentServiceLevelObjectiveId for service tier advisor. 13572 CurrentServiceLevelObjectiveID *uuid.UUID `json:"currentServiceLevelObjectiveId,omitempty"` 13573 // UsageBasedRecommendationServiceLevelObjective - READ-ONLY; Gets or sets usageBasedRecommendationServiceLevelObjective for service tier advisor. 13574 UsageBasedRecommendationServiceLevelObjective *string `json:"usageBasedRecommendationServiceLevelObjective,omitempty"` 13575 // UsageBasedRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets usageBasedRecommendationServiceLevelObjectiveId for service tier advisor. 13576 UsageBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"usageBasedRecommendationServiceLevelObjectiveId,omitempty"` 13577 // DatabaseSizeBasedRecommendationServiceLevelObjective - READ-ONLY; Gets or sets databaseSizeBasedRecommendationServiceLevelObjective for service tier advisor. 13578 DatabaseSizeBasedRecommendationServiceLevelObjective *string `json:"databaseSizeBasedRecommendationServiceLevelObjective,omitempty"` 13579 // DatabaseSizeBasedRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets databaseSizeBasedRecommendationServiceLevelObjectiveId for service tier advisor. 13580 DatabaseSizeBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"databaseSizeBasedRecommendationServiceLevelObjectiveId,omitempty"` 13581 // DisasterPlanBasedRecommendationServiceLevelObjective - READ-ONLY; Gets or sets disasterPlanBasedRecommendationServiceLevelObjective for service tier advisor. 13582 DisasterPlanBasedRecommendationServiceLevelObjective *string `json:"disasterPlanBasedRecommendationServiceLevelObjective,omitempty"` 13583 // DisasterPlanBasedRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets disasterPlanBasedRecommendationServiceLevelObjectiveId for service tier advisor. 13584 DisasterPlanBasedRecommendationServiceLevelObjectiveID *uuid.UUID `json:"disasterPlanBasedRecommendationServiceLevelObjectiveId,omitempty"` 13585 // OverallRecommendationServiceLevelObjective - READ-ONLY; Gets or sets overallRecommendationServiceLevelObjective for service tier advisor. 13586 OverallRecommendationServiceLevelObjective *string `json:"overallRecommendationServiceLevelObjective,omitempty"` 13587 // OverallRecommendationServiceLevelObjectiveID - READ-ONLY; Gets or sets overallRecommendationServiceLevelObjectiveId for service tier advisor. 13588 OverallRecommendationServiceLevelObjectiveID *uuid.UUID `json:"overallRecommendationServiceLevelObjectiveId,omitempty"` 13589 // Confidence - READ-ONLY; Gets or sets confidence for service tier advisor. 13590 Confidence *float64 `json:"confidence,omitempty"` 13591} 13592 13593// MarshalJSON is the custom marshaler for ServiceTierAdvisorProperties. 13594func (stap ServiceTierAdvisorProperties) MarshalJSON() ([]byte, error) { 13595 objectMap := make(map[string]interface{}) 13596 return json.Marshal(objectMap) 13597} 13598 13599// Sku an ARM Resource SKU. 13600type Sku struct { 13601 // Name - The name of the SKU, typically, a letter + Number code, e.g. P3. 13602 Name *string `json:"name,omitempty"` 13603 // Tier - The tier or edition of the particular SKU, e.g. Basic, Premium. 13604 Tier *string `json:"tier,omitempty"` 13605 // Size - Size of the particular SKU 13606 Size *string `json:"size,omitempty"` 13607 // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. 13608 Family *string `json:"family,omitempty"` 13609 // Capacity - Capacity of the particular SKU. 13610 Capacity *int32 `json:"capacity,omitempty"` 13611} 13612 13613// SloUsageMetric a Slo Usage Metric. 13614type SloUsageMetric struct { 13615 // ServiceLevelObjective - READ-ONLY; The serviceLevelObjective for SLO usage metric. Possible values include: 'ServiceObjectiveNameSystem', 'ServiceObjectiveNameSystem0', 'ServiceObjectiveNameSystem1', 'ServiceObjectiveNameSystem2', 'ServiceObjectiveNameSystem3', 'ServiceObjectiveNameSystem4', 'ServiceObjectiveNameSystem2L', 'ServiceObjectiveNameSystem3L', 'ServiceObjectiveNameSystem4L', 'ServiceObjectiveNameFree', 'ServiceObjectiveNameBasic', 'ServiceObjectiveNameS0', 'ServiceObjectiveNameS1', 'ServiceObjectiveNameS2', 'ServiceObjectiveNameS3', 'ServiceObjectiveNameS4', 'ServiceObjectiveNameS6', 'ServiceObjectiveNameS7', 'ServiceObjectiveNameS9', 'ServiceObjectiveNameS12', 'ServiceObjectiveNameP1', 'ServiceObjectiveNameP2', 'ServiceObjectiveNameP3', 'ServiceObjectiveNameP4', 'ServiceObjectiveNameP6', 'ServiceObjectiveNameP11', 'ServiceObjectiveNameP15', 'ServiceObjectiveNamePRS1', 'ServiceObjectiveNamePRS2', 'ServiceObjectiveNamePRS4', 'ServiceObjectiveNamePRS6', 'ServiceObjectiveNameDW100', 'ServiceObjectiveNameDW200', 'ServiceObjectiveNameDW300', 'ServiceObjectiveNameDW400', 'ServiceObjectiveNameDW500', 'ServiceObjectiveNameDW600', 'ServiceObjectiveNameDW1000', 'ServiceObjectiveNameDW1200', 'ServiceObjectiveNameDW1000c', 'ServiceObjectiveNameDW1500', 'ServiceObjectiveNameDW1500c', 'ServiceObjectiveNameDW2000', 'ServiceObjectiveNameDW2000c', 'ServiceObjectiveNameDW3000', 'ServiceObjectiveNameDW2500c', 'ServiceObjectiveNameDW3000c', 'ServiceObjectiveNameDW6000', 'ServiceObjectiveNameDW5000c', 'ServiceObjectiveNameDW6000c', 'ServiceObjectiveNameDW7500c', 'ServiceObjectiveNameDW10000c', 'ServiceObjectiveNameDW15000c', 'ServiceObjectiveNameDW30000c', 'ServiceObjectiveNameDS100', 'ServiceObjectiveNameDS200', 'ServiceObjectiveNameDS300', 'ServiceObjectiveNameDS400', 'ServiceObjectiveNameDS500', 'ServiceObjectiveNameDS600', 'ServiceObjectiveNameDS1000', 'ServiceObjectiveNameDS1200', 'ServiceObjectiveNameDS1500', 'ServiceObjectiveNameDS2000', 'ServiceObjectiveNameElasticPool' 13616 ServiceLevelObjective ServiceObjectiveName `json:"serviceLevelObjective,omitempty"` 13617 // ServiceLevelObjectiveID - READ-ONLY; The serviceLevelObjectiveId for SLO usage metric. 13618 ServiceLevelObjectiveID *uuid.UUID `json:"serviceLevelObjectiveId,omitempty"` 13619 // InRangeTimeRatio - READ-ONLY; Gets or sets inRangeTimeRatio for SLO usage metric. 13620 InRangeTimeRatio *float64 `json:"inRangeTimeRatio,omitempty"` 13621} 13622 13623// MarshalJSON is the custom marshaler for SloUsageMetric. 13624func (sum SloUsageMetric) MarshalJSON() ([]byte, error) { 13625 objectMap := make(map[string]interface{}) 13626 return json.Marshal(objectMap) 13627} 13628 13629// SubscriptionUsage usage Metric of a Subscription in a Location. 13630type SubscriptionUsage struct { 13631 autorest.Response `json:"-"` 13632 // SubscriptionUsageProperties - Resource properties. 13633 *SubscriptionUsageProperties `json:"properties,omitempty"` 13634 // ID - READ-ONLY; Resource ID. 13635 ID *string `json:"id,omitempty"` 13636 // Name - READ-ONLY; Resource name. 13637 Name *string `json:"name,omitempty"` 13638 // Type - READ-ONLY; Resource type. 13639 Type *string `json:"type,omitempty"` 13640} 13641 13642// MarshalJSON is the custom marshaler for SubscriptionUsage. 13643func (su SubscriptionUsage) MarshalJSON() ([]byte, error) { 13644 objectMap := make(map[string]interface{}) 13645 if su.SubscriptionUsageProperties != nil { 13646 objectMap["properties"] = su.SubscriptionUsageProperties 13647 } 13648 return json.Marshal(objectMap) 13649} 13650 13651// UnmarshalJSON is the custom unmarshaler for SubscriptionUsage struct. 13652func (su *SubscriptionUsage) UnmarshalJSON(body []byte) error { 13653 var m map[string]*json.RawMessage 13654 err := json.Unmarshal(body, &m) 13655 if err != nil { 13656 return err 13657 } 13658 for k, v := range m { 13659 switch k { 13660 case "properties": 13661 if v != nil { 13662 var subscriptionUsageProperties SubscriptionUsageProperties 13663 err = json.Unmarshal(*v, &subscriptionUsageProperties) 13664 if err != nil { 13665 return err 13666 } 13667 su.SubscriptionUsageProperties = &subscriptionUsageProperties 13668 } 13669 case "id": 13670 if v != nil { 13671 var ID string 13672 err = json.Unmarshal(*v, &ID) 13673 if err != nil { 13674 return err 13675 } 13676 su.ID = &ID 13677 } 13678 case "name": 13679 if v != nil { 13680 var name string 13681 err = json.Unmarshal(*v, &name) 13682 if err != nil { 13683 return err 13684 } 13685 su.Name = &name 13686 } 13687 case "type": 13688 if v != nil { 13689 var typeVar string 13690 err = json.Unmarshal(*v, &typeVar) 13691 if err != nil { 13692 return err 13693 } 13694 su.Type = &typeVar 13695 } 13696 } 13697 } 13698 13699 return nil 13700} 13701 13702// SubscriptionUsageListResult a list of subscription usage metrics in a location. 13703type SubscriptionUsageListResult struct { 13704 autorest.Response `json:"-"` 13705 // Value - READ-ONLY; Array of results. 13706 Value *[]SubscriptionUsage `json:"value,omitempty"` 13707 // NextLink - READ-ONLY; Link to retrieve next page of results. 13708 NextLink *string `json:"nextLink,omitempty"` 13709} 13710 13711// MarshalJSON is the custom marshaler for SubscriptionUsageListResult. 13712func (sulr SubscriptionUsageListResult) MarshalJSON() ([]byte, error) { 13713 objectMap := make(map[string]interface{}) 13714 return json.Marshal(objectMap) 13715} 13716 13717// SubscriptionUsageListResultIterator provides access to a complete listing of SubscriptionUsage values. 13718type SubscriptionUsageListResultIterator struct { 13719 i int 13720 page SubscriptionUsageListResultPage 13721} 13722 13723// NextWithContext advances to the next value. If there was an error making 13724// the request the iterator does not advance and the error is returned. 13725func (iter *SubscriptionUsageListResultIterator) NextWithContext(ctx context.Context) (err error) { 13726 if tracing.IsEnabled() { 13727 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsageListResultIterator.NextWithContext") 13728 defer func() { 13729 sc := -1 13730 if iter.Response().Response.Response != nil { 13731 sc = iter.Response().Response.Response.StatusCode 13732 } 13733 tracing.EndSpan(ctx, sc, err) 13734 }() 13735 } 13736 iter.i++ 13737 if iter.i < len(iter.page.Values()) { 13738 return nil 13739 } 13740 err = iter.page.NextWithContext(ctx) 13741 if err != nil { 13742 iter.i-- 13743 return err 13744 } 13745 iter.i = 0 13746 return nil 13747} 13748 13749// Next advances to the next value. If there was an error making 13750// the request the iterator does not advance and the error is returned. 13751// Deprecated: Use NextWithContext() instead. 13752func (iter *SubscriptionUsageListResultIterator) Next() error { 13753 return iter.NextWithContext(context.Background()) 13754} 13755 13756// NotDone returns true if the enumeration should be started or is not yet complete. 13757func (iter SubscriptionUsageListResultIterator) NotDone() bool { 13758 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 13759} 13760 13761// Response returns the raw server response from the last page request. 13762func (iter SubscriptionUsageListResultIterator) Response() SubscriptionUsageListResult { 13763 return iter.page.Response() 13764} 13765 13766// Value returns the current value or a zero-initialized value if the 13767// iterator has advanced beyond the end of the collection. 13768func (iter SubscriptionUsageListResultIterator) Value() SubscriptionUsage { 13769 if !iter.page.NotDone() { 13770 return SubscriptionUsage{} 13771 } 13772 return iter.page.Values()[iter.i] 13773} 13774 13775// Creates a new instance of the SubscriptionUsageListResultIterator type. 13776func NewSubscriptionUsageListResultIterator(page SubscriptionUsageListResultPage) SubscriptionUsageListResultIterator { 13777 return SubscriptionUsageListResultIterator{page: page} 13778} 13779 13780// IsEmpty returns true if the ListResult contains no values. 13781func (sulr SubscriptionUsageListResult) IsEmpty() bool { 13782 return sulr.Value == nil || len(*sulr.Value) == 0 13783} 13784 13785// hasNextLink returns true if the NextLink is not empty. 13786func (sulr SubscriptionUsageListResult) hasNextLink() bool { 13787 return sulr.NextLink != nil && len(*sulr.NextLink) != 0 13788} 13789 13790// subscriptionUsageListResultPreparer prepares a request to retrieve the next set of results. 13791// It returns nil if no more results exist. 13792func (sulr SubscriptionUsageListResult) subscriptionUsageListResultPreparer(ctx context.Context) (*http.Request, error) { 13793 if !sulr.hasNextLink() { 13794 return nil, nil 13795 } 13796 return autorest.Prepare((&http.Request{}).WithContext(ctx), 13797 autorest.AsJSON(), 13798 autorest.AsGet(), 13799 autorest.WithBaseURL(to.String(sulr.NextLink))) 13800} 13801 13802// SubscriptionUsageListResultPage contains a page of SubscriptionUsage values. 13803type SubscriptionUsageListResultPage struct { 13804 fn func(context.Context, SubscriptionUsageListResult) (SubscriptionUsageListResult, error) 13805 sulr SubscriptionUsageListResult 13806} 13807 13808// NextWithContext advances to the next page of values. If there was an error making 13809// the request the page does not advance and the error is returned. 13810func (page *SubscriptionUsageListResultPage) NextWithContext(ctx context.Context) (err error) { 13811 if tracing.IsEnabled() { 13812 ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionUsageListResultPage.NextWithContext") 13813 defer func() { 13814 sc := -1 13815 if page.Response().Response.Response != nil { 13816 sc = page.Response().Response.Response.StatusCode 13817 } 13818 tracing.EndSpan(ctx, sc, err) 13819 }() 13820 } 13821 for { 13822 next, err := page.fn(ctx, page.sulr) 13823 if err != nil { 13824 return err 13825 } 13826 page.sulr = next 13827 if !next.hasNextLink() || !next.IsEmpty() { 13828 break 13829 } 13830 } 13831 return nil 13832} 13833 13834// Next advances to the next page of values. If there was an error making 13835// the request the page does not advance and the error is returned. 13836// Deprecated: Use NextWithContext() instead. 13837func (page *SubscriptionUsageListResultPage) Next() error { 13838 return page.NextWithContext(context.Background()) 13839} 13840 13841// NotDone returns true if the page enumeration should be started or is not yet complete. 13842func (page SubscriptionUsageListResultPage) NotDone() bool { 13843 return !page.sulr.IsEmpty() 13844} 13845 13846// Response returns the raw server response from the last page request. 13847func (page SubscriptionUsageListResultPage) Response() SubscriptionUsageListResult { 13848 return page.sulr 13849} 13850 13851// Values returns the slice of values for the current page or nil if there are no values. 13852func (page SubscriptionUsageListResultPage) Values() []SubscriptionUsage { 13853 if page.sulr.IsEmpty() { 13854 return nil 13855 } 13856 return *page.sulr.Value 13857} 13858 13859// Creates a new instance of the SubscriptionUsageListResultPage type. 13860func NewSubscriptionUsageListResultPage(cur SubscriptionUsageListResult, getNextPage func(context.Context, SubscriptionUsageListResult) (SubscriptionUsageListResult, error)) SubscriptionUsageListResultPage { 13861 return SubscriptionUsageListResultPage{ 13862 fn: getNextPage, 13863 sulr: cur, 13864 } 13865} 13866 13867// SubscriptionUsageProperties properties of a subscription usage. 13868type SubscriptionUsageProperties struct { 13869 // DisplayName - READ-ONLY; User-readable name of the metric. 13870 DisplayName *string `json:"displayName,omitempty"` 13871 // CurrentValue - READ-ONLY; Current value of the metric. 13872 CurrentValue *float64 `json:"currentValue,omitempty"` 13873 // Limit - READ-ONLY; Boundary value of the metric. 13874 Limit *float64 `json:"limit,omitempty"` 13875 // Unit - READ-ONLY; Unit of the metric. 13876 Unit *string `json:"unit,omitempty"` 13877} 13878 13879// MarshalJSON is the custom marshaler for SubscriptionUsageProperties. 13880func (sup SubscriptionUsageProperties) MarshalJSON() ([]byte, error) { 13881 objectMap := make(map[string]interface{}) 13882 return json.Marshal(objectMap) 13883} 13884 13885// SyncAgent an Azure SQL Database sync agent. 13886type SyncAgent struct { 13887 autorest.Response `json:"-"` 13888 // SyncAgentProperties - Resource properties. 13889 *SyncAgentProperties `json:"properties,omitempty"` 13890 // ID - READ-ONLY; Resource ID. 13891 ID *string `json:"id,omitempty"` 13892 // Name - READ-ONLY; Resource name. 13893 Name *string `json:"name,omitempty"` 13894 // Type - READ-ONLY; Resource type. 13895 Type *string `json:"type,omitempty"` 13896} 13897 13898// MarshalJSON is the custom marshaler for SyncAgent. 13899func (sa SyncAgent) MarshalJSON() ([]byte, error) { 13900 objectMap := make(map[string]interface{}) 13901 if sa.SyncAgentProperties != nil { 13902 objectMap["properties"] = sa.SyncAgentProperties 13903 } 13904 return json.Marshal(objectMap) 13905} 13906 13907// UnmarshalJSON is the custom unmarshaler for SyncAgent struct. 13908func (sa *SyncAgent) UnmarshalJSON(body []byte) error { 13909 var m map[string]*json.RawMessage 13910 err := json.Unmarshal(body, &m) 13911 if err != nil { 13912 return err 13913 } 13914 for k, v := range m { 13915 switch k { 13916 case "properties": 13917 if v != nil { 13918 var syncAgentProperties SyncAgentProperties 13919 err = json.Unmarshal(*v, &syncAgentProperties) 13920 if err != nil { 13921 return err 13922 } 13923 sa.SyncAgentProperties = &syncAgentProperties 13924 } 13925 case "id": 13926 if v != nil { 13927 var ID string 13928 err = json.Unmarshal(*v, &ID) 13929 if err != nil { 13930 return err 13931 } 13932 sa.ID = &ID 13933 } 13934 case "name": 13935 if v != nil { 13936 var name string 13937 err = json.Unmarshal(*v, &name) 13938 if err != nil { 13939 return err 13940 } 13941 sa.Name = &name 13942 } 13943 case "type": 13944 if v != nil { 13945 var typeVar string 13946 err = json.Unmarshal(*v, &typeVar) 13947 if err != nil { 13948 return err 13949 } 13950 sa.Type = &typeVar 13951 } 13952 } 13953 } 13954 13955 return nil 13956} 13957 13958// SyncAgentKeyProperties properties of an Azure SQL Database sync agent key. 13959type SyncAgentKeyProperties struct { 13960 autorest.Response `json:"-"` 13961 // SyncAgentKey - READ-ONLY; Key of sync agent. 13962 SyncAgentKey *string `json:"syncAgentKey,omitempty"` 13963} 13964 13965// MarshalJSON is the custom marshaler for SyncAgentKeyProperties. 13966func (sakp SyncAgentKeyProperties) MarshalJSON() ([]byte, error) { 13967 objectMap := make(map[string]interface{}) 13968 return json.Marshal(objectMap) 13969} 13970 13971// SyncAgentLinkedDatabase an Azure SQL Database sync agent linked database. 13972type SyncAgentLinkedDatabase struct { 13973 // SyncAgentLinkedDatabaseProperties - Resource properties. 13974 *SyncAgentLinkedDatabaseProperties `json:"properties,omitempty"` 13975 // ID - READ-ONLY; Resource ID. 13976 ID *string `json:"id,omitempty"` 13977 // Name - READ-ONLY; Resource name. 13978 Name *string `json:"name,omitempty"` 13979 // Type - READ-ONLY; Resource type. 13980 Type *string `json:"type,omitempty"` 13981} 13982 13983// MarshalJSON is the custom marshaler for SyncAgentLinkedDatabase. 13984func (sald SyncAgentLinkedDatabase) MarshalJSON() ([]byte, error) { 13985 objectMap := make(map[string]interface{}) 13986 if sald.SyncAgentLinkedDatabaseProperties != nil { 13987 objectMap["properties"] = sald.SyncAgentLinkedDatabaseProperties 13988 } 13989 return json.Marshal(objectMap) 13990} 13991 13992// UnmarshalJSON is the custom unmarshaler for SyncAgentLinkedDatabase struct. 13993func (sald *SyncAgentLinkedDatabase) UnmarshalJSON(body []byte) error { 13994 var m map[string]*json.RawMessage 13995 err := json.Unmarshal(body, &m) 13996 if err != nil { 13997 return err 13998 } 13999 for k, v := range m { 14000 switch k { 14001 case "properties": 14002 if v != nil { 14003 var syncAgentLinkedDatabaseProperties SyncAgentLinkedDatabaseProperties 14004 err = json.Unmarshal(*v, &syncAgentLinkedDatabaseProperties) 14005 if err != nil { 14006 return err 14007 } 14008 sald.SyncAgentLinkedDatabaseProperties = &syncAgentLinkedDatabaseProperties 14009 } 14010 case "id": 14011 if v != nil { 14012 var ID string 14013 err = json.Unmarshal(*v, &ID) 14014 if err != nil { 14015 return err 14016 } 14017 sald.ID = &ID 14018 } 14019 case "name": 14020 if v != nil { 14021 var name string 14022 err = json.Unmarshal(*v, &name) 14023 if err != nil { 14024 return err 14025 } 14026 sald.Name = &name 14027 } 14028 case "type": 14029 if v != nil { 14030 var typeVar string 14031 err = json.Unmarshal(*v, &typeVar) 14032 if err != nil { 14033 return err 14034 } 14035 sald.Type = &typeVar 14036 } 14037 } 14038 } 14039 14040 return nil 14041} 14042 14043// SyncAgentLinkedDatabaseListResult a list of sync agent linked databases. 14044type SyncAgentLinkedDatabaseListResult struct { 14045 autorest.Response `json:"-"` 14046 // Value - READ-ONLY; Array of results. 14047 Value *[]SyncAgentLinkedDatabase `json:"value,omitempty"` 14048 // NextLink - READ-ONLY; Link to retrieve next page of results. 14049 NextLink *string `json:"nextLink,omitempty"` 14050} 14051 14052// MarshalJSON is the custom marshaler for SyncAgentLinkedDatabaseListResult. 14053func (saldlr SyncAgentLinkedDatabaseListResult) MarshalJSON() ([]byte, error) { 14054 objectMap := make(map[string]interface{}) 14055 return json.Marshal(objectMap) 14056} 14057 14058// SyncAgentLinkedDatabaseListResultIterator provides access to a complete listing of 14059// SyncAgentLinkedDatabase values. 14060type SyncAgentLinkedDatabaseListResultIterator struct { 14061 i int 14062 page SyncAgentLinkedDatabaseListResultPage 14063} 14064 14065// NextWithContext advances to the next value. If there was an error making 14066// the request the iterator does not advance and the error is returned. 14067func (iter *SyncAgentLinkedDatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { 14068 if tracing.IsEnabled() { 14069 ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentLinkedDatabaseListResultIterator.NextWithContext") 14070 defer func() { 14071 sc := -1 14072 if iter.Response().Response.Response != nil { 14073 sc = iter.Response().Response.Response.StatusCode 14074 } 14075 tracing.EndSpan(ctx, sc, err) 14076 }() 14077 } 14078 iter.i++ 14079 if iter.i < len(iter.page.Values()) { 14080 return nil 14081 } 14082 err = iter.page.NextWithContext(ctx) 14083 if err != nil { 14084 iter.i-- 14085 return err 14086 } 14087 iter.i = 0 14088 return nil 14089} 14090 14091// Next advances to the next value. If there was an error making 14092// the request the iterator does not advance and the error is returned. 14093// Deprecated: Use NextWithContext() instead. 14094func (iter *SyncAgentLinkedDatabaseListResultIterator) Next() error { 14095 return iter.NextWithContext(context.Background()) 14096} 14097 14098// NotDone returns true if the enumeration should be started or is not yet complete. 14099func (iter SyncAgentLinkedDatabaseListResultIterator) NotDone() bool { 14100 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 14101} 14102 14103// Response returns the raw server response from the last page request. 14104func (iter SyncAgentLinkedDatabaseListResultIterator) Response() SyncAgentLinkedDatabaseListResult { 14105 return iter.page.Response() 14106} 14107 14108// Value returns the current value or a zero-initialized value if the 14109// iterator has advanced beyond the end of the collection. 14110func (iter SyncAgentLinkedDatabaseListResultIterator) Value() SyncAgentLinkedDatabase { 14111 if !iter.page.NotDone() { 14112 return SyncAgentLinkedDatabase{} 14113 } 14114 return iter.page.Values()[iter.i] 14115} 14116 14117// Creates a new instance of the SyncAgentLinkedDatabaseListResultIterator type. 14118func NewSyncAgentLinkedDatabaseListResultIterator(page SyncAgentLinkedDatabaseListResultPage) SyncAgentLinkedDatabaseListResultIterator { 14119 return SyncAgentLinkedDatabaseListResultIterator{page: page} 14120} 14121 14122// IsEmpty returns true if the ListResult contains no values. 14123func (saldlr SyncAgentLinkedDatabaseListResult) IsEmpty() bool { 14124 return saldlr.Value == nil || len(*saldlr.Value) == 0 14125} 14126 14127// hasNextLink returns true if the NextLink is not empty. 14128func (saldlr SyncAgentLinkedDatabaseListResult) hasNextLink() bool { 14129 return saldlr.NextLink != nil && len(*saldlr.NextLink) != 0 14130} 14131 14132// syncAgentLinkedDatabaseListResultPreparer prepares a request to retrieve the next set of results. 14133// It returns nil if no more results exist. 14134func (saldlr SyncAgentLinkedDatabaseListResult) syncAgentLinkedDatabaseListResultPreparer(ctx context.Context) (*http.Request, error) { 14135 if !saldlr.hasNextLink() { 14136 return nil, nil 14137 } 14138 return autorest.Prepare((&http.Request{}).WithContext(ctx), 14139 autorest.AsJSON(), 14140 autorest.AsGet(), 14141 autorest.WithBaseURL(to.String(saldlr.NextLink))) 14142} 14143 14144// SyncAgentLinkedDatabaseListResultPage contains a page of SyncAgentLinkedDatabase values. 14145type SyncAgentLinkedDatabaseListResultPage struct { 14146 fn func(context.Context, SyncAgentLinkedDatabaseListResult) (SyncAgentLinkedDatabaseListResult, error) 14147 saldlr SyncAgentLinkedDatabaseListResult 14148} 14149 14150// NextWithContext advances to the next page of values. If there was an error making 14151// the request the page does not advance and the error is returned. 14152func (page *SyncAgentLinkedDatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { 14153 if tracing.IsEnabled() { 14154 ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentLinkedDatabaseListResultPage.NextWithContext") 14155 defer func() { 14156 sc := -1 14157 if page.Response().Response.Response != nil { 14158 sc = page.Response().Response.Response.StatusCode 14159 } 14160 tracing.EndSpan(ctx, sc, err) 14161 }() 14162 } 14163 for { 14164 next, err := page.fn(ctx, page.saldlr) 14165 if err != nil { 14166 return err 14167 } 14168 page.saldlr = next 14169 if !next.hasNextLink() || !next.IsEmpty() { 14170 break 14171 } 14172 } 14173 return nil 14174} 14175 14176// Next advances to the next page of values. If there was an error making 14177// the request the page does not advance and the error is returned. 14178// Deprecated: Use NextWithContext() instead. 14179func (page *SyncAgentLinkedDatabaseListResultPage) Next() error { 14180 return page.NextWithContext(context.Background()) 14181} 14182 14183// NotDone returns true if the page enumeration should be started or is not yet complete. 14184func (page SyncAgentLinkedDatabaseListResultPage) NotDone() bool { 14185 return !page.saldlr.IsEmpty() 14186} 14187 14188// Response returns the raw server response from the last page request. 14189func (page SyncAgentLinkedDatabaseListResultPage) Response() SyncAgentLinkedDatabaseListResult { 14190 return page.saldlr 14191} 14192 14193// Values returns the slice of values for the current page or nil if there are no values. 14194func (page SyncAgentLinkedDatabaseListResultPage) Values() []SyncAgentLinkedDatabase { 14195 if page.saldlr.IsEmpty() { 14196 return nil 14197 } 14198 return *page.saldlr.Value 14199} 14200 14201// Creates a new instance of the SyncAgentLinkedDatabaseListResultPage type. 14202func NewSyncAgentLinkedDatabaseListResultPage(cur SyncAgentLinkedDatabaseListResult, getNextPage func(context.Context, SyncAgentLinkedDatabaseListResult) (SyncAgentLinkedDatabaseListResult, error)) SyncAgentLinkedDatabaseListResultPage { 14203 return SyncAgentLinkedDatabaseListResultPage{ 14204 fn: getNextPage, 14205 saldlr: cur, 14206 } 14207} 14208 14209// SyncAgentLinkedDatabaseProperties properties of an Azure SQL Database sync agent linked database. 14210type SyncAgentLinkedDatabaseProperties struct { 14211 // DatabaseType - READ-ONLY; Type of the sync agent linked database. Possible values include: 'AzureSQLDatabase', 'SQLServerDatabase' 14212 DatabaseType SyncMemberDbType `json:"databaseType,omitempty"` 14213 // DatabaseID - READ-ONLY; Id of the sync agent linked database. 14214 DatabaseID *string `json:"databaseId,omitempty"` 14215 // Description - READ-ONLY; Description of the sync agent linked database. 14216 Description *string `json:"description,omitempty"` 14217 // ServerName - READ-ONLY; Server name of the sync agent linked database. 14218 ServerName *string `json:"serverName,omitempty"` 14219 // DatabaseName - READ-ONLY; Database name of the sync agent linked database. 14220 DatabaseName *string `json:"databaseName,omitempty"` 14221 // UserName - READ-ONLY; User name of the sync agent linked database. 14222 UserName *string `json:"userName,omitempty"` 14223} 14224 14225// MarshalJSON is the custom marshaler for SyncAgentLinkedDatabaseProperties. 14226func (saldp SyncAgentLinkedDatabaseProperties) MarshalJSON() ([]byte, error) { 14227 objectMap := make(map[string]interface{}) 14228 return json.Marshal(objectMap) 14229} 14230 14231// SyncAgentListResult a list of sync agents. 14232type SyncAgentListResult struct { 14233 autorest.Response `json:"-"` 14234 // Value - READ-ONLY; Array of results. 14235 Value *[]SyncAgent `json:"value,omitempty"` 14236 // NextLink - READ-ONLY; Link to retrieve next page of results. 14237 NextLink *string `json:"nextLink,omitempty"` 14238} 14239 14240// MarshalJSON is the custom marshaler for SyncAgentListResult. 14241func (salr SyncAgentListResult) MarshalJSON() ([]byte, error) { 14242 objectMap := make(map[string]interface{}) 14243 return json.Marshal(objectMap) 14244} 14245 14246// SyncAgentListResultIterator provides access to a complete listing of SyncAgent values. 14247type SyncAgentListResultIterator struct { 14248 i int 14249 page SyncAgentListResultPage 14250} 14251 14252// NextWithContext advances to the next value. If there was an error making 14253// the request the iterator does not advance and the error is returned. 14254func (iter *SyncAgentListResultIterator) NextWithContext(ctx context.Context) (err error) { 14255 if tracing.IsEnabled() { 14256 ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentListResultIterator.NextWithContext") 14257 defer func() { 14258 sc := -1 14259 if iter.Response().Response.Response != nil { 14260 sc = iter.Response().Response.Response.StatusCode 14261 } 14262 tracing.EndSpan(ctx, sc, err) 14263 }() 14264 } 14265 iter.i++ 14266 if iter.i < len(iter.page.Values()) { 14267 return nil 14268 } 14269 err = iter.page.NextWithContext(ctx) 14270 if err != nil { 14271 iter.i-- 14272 return err 14273 } 14274 iter.i = 0 14275 return nil 14276} 14277 14278// Next advances to the next value. If there was an error making 14279// the request the iterator does not advance and the error is returned. 14280// Deprecated: Use NextWithContext() instead. 14281func (iter *SyncAgentListResultIterator) Next() error { 14282 return iter.NextWithContext(context.Background()) 14283} 14284 14285// NotDone returns true if the enumeration should be started or is not yet complete. 14286func (iter SyncAgentListResultIterator) NotDone() bool { 14287 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 14288} 14289 14290// Response returns the raw server response from the last page request. 14291func (iter SyncAgentListResultIterator) Response() SyncAgentListResult { 14292 return iter.page.Response() 14293} 14294 14295// Value returns the current value or a zero-initialized value if the 14296// iterator has advanced beyond the end of the collection. 14297func (iter SyncAgentListResultIterator) Value() SyncAgent { 14298 if !iter.page.NotDone() { 14299 return SyncAgent{} 14300 } 14301 return iter.page.Values()[iter.i] 14302} 14303 14304// Creates a new instance of the SyncAgentListResultIterator type. 14305func NewSyncAgentListResultIterator(page SyncAgentListResultPage) SyncAgentListResultIterator { 14306 return SyncAgentListResultIterator{page: page} 14307} 14308 14309// IsEmpty returns true if the ListResult contains no values. 14310func (salr SyncAgentListResult) IsEmpty() bool { 14311 return salr.Value == nil || len(*salr.Value) == 0 14312} 14313 14314// hasNextLink returns true if the NextLink is not empty. 14315func (salr SyncAgentListResult) hasNextLink() bool { 14316 return salr.NextLink != nil && len(*salr.NextLink) != 0 14317} 14318 14319// syncAgentListResultPreparer prepares a request to retrieve the next set of results. 14320// It returns nil if no more results exist. 14321func (salr SyncAgentListResult) syncAgentListResultPreparer(ctx context.Context) (*http.Request, error) { 14322 if !salr.hasNextLink() { 14323 return nil, nil 14324 } 14325 return autorest.Prepare((&http.Request{}).WithContext(ctx), 14326 autorest.AsJSON(), 14327 autorest.AsGet(), 14328 autorest.WithBaseURL(to.String(salr.NextLink))) 14329} 14330 14331// SyncAgentListResultPage contains a page of SyncAgent values. 14332type SyncAgentListResultPage struct { 14333 fn func(context.Context, SyncAgentListResult) (SyncAgentListResult, error) 14334 salr SyncAgentListResult 14335} 14336 14337// NextWithContext advances to the next page of values. If there was an error making 14338// the request the page does not advance and the error is returned. 14339func (page *SyncAgentListResultPage) NextWithContext(ctx context.Context) (err error) { 14340 if tracing.IsEnabled() { 14341 ctx = tracing.StartSpan(ctx, fqdn+"/SyncAgentListResultPage.NextWithContext") 14342 defer func() { 14343 sc := -1 14344 if page.Response().Response.Response != nil { 14345 sc = page.Response().Response.Response.StatusCode 14346 } 14347 tracing.EndSpan(ctx, sc, err) 14348 }() 14349 } 14350 for { 14351 next, err := page.fn(ctx, page.salr) 14352 if err != nil { 14353 return err 14354 } 14355 page.salr = next 14356 if !next.hasNextLink() || !next.IsEmpty() { 14357 break 14358 } 14359 } 14360 return nil 14361} 14362 14363// Next advances to the next page of values. If there was an error making 14364// the request the page does not advance and the error is returned. 14365// Deprecated: Use NextWithContext() instead. 14366func (page *SyncAgentListResultPage) Next() error { 14367 return page.NextWithContext(context.Background()) 14368} 14369 14370// NotDone returns true if the page enumeration should be started or is not yet complete. 14371func (page SyncAgentListResultPage) NotDone() bool { 14372 return !page.salr.IsEmpty() 14373} 14374 14375// Response returns the raw server response from the last page request. 14376func (page SyncAgentListResultPage) Response() SyncAgentListResult { 14377 return page.salr 14378} 14379 14380// Values returns the slice of values for the current page or nil if there are no values. 14381func (page SyncAgentListResultPage) Values() []SyncAgent { 14382 if page.salr.IsEmpty() { 14383 return nil 14384 } 14385 return *page.salr.Value 14386} 14387 14388// Creates a new instance of the SyncAgentListResultPage type. 14389func NewSyncAgentListResultPage(cur SyncAgentListResult, getNextPage func(context.Context, SyncAgentListResult) (SyncAgentListResult, error)) SyncAgentListResultPage { 14390 return SyncAgentListResultPage{ 14391 fn: getNextPage, 14392 salr: cur, 14393 } 14394} 14395 14396// SyncAgentProperties properties of an Azure SQL Database sync agent. 14397type SyncAgentProperties struct { 14398 // Name - READ-ONLY; Name of the sync agent. 14399 Name *string `json:"name,omitempty"` 14400 // SyncDatabaseID - ARM resource id of the sync database in the sync agent. 14401 SyncDatabaseID *string `json:"syncDatabaseId,omitempty"` 14402 // LastAliveTime - READ-ONLY; Last alive time of the sync agent. 14403 LastAliveTime *date.Time `json:"lastAliveTime,omitempty"` 14404 // State - READ-ONLY; State of the sync agent. Possible values include: 'SyncAgentStateOnline', 'SyncAgentStateOffline', 'SyncAgentStateNeverConnected' 14405 State SyncAgentState `json:"state,omitempty"` 14406 // IsUpToDate - READ-ONLY; If the sync agent version is up to date. 14407 IsUpToDate *bool `json:"isUpToDate,omitempty"` 14408 // ExpiryTime - READ-ONLY; Expiration time of the sync agent version. 14409 ExpiryTime *date.Time `json:"expiryTime,omitempty"` 14410 // Version - READ-ONLY; Version of the sync agent. 14411 Version *string `json:"version,omitempty"` 14412} 14413 14414// MarshalJSON is the custom marshaler for SyncAgentProperties. 14415func (sap SyncAgentProperties) MarshalJSON() ([]byte, error) { 14416 objectMap := make(map[string]interface{}) 14417 if sap.SyncDatabaseID != nil { 14418 objectMap["syncDatabaseId"] = sap.SyncDatabaseID 14419 } 14420 return json.Marshal(objectMap) 14421} 14422 14423// SyncAgentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 14424// long-running operation. 14425type SyncAgentsCreateOrUpdateFuture struct { 14426 azure.FutureAPI 14427 // Result returns the result of the asynchronous operation. 14428 // If the operation has not completed it will return an error. 14429 Result func(SyncAgentsClient) (SyncAgent, error) 14430} 14431 14432// UnmarshalJSON is the custom unmarshaller for CreateFuture. 14433func (future *SyncAgentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 14434 var azFuture azure.Future 14435 if err := json.Unmarshal(body, &azFuture); err != nil { 14436 return err 14437 } 14438 future.FutureAPI = &azFuture 14439 future.Result = future.result 14440 return nil 14441} 14442 14443// result is the default implementation for SyncAgentsCreateOrUpdateFuture.Result. 14444func (future *SyncAgentsCreateOrUpdateFuture) result(client SyncAgentsClient) (sa SyncAgent, err error) { 14445 var done bool 14446 done, err = future.DoneWithContext(context.Background(), client) 14447 if err != nil { 14448 err = autorest.NewErrorWithError(err, "sql.SyncAgentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 14449 return 14450 } 14451 if !done { 14452 sa.Response.Response = future.Response() 14453 err = azure.NewAsyncOpIncompleteError("sql.SyncAgentsCreateOrUpdateFuture") 14454 return 14455 } 14456 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 14457 if sa.Response.Response, err = future.GetResult(sender); err == nil && sa.Response.Response.StatusCode != http.StatusNoContent { 14458 sa, err = client.CreateOrUpdateResponder(sa.Response.Response) 14459 if err != nil { 14460 err = autorest.NewErrorWithError(err, "sql.SyncAgentsCreateOrUpdateFuture", "Result", sa.Response.Response, "Failure responding to request") 14461 } 14462 } 14463 return 14464} 14465 14466// SyncAgentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 14467// operation. 14468type SyncAgentsDeleteFuture struct { 14469 azure.FutureAPI 14470 // Result returns the result of the asynchronous operation. 14471 // If the operation has not completed it will return an error. 14472 Result func(SyncAgentsClient) (autorest.Response, error) 14473} 14474 14475// UnmarshalJSON is the custom unmarshaller for CreateFuture. 14476func (future *SyncAgentsDeleteFuture) UnmarshalJSON(body []byte) error { 14477 var azFuture azure.Future 14478 if err := json.Unmarshal(body, &azFuture); err != nil { 14479 return err 14480 } 14481 future.FutureAPI = &azFuture 14482 future.Result = future.result 14483 return nil 14484} 14485 14486// result is the default implementation for SyncAgentsDeleteFuture.Result. 14487func (future *SyncAgentsDeleteFuture) result(client SyncAgentsClient) (ar autorest.Response, err error) { 14488 var done bool 14489 done, err = future.DoneWithContext(context.Background(), client) 14490 if err != nil { 14491 err = autorest.NewErrorWithError(err, "sql.SyncAgentsDeleteFuture", "Result", future.Response(), "Polling failure") 14492 return 14493 } 14494 if !done { 14495 ar.Response = future.Response() 14496 err = azure.NewAsyncOpIncompleteError("sql.SyncAgentsDeleteFuture") 14497 return 14498 } 14499 ar.Response = future.Response() 14500 return 14501} 14502 14503// SyncDatabaseIDListResult a list of sync database ID properties. 14504type SyncDatabaseIDListResult struct { 14505 autorest.Response `json:"-"` 14506 // Value - READ-ONLY; Array of results. 14507 Value *[]SyncDatabaseIDProperties `json:"value,omitempty"` 14508 // NextLink - READ-ONLY; Link to retrieve next page of results. 14509 NextLink *string `json:"nextLink,omitempty"` 14510} 14511 14512// MarshalJSON is the custom marshaler for SyncDatabaseIDListResult. 14513func (sdilr SyncDatabaseIDListResult) MarshalJSON() ([]byte, error) { 14514 objectMap := make(map[string]interface{}) 14515 return json.Marshal(objectMap) 14516} 14517 14518// SyncDatabaseIDListResultIterator provides access to a complete listing of SyncDatabaseIDProperties 14519// values. 14520type SyncDatabaseIDListResultIterator struct { 14521 i int 14522 page SyncDatabaseIDListResultPage 14523} 14524 14525// NextWithContext advances to the next value. If there was an error making 14526// the request the iterator does not advance and the error is returned. 14527func (iter *SyncDatabaseIDListResultIterator) NextWithContext(ctx context.Context) (err error) { 14528 if tracing.IsEnabled() { 14529 ctx = tracing.StartSpan(ctx, fqdn+"/SyncDatabaseIDListResultIterator.NextWithContext") 14530 defer func() { 14531 sc := -1 14532 if iter.Response().Response.Response != nil { 14533 sc = iter.Response().Response.Response.StatusCode 14534 } 14535 tracing.EndSpan(ctx, sc, err) 14536 }() 14537 } 14538 iter.i++ 14539 if iter.i < len(iter.page.Values()) { 14540 return nil 14541 } 14542 err = iter.page.NextWithContext(ctx) 14543 if err != nil { 14544 iter.i-- 14545 return err 14546 } 14547 iter.i = 0 14548 return nil 14549} 14550 14551// Next advances to the next value. If there was an error making 14552// the request the iterator does not advance and the error is returned. 14553// Deprecated: Use NextWithContext() instead. 14554func (iter *SyncDatabaseIDListResultIterator) Next() error { 14555 return iter.NextWithContext(context.Background()) 14556} 14557 14558// NotDone returns true if the enumeration should be started or is not yet complete. 14559func (iter SyncDatabaseIDListResultIterator) NotDone() bool { 14560 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 14561} 14562 14563// Response returns the raw server response from the last page request. 14564func (iter SyncDatabaseIDListResultIterator) Response() SyncDatabaseIDListResult { 14565 return iter.page.Response() 14566} 14567 14568// Value returns the current value or a zero-initialized value if the 14569// iterator has advanced beyond the end of the collection. 14570func (iter SyncDatabaseIDListResultIterator) Value() SyncDatabaseIDProperties { 14571 if !iter.page.NotDone() { 14572 return SyncDatabaseIDProperties{} 14573 } 14574 return iter.page.Values()[iter.i] 14575} 14576 14577// Creates a new instance of the SyncDatabaseIDListResultIterator type. 14578func NewSyncDatabaseIDListResultIterator(page SyncDatabaseIDListResultPage) SyncDatabaseIDListResultIterator { 14579 return SyncDatabaseIDListResultIterator{page: page} 14580} 14581 14582// IsEmpty returns true if the ListResult contains no values. 14583func (sdilr SyncDatabaseIDListResult) IsEmpty() bool { 14584 return sdilr.Value == nil || len(*sdilr.Value) == 0 14585} 14586 14587// hasNextLink returns true if the NextLink is not empty. 14588func (sdilr SyncDatabaseIDListResult) hasNextLink() bool { 14589 return sdilr.NextLink != nil && len(*sdilr.NextLink) != 0 14590} 14591 14592// syncDatabaseIDListResultPreparer prepares a request to retrieve the next set of results. 14593// It returns nil if no more results exist. 14594func (sdilr SyncDatabaseIDListResult) syncDatabaseIDListResultPreparer(ctx context.Context) (*http.Request, error) { 14595 if !sdilr.hasNextLink() { 14596 return nil, nil 14597 } 14598 return autorest.Prepare((&http.Request{}).WithContext(ctx), 14599 autorest.AsJSON(), 14600 autorest.AsGet(), 14601 autorest.WithBaseURL(to.String(sdilr.NextLink))) 14602} 14603 14604// SyncDatabaseIDListResultPage contains a page of SyncDatabaseIDProperties values. 14605type SyncDatabaseIDListResultPage struct { 14606 fn func(context.Context, SyncDatabaseIDListResult) (SyncDatabaseIDListResult, error) 14607 sdilr SyncDatabaseIDListResult 14608} 14609 14610// NextWithContext advances to the next page of values. If there was an error making 14611// the request the page does not advance and the error is returned. 14612func (page *SyncDatabaseIDListResultPage) NextWithContext(ctx context.Context) (err error) { 14613 if tracing.IsEnabled() { 14614 ctx = tracing.StartSpan(ctx, fqdn+"/SyncDatabaseIDListResultPage.NextWithContext") 14615 defer func() { 14616 sc := -1 14617 if page.Response().Response.Response != nil { 14618 sc = page.Response().Response.Response.StatusCode 14619 } 14620 tracing.EndSpan(ctx, sc, err) 14621 }() 14622 } 14623 for { 14624 next, err := page.fn(ctx, page.sdilr) 14625 if err != nil { 14626 return err 14627 } 14628 page.sdilr = next 14629 if !next.hasNextLink() || !next.IsEmpty() { 14630 break 14631 } 14632 } 14633 return nil 14634} 14635 14636// Next advances to the next page of values. If there was an error making 14637// the request the page does not advance and the error is returned. 14638// Deprecated: Use NextWithContext() instead. 14639func (page *SyncDatabaseIDListResultPage) Next() error { 14640 return page.NextWithContext(context.Background()) 14641} 14642 14643// NotDone returns true if the page enumeration should be started or is not yet complete. 14644func (page SyncDatabaseIDListResultPage) NotDone() bool { 14645 return !page.sdilr.IsEmpty() 14646} 14647 14648// Response returns the raw server response from the last page request. 14649func (page SyncDatabaseIDListResultPage) Response() SyncDatabaseIDListResult { 14650 return page.sdilr 14651} 14652 14653// Values returns the slice of values for the current page or nil if there are no values. 14654func (page SyncDatabaseIDListResultPage) Values() []SyncDatabaseIDProperties { 14655 if page.sdilr.IsEmpty() { 14656 return nil 14657 } 14658 return *page.sdilr.Value 14659} 14660 14661// Creates a new instance of the SyncDatabaseIDListResultPage type. 14662func NewSyncDatabaseIDListResultPage(cur SyncDatabaseIDListResult, getNextPage func(context.Context, SyncDatabaseIDListResult) (SyncDatabaseIDListResult, error)) SyncDatabaseIDListResultPage { 14663 return SyncDatabaseIDListResultPage{ 14664 fn: getNextPage, 14665 sdilr: cur, 14666 } 14667} 14668 14669// SyncDatabaseIDProperties properties of the sync database id. 14670type SyncDatabaseIDProperties struct { 14671 // ID - READ-ONLY; ARM resource id of sync database. 14672 ID *string `json:"id,omitempty"` 14673} 14674 14675// MarshalJSON is the custom marshaler for SyncDatabaseIDProperties. 14676func (sdip SyncDatabaseIDProperties) MarshalJSON() ([]byte, error) { 14677 objectMap := make(map[string]interface{}) 14678 return json.Marshal(objectMap) 14679} 14680 14681// SyncFullSchemaProperties properties of the database full schema. 14682type SyncFullSchemaProperties struct { 14683 // Tables - READ-ONLY; List of tables in the database full schema. 14684 Tables *[]SyncFullSchemaTable `json:"tables,omitempty"` 14685 // LastUpdateTime - READ-ONLY; Last update time of the database schema. 14686 LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` 14687} 14688 14689// MarshalJSON is the custom marshaler for SyncFullSchemaProperties. 14690func (sfsp SyncFullSchemaProperties) MarshalJSON() ([]byte, error) { 14691 objectMap := make(map[string]interface{}) 14692 return json.Marshal(objectMap) 14693} 14694 14695// SyncFullSchemaPropertiesListResult a list of sync schema properties. 14696type SyncFullSchemaPropertiesListResult struct { 14697 autorest.Response `json:"-"` 14698 // Value - READ-ONLY; Array of results. 14699 Value *[]SyncFullSchemaProperties `json:"value,omitempty"` 14700 // NextLink - READ-ONLY; Link to retrieve next page of results. 14701 NextLink *string `json:"nextLink,omitempty"` 14702} 14703 14704// MarshalJSON is the custom marshaler for SyncFullSchemaPropertiesListResult. 14705func (sfsplr SyncFullSchemaPropertiesListResult) MarshalJSON() ([]byte, error) { 14706 objectMap := make(map[string]interface{}) 14707 return json.Marshal(objectMap) 14708} 14709 14710// SyncFullSchemaPropertiesListResultIterator provides access to a complete listing of 14711// SyncFullSchemaProperties values. 14712type SyncFullSchemaPropertiesListResultIterator struct { 14713 i int 14714 page SyncFullSchemaPropertiesListResultPage 14715} 14716 14717// NextWithContext advances to the next value. If there was an error making 14718// the request the iterator does not advance and the error is returned. 14719func (iter *SyncFullSchemaPropertiesListResultIterator) NextWithContext(ctx context.Context) (err error) { 14720 if tracing.IsEnabled() { 14721 ctx = tracing.StartSpan(ctx, fqdn+"/SyncFullSchemaPropertiesListResultIterator.NextWithContext") 14722 defer func() { 14723 sc := -1 14724 if iter.Response().Response.Response != nil { 14725 sc = iter.Response().Response.Response.StatusCode 14726 } 14727 tracing.EndSpan(ctx, sc, err) 14728 }() 14729 } 14730 iter.i++ 14731 if iter.i < len(iter.page.Values()) { 14732 return nil 14733 } 14734 err = iter.page.NextWithContext(ctx) 14735 if err != nil { 14736 iter.i-- 14737 return err 14738 } 14739 iter.i = 0 14740 return nil 14741} 14742 14743// Next advances to the next value. If there was an error making 14744// the request the iterator does not advance and the error is returned. 14745// Deprecated: Use NextWithContext() instead. 14746func (iter *SyncFullSchemaPropertiesListResultIterator) Next() error { 14747 return iter.NextWithContext(context.Background()) 14748} 14749 14750// NotDone returns true if the enumeration should be started or is not yet complete. 14751func (iter SyncFullSchemaPropertiesListResultIterator) NotDone() bool { 14752 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 14753} 14754 14755// Response returns the raw server response from the last page request. 14756func (iter SyncFullSchemaPropertiesListResultIterator) Response() SyncFullSchemaPropertiesListResult { 14757 return iter.page.Response() 14758} 14759 14760// Value returns the current value or a zero-initialized value if the 14761// iterator has advanced beyond the end of the collection. 14762func (iter SyncFullSchemaPropertiesListResultIterator) Value() SyncFullSchemaProperties { 14763 if !iter.page.NotDone() { 14764 return SyncFullSchemaProperties{} 14765 } 14766 return iter.page.Values()[iter.i] 14767} 14768 14769// Creates a new instance of the SyncFullSchemaPropertiesListResultIterator type. 14770func NewSyncFullSchemaPropertiesListResultIterator(page SyncFullSchemaPropertiesListResultPage) SyncFullSchemaPropertiesListResultIterator { 14771 return SyncFullSchemaPropertiesListResultIterator{page: page} 14772} 14773 14774// IsEmpty returns true if the ListResult contains no values. 14775func (sfsplr SyncFullSchemaPropertiesListResult) IsEmpty() bool { 14776 return sfsplr.Value == nil || len(*sfsplr.Value) == 0 14777} 14778 14779// hasNextLink returns true if the NextLink is not empty. 14780func (sfsplr SyncFullSchemaPropertiesListResult) hasNextLink() bool { 14781 return sfsplr.NextLink != nil && len(*sfsplr.NextLink) != 0 14782} 14783 14784// syncFullSchemaPropertiesListResultPreparer prepares a request to retrieve the next set of results. 14785// It returns nil if no more results exist. 14786func (sfsplr SyncFullSchemaPropertiesListResult) syncFullSchemaPropertiesListResultPreparer(ctx context.Context) (*http.Request, error) { 14787 if !sfsplr.hasNextLink() { 14788 return nil, nil 14789 } 14790 return autorest.Prepare((&http.Request{}).WithContext(ctx), 14791 autorest.AsJSON(), 14792 autorest.AsGet(), 14793 autorest.WithBaseURL(to.String(sfsplr.NextLink))) 14794} 14795 14796// SyncFullSchemaPropertiesListResultPage contains a page of SyncFullSchemaProperties values. 14797type SyncFullSchemaPropertiesListResultPage struct { 14798 fn func(context.Context, SyncFullSchemaPropertiesListResult) (SyncFullSchemaPropertiesListResult, error) 14799 sfsplr SyncFullSchemaPropertiesListResult 14800} 14801 14802// NextWithContext advances to the next page of values. If there was an error making 14803// the request the page does not advance and the error is returned. 14804func (page *SyncFullSchemaPropertiesListResultPage) NextWithContext(ctx context.Context) (err error) { 14805 if tracing.IsEnabled() { 14806 ctx = tracing.StartSpan(ctx, fqdn+"/SyncFullSchemaPropertiesListResultPage.NextWithContext") 14807 defer func() { 14808 sc := -1 14809 if page.Response().Response.Response != nil { 14810 sc = page.Response().Response.Response.StatusCode 14811 } 14812 tracing.EndSpan(ctx, sc, err) 14813 }() 14814 } 14815 for { 14816 next, err := page.fn(ctx, page.sfsplr) 14817 if err != nil { 14818 return err 14819 } 14820 page.sfsplr = next 14821 if !next.hasNextLink() || !next.IsEmpty() { 14822 break 14823 } 14824 } 14825 return nil 14826} 14827 14828// Next advances to the next page of values. If there was an error making 14829// the request the page does not advance and the error is returned. 14830// Deprecated: Use NextWithContext() instead. 14831func (page *SyncFullSchemaPropertiesListResultPage) Next() error { 14832 return page.NextWithContext(context.Background()) 14833} 14834 14835// NotDone returns true if the page enumeration should be started or is not yet complete. 14836func (page SyncFullSchemaPropertiesListResultPage) NotDone() bool { 14837 return !page.sfsplr.IsEmpty() 14838} 14839 14840// Response returns the raw server response from the last page request. 14841func (page SyncFullSchemaPropertiesListResultPage) Response() SyncFullSchemaPropertiesListResult { 14842 return page.sfsplr 14843} 14844 14845// Values returns the slice of values for the current page or nil if there are no values. 14846func (page SyncFullSchemaPropertiesListResultPage) Values() []SyncFullSchemaProperties { 14847 if page.sfsplr.IsEmpty() { 14848 return nil 14849 } 14850 return *page.sfsplr.Value 14851} 14852 14853// Creates a new instance of the SyncFullSchemaPropertiesListResultPage type. 14854func NewSyncFullSchemaPropertiesListResultPage(cur SyncFullSchemaPropertiesListResult, getNextPage func(context.Context, SyncFullSchemaPropertiesListResult) (SyncFullSchemaPropertiesListResult, error)) SyncFullSchemaPropertiesListResultPage { 14855 return SyncFullSchemaPropertiesListResultPage{ 14856 fn: getNextPage, 14857 sfsplr: cur, 14858 } 14859} 14860 14861// SyncFullSchemaTable properties of the table in the database full schema. 14862type SyncFullSchemaTable struct { 14863 // Columns - READ-ONLY; List of columns in the table of database full schema. 14864 Columns *[]SyncFullSchemaTableColumn `json:"columns,omitempty"` 14865 // ErrorID - READ-ONLY; Error id of the table. 14866 ErrorID *string `json:"errorId,omitempty"` 14867 // HasError - READ-ONLY; If there is error in the table. 14868 HasError *bool `json:"hasError,omitempty"` 14869 // Name - READ-ONLY; Name of the table. 14870 Name *string `json:"name,omitempty"` 14871 // QuotedName - READ-ONLY; Quoted name of the table. 14872 QuotedName *string `json:"quotedName,omitempty"` 14873} 14874 14875// MarshalJSON is the custom marshaler for SyncFullSchemaTable. 14876func (sfst SyncFullSchemaTable) MarshalJSON() ([]byte, error) { 14877 objectMap := make(map[string]interface{}) 14878 return json.Marshal(objectMap) 14879} 14880 14881// SyncFullSchemaTableColumn properties of the column in the table of database full schema. 14882type SyncFullSchemaTableColumn struct { 14883 // DataSize - READ-ONLY; Data size of the column. 14884 DataSize *string `json:"dataSize,omitempty"` 14885 // DataType - READ-ONLY; Data type of the column. 14886 DataType *string `json:"dataType,omitempty"` 14887 // ErrorID - READ-ONLY; Error id of the column. 14888 ErrorID *string `json:"errorId,omitempty"` 14889 // HasError - READ-ONLY; If there is error in the table. 14890 HasError *bool `json:"hasError,omitempty"` 14891 // IsPrimaryKey - READ-ONLY; If it is the primary key of the table. 14892 IsPrimaryKey *bool `json:"isPrimaryKey,omitempty"` 14893 // Name - READ-ONLY; Name of the column. 14894 Name *string `json:"name,omitempty"` 14895 // QuotedName - READ-ONLY; Quoted name of the column. 14896 QuotedName *string `json:"quotedName,omitempty"` 14897} 14898 14899// MarshalJSON is the custom marshaler for SyncFullSchemaTableColumn. 14900func (sfstc SyncFullSchemaTableColumn) MarshalJSON() ([]byte, error) { 14901 objectMap := make(map[string]interface{}) 14902 return json.Marshal(objectMap) 14903} 14904 14905// SyncGroup an Azure SQL Database sync group. 14906type SyncGroup struct { 14907 autorest.Response `json:"-"` 14908 // SyncGroupProperties - Resource properties. 14909 *SyncGroupProperties `json:"properties,omitempty"` 14910 // ID - READ-ONLY; Resource ID. 14911 ID *string `json:"id,omitempty"` 14912 // Name - READ-ONLY; Resource name. 14913 Name *string `json:"name,omitempty"` 14914 // Type - READ-ONLY; Resource type. 14915 Type *string `json:"type,omitempty"` 14916} 14917 14918// MarshalJSON is the custom marshaler for SyncGroup. 14919func (sg SyncGroup) MarshalJSON() ([]byte, error) { 14920 objectMap := make(map[string]interface{}) 14921 if sg.SyncGroupProperties != nil { 14922 objectMap["properties"] = sg.SyncGroupProperties 14923 } 14924 return json.Marshal(objectMap) 14925} 14926 14927// UnmarshalJSON is the custom unmarshaler for SyncGroup struct. 14928func (sg *SyncGroup) UnmarshalJSON(body []byte) error { 14929 var m map[string]*json.RawMessage 14930 err := json.Unmarshal(body, &m) 14931 if err != nil { 14932 return err 14933 } 14934 for k, v := range m { 14935 switch k { 14936 case "properties": 14937 if v != nil { 14938 var syncGroupProperties SyncGroupProperties 14939 err = json.Unmarshal(*v, &syncGroupProperties) 14940 if err != nil { 14941 return err 14942 } 14943 sg.SyncGroupProperties = &syncGroupProperties 14944 } 14945 case "id": 14946 if v != nil { 14947 var ID string 14948 err = json.Unmarshal(*v, &ID) 14949 if err != nil { 14950 return err 14951 } 14952 sg.ID = &ID 14953 } 14954 case "name": 14955 if v != nil { 14956 var name string 14957 err = json.Unmarshal(*v, &name) 14958 if err != nil { 14959 return err 14960 } 14961 sg.Name = &name 14962 } 14963 case "type": 14964 if v != nil { 14965 var typeVar string 14966 err = json.Unmarshal(*v, &typeVar) 14967 if err != nil { 14968 return err 14969 } 14970 sg.Type = &typeVar 14971 } 14972 } 14973 } 14974 14975 return nil 14976} 14977 14978// SyncGroupListResult a list of sync groups. 14979type SyncGroupListResult struct { 14980 autorest.Response `json:"-"` 14981 // Value - READ-ONLY; Array of results. 14982 Value *[]SyncGroup `json:"value,omitempty"` 14983 // NextLink - READ-ONLY; Link to retrieve next page of results. 14984 NextLink *string `json:"nextLink,omitempty"` 14985} 14986 14987// MarshalJSON is the custom marshaler for SyncGroupListResult. 14988func (sglr SyncGroupListResult) MarshalJSON() ([]byte, error) { 14989 objectMap := make(map[string]interface{}) 14990 return json.Marshal(objectMap) 14991} 14992 14993// SyncGroupListResultIterator provides access to a complete listing of SyncGroup values. 14994type SyncGroupListResultIterator struct { 14995 i int 14996 page SyncGroupListResultPage 14997} 14998 14999// NextWithContext advances to the next value. If there was an error making 15000// the request the iterator does not advance and the error is returned. 15001func (iter *SyncGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { 15002 if tracing.IsEnabled() { 15003 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupListResultIterator.NextWithContext") 15004 defer func() { 15005 sc := -1 15006 if iter.Response().Response.Response != nil { 15007 sc = iter.Response().Response.Response.StatusCode 15008 } 15009 tracing.EndSpan(ctx, sc, err) 15010 }() 15011 } 15012 iter.i++ 15013 if iter.i < len(iter.page.Values()) { 15014 return nil 15015 } 15016 err = iter.page.NextWithContext(ctx) 15017 if err != nil { 15018 iter.i-- 15019 return err 15020 } 15021 iter.i = 0 15022 return nil 15023} 15024 15025// Next advances to the next value. If there was an error making 15026// the request the iterator does not advance and the error is returned. 15027// Deprecated: Use NextWithContext() instead. 15028func (iter *SyncGroupListResultIterator) Next() error { 15029 return iter.NextWithContext(context.Background()) 15030} 15031 15032// NotDone returns true if the enumeration should be started or is not yet complete. 15033func (iter SyncGroupListResultIterator) NotDone() bool { 15034 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 15035} 15036 15037// Response returns the raw server response from the last page request. 15038func (iter SyncGroupListResultIterator) Response() SyncGroupListResult { 15039 return iter.page.Response() 15040} 15041 15042// Value returns the current value or a zero-initialized value if the 15043// iterator has advanced beyond the end of the collection. 15044func (iter SyncGroupListResultIterator) Value() SyncGroup { 15045 if !iter.page.NotDone() { 15046 return SyncGroup{} 15047 } 15048 return iter.page.Values()[iter.i] 15049} 15050 15051// Creates a new instance of the SyncGroupListResultIterator type. 15052func NewSyncGroupListResultIterator(page SyncGroupListResultPage) SyncGroupListResultIterator { 15053 return SyncGroupListResultIterator{page: page} 15054} 15055 15056// IsEmpty returns true if the ListResult contains no values. 15057func (sglr SyncGroupListResult) IsEmpty() bool { 15058 return sglr.Value == nil || len(*sglr.Value) == 0 15059} 15060 15061// hasNextLink returns true if the NextLink is not empty. 15062func (sglr SyncGroupListResult) hasNextLink() bool { 15063 return sglr.NextLink != nil && len(*sglr.NextLink) != 0 15064} 15065 15066// syncGroupListResultPreparer prepares a request to retrieve the next set of results. 15067// It returns nil if no more results exist. 15068func (sglr SyncGroupListResult) syncGroupListResultPreparer(ctx context.Context) (*http.Request, error) { 15069 if !sglr.hasNextLink() { 15070 return nil, nil 15071 } 15072 return autorest.Prepare((&http.Request{}).WithContext(ctx), 15073 autorest.AsJSON(), 15074 autorest.AsGet(), 15075 autorest.WithBaseURL(to.String(sglr.NextLink))) 15076} 15077 15078// SyncGroupListResultPage contains a page of SyncGroup values. 15079type SyncGroupListResultPage struct { 15080 fn func(context.Context, SyncGroupListResult) (SyncGroupListResult, error) 15081 sglr SyncGroupListResult 15082} 15083 15084// NextWithContext advances to the next page of values. If there was an error making 15085// the request the page does not advance and the error is returned. 15086func (page *SyncGroupListResultPage) NextWithContext(ctx context.Context) (err error) { 15087 if tracing.IsEnabled() { 15088 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupListResultPage.NextWithContext") 15089 defer func() { 15090 sc := -1 15091 if page.Response().Response.Response != nil { 15092 sc = page.Response().Response.Response.StatusCode 15093 } 15094 tracing.EndSpan(ctx, sc, err) 15095 }() 15096 } 15097 for { 15098 next, err := page.fn(ctx, page.sglr) 15099 if err != nil { 15100 return err 15101 } 15102 page.sglr = next 15103 if !next.hasNextLink() || !next.IsEmpty() { 15104 break 15105 } 15106 } 15107 return nil 15108} 15109 15110// Next advances to the next page of values. If there was an error making 15111// the request the page does not advance and the error is returned. 15112// Deprecated: Use NextWithContext() instead. 15113func (page *SyncGroupListResultPage) Next() error { 15114 return page.NextWithContext(context.Background()) 15115} 15116 15117// NotDone returns true if the page enumeration should be started or is not yet complete. 15118func (page SyncGroupListResultPage) NotDone() bool { 15119 return !page.sglr.IsEmpty() 15120} 15121 15122// Response returns the raw server response from the last page request. 15123func (page SyncGroupListResultPage) Response() SyncGroupListResult { 15124 return page.sglr 15125} 15126 15127// Values returns the slice of values for the current page or nil if there are no values. 15128func (page SyncGroupListResultPage) Values() []SyncGroup { 15129 if page.sglr.IsEmpty() { 15130 return nil 15131 } 15132 return *page.sglr.Value 15133} 15134 15135// Creates a new instance of the SyncGroupListResultPage type. 15136func NewSyncGroupListResultPage(cur SyncGroupListResult, getNextPage func(context.Context, SyncGroupListResult) (SyncGroupListResult, error)) SyncGroupListResultPage { 15137 return SyncGroupListResultPage{ 15138 fn: getNextPage, 15139 sglr: cur, 15140 } 15141} 15142 15143// SyncGroupLogListResult a list of sync group log properties. 15144type SyncGroupLogListResult struct { 15145 autorest.Response `json:"-"` 15146 // Value - READ-ONLY; Array of results. 15147 Value *[]SyncGroupLogProperties `json:"value,omitempty"` 15148 // NextLink - READ-ONLY; Link to retrieve next page of results. 15149 NextLink *string `json:"nextLink,omitempty"` 15150} 15151 15152// MarshalJSON is the custom marshaler for SyncGroupLogListResult. 15153func (sgllr SyncGroupLogListResult) MarshalJSON() ([]byte, error) { 15154 objectMap := make(map[string]interface{}) 15155 return json.Marshal(objectMap) 15156} 15157 15158// SyncGroupLogListResultIterator provides access to a complete listing of SyncGroupLogProperties values. 15159type SyncGroupLogListResultIterator struct { 15160 i int 15161 page SyncGroupLogListResultPage 15162} 15163 15164// NextWithContext advances to the next value. If there was an error making 15165// the request the iterator does not advance and the error is returned. 15166func (iter *SyncGroupLogListResultIterator) NextWithContext(ctx context.Context) (err error) { 15167 if tracing.IsEnabled() { 15168 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupLogListResultIterator.NextWithContext") 15169 defer func() { 15170 sc := -1 15171 if iter.Response().Response.Response != nil { 15172 sc = iter.Response().Response.Response.StatusCode 15173 } 15174 tracing.EndSpan(ctx, sc, err) 15175 }() 15176 } 15177 iter.i++ 15178 if iter.i < len(iter.page.Values()) { 15179 return nil 15180 } 15181 err = iter.page.NextWithContext(ctx) 15182 if err != nil { 15183 iter.i-- 15184 return err 15185 } 15186 iter.i = 0 15187 return nil 15188} 15189 15190// Next advances to the next value. If there was an error making 15191// the request the iterator does not advance and the error is returned. 15192// Deprecated: Use NextWithContext() instead. 15193func (iter *SyncGroupLogListResultIterator) Next() error { 15194 return iter.NextWithContext(context.Background()) 15195} 15196 15197// NotDone returns true if the enumeration should be started or is not yet complete. 15198func (iter SyncGroupLogListResultIterator) NotDone() bool { 15199 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 15200} 15201 15202// Response returns the raw server response from the last page request. 15203func (iter SyncGroupLogListResultIterator) Response() SyncGroupLogListResult { 15204 return iter.page.Response() 15205} 15206 15207// Value returns the current value or a zero-initialized value if the 15208// iterator has advanced beyond the end of the collection. 15209func (iter SyncGroupLogListResultIterator) Value() SyncGroupLogProperties { 15210 if !iter.page.NotDone() { 15211 return SyncGroupLogProperties{} 15212 } 15213 return iter.page.Values()[iter.i] 15214} 15215 15216// Creates a new instance of the SyncGroupLogListResultIterator type. 15217func NewSyncGroupLogListResultIterator(page SyncGroupLogListResultPage) SyncGroupLogListResultIterator { 15218 return SyncGroupLogListResultIterator{page: page} 15219} 15220 15221// IsEmpty returns true if the ListResult contains no values. 15222func (sgllr SyncGroupLogListResult) IsEmpty() bool { 15223 return sgllr.Value == nil || len(*sgllr.Value) == 0 15224} 15225 15226// hasNextLink returns true if the NextLink is not empty. 15227func (sgllr SyncGroupLogListResult) hasNextLink() bool { 15228 return sgllr.NextLink != nil && len(*sgllr.NextLink) != 0 15229} 15230 15231// syncGroupLogListResultPreparer prepares a request to retrieve the next set of results. 15232// It returns nil if no more results exist. 15233func (sgllr SyncGroupLogListResult) syncGroupLogListResultPreparer(ctx context.Context) (*http.Request, error) { 15234 if !sgllr.hasNextLink() { 15235 return nil, nil 15236 } 15237 return autorest.Prepare((&http.Request{}).WithContext(ctx), 15238 autorest.AsJSON(), 15239 autorest.AsGet(), 15240 autorest.WithBaseURL(to.String(sgllr.NextLink))) 15241} 15242 15243// SyncGroupLogListResultPage contains a page of SyncGroupLogProperties values. 15244type SyncGroupLogListResultPage struct { 15245 fn func(context.Context, SyncGroupLogListResult) (SyncGroupLogListResult, error) 15246 sgllr SyncGroupLogListResult 15247} 15248 15249// NextWithContext advances to the next page of values. If there was an error making 15250// the request the page does not advance and the error is returned. 15251func (page *SyncGroupLogListResultPage) NextWithContext(ctx context.Context) (err error) { 15252 if tracing.IsEnabled() { 15253 ctx = tracing.StartSpan(ctx, fqdn+"/SyncGroupLogListResultPage.NextWithContext") 15254 defer func() { 15255 sc := -1 15256 if page.Response().Response.Response != nil { 15257 sc = page.Response().Response.Response.StatusCode 15258 } 15259 tracing.EndSpan(ctx, sc, err) 15260 }() 15261 } 15262 for { 15263 next, err := page.fn(ctx, page.sgllr) 15264 if err != nil { 15265 return err 15266 } 15267 page.sgllr = next 15268 if !next.hasNextLink() || !next.IsEmpty() { 15269 break 15270 } 15271 } 15272 return nil 15273} 15274 15275// Next advances to the next page of values. If there was an error making 15276// the request the page does not advance and the error is returned. 15277// Deprecated: Use NextWithContext() instead. 15278func (page *SyncGroupLogListResultPage) Next() error { 15279 return page.NextWithContext(context.Background()) 15280} 15281 15282// NotDone returns true if the page enumeration should be started or is not yet complete. 15283func (page SyncGroupLogListResultPage) NotDone() bool { 15284 return !page.sgllr.IsEmpty() 15285} 15286 15287// Response returns the raw server response from the last page request. 15288func (page SyncGroupLogListResultPage) Response() SyncGroupLogListResult { 15289 return page.sgllr 15290} 15291 15292// Values returns the slice of values for the current page or nil if there are no values. 15293func (page SyncGroupLogListResultPage) Values() []SyncGroupLogProperties { 15294 if page.sgllr.IsEmpty() { 15295 return nil 15296 } 15297 return *page.sgllr.Value 15298} 15299 15300// Creates a new instance of the SyncGroupLogListResultPage type. 15301func NewSyncGroupLogListResultPage(cur SyncGroupLogListResult, getNextPage func(context.Context, SyncGroupLogListResult) (SyncGroupLogListResult, error)) SyncGroupLogListResultPage { 15302 return SyncGroupLogListResultPage{ 15303 fn: getNextPage, 15304 sgllr: cur, 15305 } 15306} 15307 15308// SyncGroupLogProperties properties of an Azure SQL Database sync group log. 15309type SyncGroupLogProperties struct { 15310 // Timestamp - READ-ONLY; Timestamp of the sync group log. 15311 Timestamp *date.Time `json:"timestamp,omitempty"` 15312 // Type - READ-ONLY; Type of the sync group log. Possible values include: 'SyncGroupLogTypeAll', 'SyncGroupLogTypeError', 'SyncGroupLogTypeWarning', 'SyncGroupLogTypeSuccess' 15313 Type SyncGroupLogType `json:"type,omitempty"` 15314 // Source - READ-ONLY; Source of the sync group log. 15315 Source *string `json:"source,omitempty"` 15316 // Details - READ-ONLY; Details of the sync group log. 15317 Details *string `json:"details,omitempty"` 15318 // TracingID - READ-ONLY; TracingId of the sync group log. 15319 TracingID *uuid.UUID `json:"tracingId,omitempty"` 15320 // OperationStatus - READ-ONLY; OperationStatus of the sync group log. 15321 OperationStatus *string `json:"operationStatus,omitempty"` 15322} 15323 15324// MarshalJSON is the custom marshaler for SyncGroupLogProperties. 15325func (sglp SyncGroupLogProperties) MarshalJSON() ([]byte, error) { 15326 objectMap := make(map[string]interface{}) 15327 return json.Marshal(objectMap) 15328} 15329 15330// SyncGroupProperties properties of a sync group. 15331type SyncGroupProperties struct { 15332 // Interval - Sync interval of the sync group. 15333 Interval *int32 `json:"interval,omitempty"` 15334 // LastSyncTime - READ-ONLY; Last sync time of the sync group. 15335 LastSyncTime *date.Time `json:"lastSyncTime,omitempty"` 15336 // ConflictResolutionPolicy - Conflict resolution policy of the sync group. Possible values include: 'HubWin', 'MemberWin' 15337 ConflictResolutionPolicy SyncConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` 15338 // SyncDatabaseID - ARM resource id of the sync database in the sync group. 15339 SyncDatabaseID *string `json:"syncDatabaseId,omitempty"` 15340 // HubDatabaseUserName - User name for the sync group hub database credential. 15341 HubDatabaseUserName *string `json:"hubDatabaseUserName,omitempty"` 15342 // HubDatabasePassword - Password for the sync group hub database credential. 15343 HubDatabasePassword *string `json:"hubDatabasePassword,omitempty"` 15344 // SyncState - READ-ONLY; Sync state of the sync group. Possible values include: 'NotReady', 'Error', 'Warning', 'Progressing', 'Good' 15345 SyncState SyncGroupState `json:"syncState,omitempty"` 15346 // Schema - Sync schema of the sync group. 15347 Schema *SyncGroupSchema `json:"schema,omitempty"` 15348} 15349 15350// MarshalJSON is the custom marshaler for SyncGroupProperties. 15351func (sgp SyncGroupProperties) MarshalJSON() ([]byte, error) { 15352 objectMap := make(map[string]interface{}) 15353 if sgp.Interval != nil { 15354 objectMap["interval"] = sgp.Interval 15355 } 15356 if sgp.ConflictResolutionPolicy != "" { 15357 objectMap["conflictResolutionPolicy"] = sgp.ConflictResolutionPolicy 15358 } 15359 if sgp.SyncDatabaseID != nil { 15360 objectMap["syncDatabaseId"] = sgp.SyncDatabaseID 15361 } 15362 if sgp.HubDatabaseUserName != nil { 15363 objectMap["hubDatabaseUserName"] = sgp.HubDatabaseUserName 15364 } 15365 if sgp.HubDatabasePassword != nil { 15366 objectMap["hubDatabasePassword"] = sgp.HubDatabasePassword 15367 } 15368 if sgp.Schema != nil { 15369 objectMap["schema"] = sgp.Schema 15370 } 15371 return json.Marshal(objectMap) 15372} 15373 15374// SyncGroupSchema properties of sync group schema. 15375type SyncGroupSchema struct { 15376 // Tables - List of tables in sync group schema. 15377 Tables *[]SyncGroupSchemaTable `json:"tables,omitempty"` 15378 // MasterSyncMemberName - Name of master sync member where the schema is from. 15379 MasterSyncMemberName *string `json:"masterSyncMemberName,omitempty"` 15380} 15381 15382// SyncGroupSchemaTable properties of table in sync group schema. 15383type SyncGroupSchemaTable struct { 15384 // Columns - List of columns in sync group schema. 15385 Columns *[]SyncGroupSchemaTableColumn `json:"columns,omitempty"` 15386 // QuotedName - Quoted name of sync group schema table. 15387 QuotedName *string `json:"quotedName,omitempty"` 15388} 15389 15390// SyncGroupSchemaTableColumn properties of column in sync group table. 15391type SyncGroupSchemaTableColumn struct { 15392 // QuotedName - Quoted name of sync group table column. 15393 QuotedName *string `json:"quotedName,omitempty"` 15394 // DataSize - Data size of the column. 15395 DataSize *string `json:"dataSize,omitempty"` 15396 // DataType - Data type of the column. 15397 DataType *string `json:"dataType,omitempty"` 15398} 15399 15400// SyncGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 15401// long-running operation. 15402type SyncGroupsCreateOrUpdateFuture struct { 15403 azure.FutureAPI 15404 // Result returns the result of the asynchronous operation. 15405 // If the operation has not completed it will return an error. 15406 Result func(SyncGroupsClient) (SyncGroup, error) 15407} 15408 15409// UnmarshalJSON is the custom unmarshaller for CreateFuture. 15410func (future *SyncGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 15411 var azFuture azure.Future 15412 if err := json.Unmarshal(body, &azFuture); err != nil { 15413 return err 15414 } 15415 future.FutureAPI = &azFuture 15416 future.Result = future.result 15417 return nil 15418} 15419 15420// result is the default implementation for SyncGroupsCreateOrUpdateFuture.Result. 15421func (future *SyncGroupsCreateOrUpdateFuture) result(client SyncGroupsClient) (sg SyncGroup, err error) { 15422 var done bool 15423 done, err = future.DoneWithContext(context.Background(), client) 15424 if err != nil { 15425 err = autorest.NewErrorWithError(err, "sql.SyncGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 15426 return 15427 } 15428 if !done { 15429 sg.Response.Response = future.Response() 15430 err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsCreateOrUpdateFuture") 15431 return 15432 } 15433 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 15434 if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { 15435 sg, err = client.CreateOrUpdateResponder(sg.Response.Response) 15436 if err != nil { 15437 err = autorest.NewErrorWithError(err, "sql.SyncGroupsCreateOrUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") 15438 } 15439 } 15440 return 15441} 15442 15443// SyncGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 15444// operation. 15445type SyncGroupsDeleteFuture struct { 15446 azure.FutureAPI 15447 // Result returns the result of the asynchronous operation. 15448 // If the operation has not completed it will return an error. 15449 Result func(SyncGroupsClient) (autorest.Response, error) 15450} 15451 15452// UnmarshalJSON is the custom unmarshaller for CreateFuture. 15453func (future *SyncGroupsDeleteFuture) UnmarshalJSON(body []byte) error { 15454 var azFuture azure.Future 15455 if err := json.Unmarshal(body, &azFuture); err != nil { 15456 return err 15457 } 15458 future.FutureAPI = &azFuture 15459 future.Result = future.result 15460 return nil 15461} 15462 15463// result is the default implementation for SyncGroupsDeleteFuture.Result. 15464func (future *SyncGroupsDeleteFuture) result(client SyncGroupsClient) (ar autorest.Response, err error) { 15465 var done bool 15466 done, err = future.DoneWithContext(context.Background(), client) 15467 if err != nil { 15468 err = autorest.NewErrorWithError(err, "sql.SyncGroupsDeleteFuture", "Result", future.Response(), "Polling failure") 15469 return 15470 } 15471 if !done { 15472 ar.Response = future.Response() 15473 err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsDeleteFuture") 15474 return 15475 } 15476 ar.Response = future.Response() 15477 return 15478} 15479 15480// SyncGroupsRefreshHubSchemaFuture an abstraction for monitoring and retrieving the results of a 15481// long-running operation. 15482type SyncGroupsRefreshHubSchemaFuture struct { 15483 azure.FutureAPI 15484 // Result returns the result of the asynchronous operation. 15485 // If the operation has not completed it will return an error. 15486 Result func(SyncGroupsClient) (autorest.Response, error) 15487} 15488 15489// UnmarshalJSON is the custom unmarshaller for CreateFuture. 15490func (future *SyncGroupsRefreshHubSchemaFuture) UnmarshalJSON(body []byte) error { 15491 var azFuture azure.Future 15492 if err := json.Unmarshal(body, &azFuture); err != nil { 15493 return err 15494 } 15495 future.FutureAPI = &azFuture 15496 future.Result = future.result 15497 return nil 15498} 15499 15500// result is the default implementation for SyncGroupsRefreshHubSchemaFuture.Result. 15501func (future *SyncGroupsRefreshHubSchemaFuture) result(client SyncGroupsClient) (ar autorest.Response, err error) { 15502 var done bool 15503 done, err = future.DoneWithContext(context.Background(), client) 15504 if err != nil { 15505 err = autorest.NewErrorWithError(err, "sql.SyncGroupsRefreshHubSchemaFuture", "Result", future.Response(), "Polling failure") 15506 return 15507 } 15508 if !done { 15509 ar.Response = future.Response() 15510 err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsRefreshHubSchemaFuture") 15511 return 15512 } 15513 ar.Response = future.Response() 15514 return 15515} 15516 15517// SyncGroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 15518// operation. 15519type SyncGroupsUpdateFuture struct { 15520 azure.FutureAPI 15521 // Result returns the result of the asynchronous operation. 15522 // If the operation has not completed it will return an error. 15523 Result func(SyncGroupsClient) (SyncGroup, error) 15524} 15525 15526// UnmarshalJSON is the custom unmarshaller for CreateFuture. 15527func (future *SyncGroupsUpdateFuture) UnmarshalJSON(body []byte) error { 15528 var azFuture azure.Future 15529 if err := json.Unmarshal(body, &azFuture); err != nil { 15530 return err 15531 } 15532 future.FutureAPI = &azFuture 15533 future.Result = future.result 15534 return nil 15535} 15536 15537// result is the default implementation for SyncGroupsUpdateFuture.Result. 15538func (future *SyncGroupsUpdateFuture) result(client SyncGroupsClient) (sg SyncGroup, err error) { 15539 var done bool 15540 done, err = future.DoneWithContext(context.Background(), client) 15541 if err != nil { 15542 err = autorest.NewErrorWithError(err, "sql.SyncGroupsUpdateFuture", "Result", future.Response(), "Polling failure") 15543 return 15544 } 15545 if !done { 15546 sg.Response.Response = future.Response() 15547 err = azure.NewAsyncOpIncompleteError("sql.SyncGroupsUpdateFuture") 15548 return 15549 } 15550 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 15551 if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { 15552 sg, err = client.UpdateResponder(sg.Response.Response) 15553 if err != nil { 15554 err = autorest.NewErrorWithError(err, "sql.SyncGroupsUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") 15555 } 15556 } 15557 return 15558} 15559 15560// SyncMember an Azure SQL Database sync member. 15561type SyncMember struct { 15562 autorest.Response `json:"-"` 15563 // SyncMemberProperties - Resource properties. 15564 *SyncMemberProperties `json:"properties,omitempty"` 15565 // ID - READ-ONLY; Resource ID. 15566 ID *string `json:"id,omitempty"` 15567 // Name - READ-ONLY; Resource name. 15568 Name *string `json:"name,omitempty"` 15569 // Type - READ-ONLY; Resource type. 15570 Type *string `json:"type,omitempty"` 15571} 15572 15573// MarshalJSON is the custom marshaler for SyncMember. 15574func (sm SyncMember) MarshalJSON() ([]byte, error) { 15575 objectMap := make(map[string]interface{}) 15576 if sm.SyncMemberProperties != nil { 15577 objectMap["properties"] = sm.SyncMemberProperties 15578 } 15579 return json.Marshal(objectMap) 15580} 15581 15582// UnmarshalJSON is the custom unmarshaler for SyncMember struct. 15583func (sm *SyncMember) UnmarshalJSON(body []byte) error { 15584 var m map[string]*json.RawMessage 15585 err := json.Unmarshal(body, &m) 15586 if err != nil { 15587 return err 15588 } 15589 for k, v := range m { 15590 switch k { 15591 case "properties": 15592 if v != nil { 15593 var syncMemberProperties SyncMemberProperties 15594 err = json.Unmarshal(*v, &syncMemberProperties) 15595 if err != nil { 15596 return err 15597 } 15598 sm.SyncMemberProperties = &syncMemberProperties 15599 } 15600 case "id": 15601 if v != nil { 15602 var ID string 15603 err = json.Unmarshal(*v, &ID) 15604 if err != nil { 15605 return err 15606 } 15607 sm.ID = &ID 15608 } 15609 case "name": 15610 if v != nil { 15611 var name string 15612 err = json.Unmarshal(*v, &name) 15613 if err != nil { 15614 return err 15615 } 15616 sm.Name = &name 15617 } 15618 case "type": 15619 if v != nil { 15620 var typeVar string 15621 err = json.Unmarshal(*v, &typeVar) 15622 if err != nil { 15623 return err 15624 } 15625 sm.Type = &typeVar 15626 } 15627 } 15628 } 15629 15630 return nil 15631} 15632 15633// SyncMemberListResult a list of Azure SQL Database sync members. 15634type SyncMemberListResult struct { 15635 autorest.Response `json:"-"` 15636 // Value - READ-ONLY; Array of results. 15637 Value *[]SyncMember `json:"value,omitempty"` 15638 // NextLink - READ-ONLY; Link to retrieve next page of results. 15639 NextLink *string `json:"nextLink,omitempty"` 15640} 15641 15642// MarshalJSON is the custom marshaler for SyncMemberListResult. 15643func (smlr SyncMemberListResult) MarshalJSON() ([]byte, error) { 15644 objectMap := make(map[string]interface{}) 15645 return json.Marshal(objectMap) 15646} 15647 15648// SyncMemberListResultIterator provides access to a complete listing of SyncMember values. 15649type SyncMemberListResultIterator struct { 15650 i int 15651 page SyncMemberListResultPage 15652} 15653 15654// NextWithContext advances to the next value. If there was an error making 15655// the request the iterator does not advance and the error is returned. 15656func (iter *SyncMemberListResultIterator) NextWithContext(ctx context.Context) (err error) { 15657 if tracing.IsEnabled() { 15658 ctx = tracing.StartSpan(ctx, fqdn+"/SyncMemberListResultIterator.NextWithContext") 15659 defer func() { 15660 sc := -1 15661 if iter.Response().Response.Response != nil { 15662 sc = iter.Response().Response.Response.StatusCode 15663 } 15664 tracing.EndSpan(ctx, sc, err) 15665 }() 15666 } 15667 iter.i++ 15668 if iter.i < len(iter.page.Values()) { 15669 return nil 15670 } 15671 err = iter.page.NextWithContext(ctx) 15672 if err != nil { 15673 iter.i-- 15674 return err 15675 } 15676 iter.i = 0 15677 return nil 15678} 15679 15680// Next advances to the next value. If there was an error making 15681// the request the iterator does not advance and the error is returned. 15682// Deprecated: Use NextWithContext() instead. 15683func (iter *SyncMemberListResultIterator) Next() error { 15684 return iter.NextWithContext(context.Background()) 15685} 15686 15687// NotDone returns true if the enumeration should be started or is not yet complete. 15688func (iter SyncMemberListResultIterator) NotDone() bool { 15689 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 15690} 15691 15692// Response returns the raw server response from the last page request. 15693func (iter SyncMemberListResultIterator) Response() SyncMemberListResult { 15694 return iter.page.Response() 15695} 15696 15697// Value returns the current value or a zero-initialized value if the 15698// iterator has advanced beyond the end of the collection. 15699func (iter SyncMemberListResultIterator) Value() SyncMember { 15700 if !iter.page.NotDone() { 15701 return SyncMember{} 15702 } 15703 return iter.page.Values()[iter.i] 15704} 15705 15706// Creates a new instance of the SyncMemberListResultIterator type. 15707func NewSyncMemberListResultIterator(page SyncMemberListResultPage) SyncMemberListResultIterator { 15708 return SyncMemberListResultIterator{page: page} 15709} 15710 15711// IsEmpty returns true if the ListResult contains no values. 15712func (smlr SyncMemberListResult) IsEmpty() bool { 15713 return smlr.Value == nil || len(*smlr.Value) == 0 15714} 15715 15716// hasNextLink returns true if the NextLink is not empty. 15717func (smlr SyncMemberListResult) hasNextLink() bool { 15718 return smlr.NextLink != nil && len(*smlr.NextLink) != 0 15719} 15720 15721// syncMemberListResultPreparer prepares a request to retrieve the next set of results. 15722// It returns nil if no more results exist. 15723func (smlr SyncMemberListResult) syncMemberListResultPreparer(ctx context.Context) (*http.Request, error) { 15724 if !smlr.hasNextLink() { 15725 return nil, nil 15726 } 15727 return autorest.Prepare((&http.Request{}).WithContext(ctx), 15728 autorest.AsJSON(), 15729 autorest.AsGet(), 15730 autorest.WithBaseURL(to.String(smlr.NextLink))) 15731} 15732 15733// SyncMemberListResultPage contains a page of SyncMember values. 15734type SyncMemberListResultPage struct { 15735 fn func(context.Context, SyncMemberListResult) (SyncMemberListResult, error) 15736 smlr SyncMemberListResult 15737} 15738 15739// NextWithContext advances to the next page of values. If there was an error making 15740// the request the page does not advance and the error is returned. 15741func (page *SyncMemberListResultPage) NextWithContext(ctx context.Context) (err error) { 15742 if tracing.IsEnabled() { 15743 ctx = tracing.StartSpan(ctx, fqdn+"/SyncMemberListResultPage.NextWithContext") 15744 defer func() { 15745 sc := -1 15746 if page.Response().Response.Response != nil { 15747 sc = page.Response().Response.Response.StatusCode 15748 } 15749 tracing.EndSpan(ctx, sc, err) 15750 }() 15751 } 15752 for { 15753 next, err := page.fn(ctx, page.smlr) 15754 if err != nil { 15755 return err 15756 } 15757 page.smlr = next 15758 if !next.hasNextLink() || !next.IsEmpty() { 15759 break 15760 } 15761 } 15762 return nil 15763} 15764 15765// Next advances to the next page of values. If there was an error making 15766// the request the page does not advance and the error is returned. 15767// Deprecated: Use NextWithContext() instead. 15768func (page *SyncMemberListResultPage) Next() error { 15769 return page.NextWithContext(context.Background()) 15770} 15771 15772// NotDone returns true if the page enumeration should be started or is not yet complete. 15773func (page SyncMemberListResultPage) NotDone() bool { 15774 return !page.smlr.IsEmpty() 15775} 15776 15777// Response returns the raw server response from the last page request. 15778func (page SyncMemberListResultPage) Response() SyncMemberListResult { 15779 return page.smlr 15780} 15781 15782// Values returns the slice of values for the current page or nil if there are no values. 15783func (page SyncMemberListResultPage) Values() []SyncMember { 15784 if page.smlr.IsEmpty() { 15785 return nil 15786 } 15787 return *page.smlr.Value 15788} 15789 15790// Creates a new instance of the SyncMemberListResultPage type. 15791func NewSyncMemberListResultPage(cur SyncMemberListResult, getNextPage func(context.Context, SyncMemberListResult) (SyncMemberListResult, error)) SyncMemberListResultPage { 15792 return SyncMemberListResultPage{ 15793 fn: getNextPage, 15794 smlr: cur, 15795 } 15796} 15797 15798// SyncMemberProperties properties of a sync member. 15799type SyncMemberProperties struct { 15800 // DatabaseType - Database type of the sync member. Possible values include: 'AzureSQLDatabase', 'SQLServerDatabase' 15801 DatabaseType SyncMemberDbType `json:"databaseType,omitempty"` 15802 // SyncAgentID - ARM resource id of the sync agent in the sync member. 15803 SyncAgentID *string `json:"syncAgentId,omitempty"` 15804 // SQLServerDatabaseID - SQL Server database id of the sync member. 15805 SQLServerDatabaseID *uuid.UUID `json:"sqlServerDatabaseId,omitempty"` 15806 // ServerName - Server name of the member database in the sync member 15807 ServerName *string `json:"serverName,omitempty"` 15808 // DatabaseName - Database name of the member database in the sync member. 15809 DatabaseName *string `json:"databaseName,omitempty"` 15810 // UserName - User name of the member database in the sync member. 15811 UserName *string `json:"userName,omitempty"` 15812 // Password - Password of the member database in the sync member. 15813 Password *string `json:"password,omitempty"` 15814 // SyncDirection - Sync direction of the sync member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember' 15815 SyncDirection SyncDirection `json:"syncDirection,omitempty"` 15816 // SyncState - READ-ONLY; Sync state of the sync member. Possible values include: 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', 'DisabledTombstoneCleanup', 'DisabledBackupRestore', 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned' 15817 SyncState SyncMemberState `json:"syncState,omitempty"` 15818} 15819 15820// MarshalJSON is the custom marshaler for SyncMemberProperties. 15821func (smp SyncMemberProperties) MarshalJSON() ([]byte, error) { 15822 objectMap := make(map[string]interface{}) 15823 if smp.DatabaseType != "" { 15824 objectMap["databaseType"] = smp.DatabaseType 15825 } 15826 if smp.SyncAgentID != nil { 15827 objectMap["syncAgentId"] = smp.SyncAgentID 15828 } 15829 if smp.SQLServerDatabaseID != nil { 15830 objectMap["sqlServerDatabaseId"] = smp.SQLServerDatabaseID 15831 } 15832 if smp.ServerName != nil { 15833 objectMap["serverName"] = smp.ServerName 15834 } 15835 if smp.DatabaseName != nil { 15836 objectMap["databaseName"] = smp.DatabaseName 15837 } 15838 if smp.UserName != nil { 15839 objectMap["userName"] = smp.UserName 15840 } 15841 if smp.Password != nil { 15842 objectMap["password"] = smp.Password 15843 } 15844 if smp.SyncDirection != "" { 15845 objectMap["syncDirection"] = smp.SyncDirection 15846 } 15847 return json.Marshal(objectMap) 15848} 15849 15850// SyncMembersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 15851// long-running operation. 15852type SyncMembersCreateOrUpdateFuture struct { 15853 azure.FutureAPI 15854 // Result returns the result of the asynchronous operation. 15855 // If the operation has not completed it will return an error. 15856 Result func(SyncMembersClient) (SyncMember, error) 15857} 15858 15859// UnmarshalJSON is the custom unmarshaller for CreateFuture. 15860func (future *SyncMembersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 15861 var azFuture azure.Future 15862 if err := json.Unmarshal(body, &azFuture); err != nil { 15863 return err 15864 } 15865 future.FutureAPI = &azFuture 15866 future.Result = future.result 15867 return nil 15868} 15869 15870// result is the default implementation for SyncMembersCreateOrUpdateFuture.Result. 15871func (future *SyncMembersCreateOrUpdateFuture) result(client SyncMembersClient) (sm SyncMember, err error) { 15872 var done bool 15873 done, err = future.DoneWithContext(context.Background(), client) 15874 if err != nil { 15875 err = autorest.NewErrorWithError(err, "sql.SyncMembersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 15876 return 15877 } 15878 if !done { 15879 sm.Response.Response = future.Response() 15880 err = azure.NewAsyncOpIncompleteError("sql.SyncMembersCreateOrUpdateFuture") 15881 return 15882 } 15883 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 15884 if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { 15885 sm, err = client.CreateOrUpdateResponder(sm.Response.Response) 15886 if err != nil { 15887 err = autorest.NewErrorWithError(err, "sql.SyncMembersCreateOrUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") 15888 } 15889 } 15890 return 15891} 15892 15893// SyncMembersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 15894// operation. 15895type SyncMembersDeleteFuture struct { 15896 azure.FutureAPI 15897 // Result returns the result of the asynchronous operation. 15898 // If the operation has not completed it will return an error. 15899 Result func(SyncMembersClient) (autorest.Response, error) 15900} 15901 15902// UnmarshalJSON is the custom unmarshaller for CreateFuture. 15903func (future *SyncMembersDeleteFuture) UnmarshalJSON(body []byte) error { 15904 var azFuture azure.Future 15905 if err := json.Unmarshal(body, &azFuture); err != nil { 15906 return err 15907 } 15908 future.FutureAPI = &azFuture 15909 future.Result = future.result 15910 return nil 15911} 15912 15913// result is the default implementation for SyncMembersDeleteFuture.Result. 15914func (future *SyncMembersDeleteFuture) result(client SyncMembersClient) (ar autorest.Response, err error) { 15915 var done bool 15916 done, err = future.DoneWithContext(context.Background(), client) 15917 if err != nil { 15918 err = autorest.NewErrorWithError(err, "sql.SyncMembersDeleteFuture", "Result", future.Response(), "Polling failure") 15919 return 15920 } 15921 if !done { 15922 ar.Response = future.Response() 15923 err = azure.NewAsyncOpIncompleteError("sql.SyncMembersDeleteFuture") 15924 return 15925 } 15926 ar.Response = future.Response() 15927 return 15928} 15929 15930// SyncMembersRefreshMemberSchemaFuture an abstraction for monitoring and retrieving the results of a 15931// long-running operation. 15932type SyncMembersRefreshMemberSchemaFuture struct { 15933 azure.FutureAPI 15934 // Result returns the result of the asynchronous operation. 15935 // If the operation has not completed it will return an error. 15936 Result func(SyncMembersClient) (autorest.Response, error) 15937} 15938 15939// UnmarshalJSON is the custom unmarshaller for CreateFuture. 15940func (future *SyncMembersRefreshMemberSchemaFuture) UnmarshalJSON(body []byte) error { 15941 var azFuture azure.Future 15942 if err := json.Unmarshal(body, &azFuture); err != nil { 15943 return err 15944 } 15945 future.FutureAPI = &azFuture 15946 future.Result = future.result 15947 return nil 15948} 15949 15950// result is the default implementation for SyncMembersRefreshMemberSchemaFuture.Result. 15951func (future *SyncMembersRefreshMemberSchemaFuture) result(client SyncMembersClient) (ar autorest.Response, err error) { 15952 var done bool 15953 done, err = future.DoneWithContext(context.Background(), client) 15954 if err != nil { 15955 err = autorest.NewErrorWithError(err, "sql.SyncMembersRefreshMemberSchemaFuture", "Result", future.Response(), "Polling failure") 15956 return 15957 } 15958 if !done { 15959 ar.Response = future.Response() 15960 err = azure.NewAsyncOpIncompleteError("sql.SyncMembersRefreshMemberSchemaFuture") 15961 return 15962 } 15963 ar.Response = future.Response() 15964 return 15965} 15966 15967// SyncMembersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 15968// operation. 15969type SyncMembersUpdateFuture struct { 15970 azure.FutureAPI 15971 // Result returns the result of the asynchronous operation. 15972 // If the operation has not completed it will return an error. 15973 Result func(SyncMembersClient) (SyncMember, error) 15974} 15975 15976// UnmarshalJSON is the custom unmarshaller for CreateFuture. 15977func (future *SyncMembersUpdateFuture) UnmarshalJSON(body []byte) error { 15978 var azFuture azure.Future 15979 if err := json.Unmarshal(body, &azFuture); err != nil { 15980 return err 15981 } 15982 future.FutureAPI = &azFuture 15983 future.Result = future.result 15984 return nil 15985} 15986 15987// result is the default implementation for SyncMembersUpdateFuture.Result. 15988func (future *SyncMembersUpdateFuture) result(client SyncMembersClient) (sm SyncMember, err error) { 15989 var done bool 15990 done, err = future.DoneWithContext(context.Background(), client) 15991 if err != nil { 15992 err = autorest.NewErrorWithError(err, "sql.SyncMembersUpdateFuture", "Result", future.Response(), "Polling failure") 15993 return 15994 } 15995 if !done { 15996 sm.Response.Response = future.Response() 15997 err = azure.NewAsyncOpIncompleteError("sql.SyncMembersUpdateFuture") 15998 return 15999 } 16000 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 16001 if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { 16002 sm, err = client.UpdateResponder(sm.Response.Response) 16003 if err != nil { 16004 err = autorest.NewErrorWithError(err, "sql.SyncMembersUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") 16005 } 16006 } 16007 return 16008} 16009 16010// TrackedResource ARM tracked top level resource. 16011type TrackedResource struct { 16012 // Location - Resource location. 16013 Location *string `json:"location,omitempty"` 16014 // Tags - Resource tags. 16015 Tags map[string]*string `json:"tags"` 16016 // ID - READ-ONLY; Resource ID. 16017 ID *string `json:"id,omitempty"` 16018 // Name - READ-ONLY; Resource name. 16019 Name *string `json:"name,omitempty"` 16020 // Type - READ-ONLY; Resource type. 16021 Type *string `json:"type,omitempty"` 16022} 16023 16024// MarshalJSON is the custom marshaler for TrackedResource. 16025func (tr TrackedResource) MarshalJSON() ([]byte, error) { 16026 objectMap := make(map[string]interface{}) 16027 if tr.Location != nil { 16028 objectMap["location"] = tr.Location 16029 } 16030 if tr.Tags != nil { 16031 objectMap["tags"] = tr.Tags 16032 } 16033 return json.Marshal(objectMap) 16034} 16035 16036// TransparentDataEncryption represents a database transparent data encryption configuration. 16037type TransparentDataEncryption struct { 16038 autorest.Response `json:"-"` 16039 // Location - READ-ONLY; Resource location. 16040 Location *string `json:"location,omitempty"` 16041 // TransparentDataEncryptionProperties - Represents the properties of the resource. 16042 *TransparentDataEncryptionProperties `json:"properties,omitempty"` 16043 // ID - READ-ONLY; Resource ID. 16044 ID *string `json:"id,omitempty"` 16045 // Name - READ-ONLY; Resource name. 16046 Name *string `json:"name,omitempty"` 16047 // Type - READ-ONLY; Resource type. 16048 Type *string `json:"type,omitempty"` 16049} 16050 16051// MarshalJSON is the custom marshaler for TransparentDataEncryption. 16052func (tde TransparentDataEncryption) MarshalJSON() ([]byte, error) { 16053 objectMap := make(map[string]interface{}) 16054 if tde.TransparentDataEncryptionProperties != nil { 16055 objectMap["properties"] = tde.TransparentDataEncryptionProperties 16056 } 16057 return json.Marshal(objectMap) 16058} 16059 16060// UnmarshalJSON is the custom unmarshaler for TransparentDataEncryption struct. 16061func (tde *TransparentDataEncryption) UnmarshalJSON(body []byte) error { 16062 var m map[string]*json.RawMessage 16063 err := json.Unmarshal(body, &m) 16064 if err != nil { 16065 return err 16066 } 16067 for k, v := range m { 16068 switch k { 16069 case "location": 16070 if v != nil { 16071 var location string 16072 err = json.Unmarshal(*v, &location) 16073 if err != nil { 16074 return err 16075 } 16076 tde.Location = &location 16077 } 16078 case "properties": 16079 if v != nil { 16080 var transparentDataEncryptionProperties TransparentDataEncryptionProperties 16081 err = json.Unmarshal(*v, &transparentDataEncryptionProperties) 16082 if err != nil { 16083 return err 16084 } 16085 tde.TransparentDataEncryptionProperties = &transparentDataEncryptionProperties 16086 } 16087 case "id": 16088 if v != nil { 16089 var ID string 16090 err = json.Unmarshal(*v, &ID) 16091 if err != nil { 16092 return err 16093 } 16094 tde.ID = &ID 16095 } 16096 case "name": 16097 if v != nil { 16098 var name string 16099 err = json.Unmarshal(*v, &name) 16100 if err != nil { 16101 return err 16102 } 16103 tde.Name = &name 16104 } 16105 case "type": 16106 if v != nil { 16107 var typeVar string 16108 err = json.Unmarshal(*v, &typeVar) 16109 if err != nil { 16110 return err 16111 } 16112 tde.Type = &typeVar 16113 } 16114 } 16115 } 16116 16117 return nil 16118} 16119 16120// TransparentDataEncryptionActivity represents a database transparent data encryption Scan. 16121type TransparentDataEncryptionActivity struct { 16122 // Location - READ-ONLY; Resource location. 16123 Location *string `json:"location,omitempty"` 16124 // TransparentDataEncryptionActivityProperties - Represents the properties of the resource. 16125 *TransparentDataEncryptionActivityProperties `json:"properties,omitempty"` 16126 // ID - READ-ONLY; Resource ID. 16127 ID *string `json:"id,omitempty"` 16128 // Name - READ-ONLY; Resource name. 16129 Name *string `json:"name,omitempty"` 16130 // Type - READ-ONLY; Resource type. 16131 Type *string `json:"type,omitempty"` 16132} 16133 16134// MarshalJSON is the custom marshaler for TransparentDataEncryptionActivity. 16135func (tdea TransparentDataEncryptionActivity) MarshalJSON() ([]byte, error) { 16136 objectMap := make(map[string]interface{}) 16137 if tdea.TransparentDataEncryptionActivityProperties != nil { 16138 objectMap["properties"] = tdea.TransparentDataEncryptionActivityProperties 16139 } 16140 return json.Marshal(objectMap) 16141} 16142 16143// UnmarshalJSON is the custom unmarshaler for TransparentDataEncryptionActivity struct. 16144func (tdea *TransparentDataEncryptionActivity) UnmarshalJSON(body []byte) error { 16145 var m map[string]*json.RawMessage 16146 err := json.Unmarshal(body, &m) 16147 if err != nil { 16148 return err 16149 } 16150 for k, v := range m { 16151 switch k { 16152 case "location": 16153 if v != nil { 16154 var location string 16155 err = json.Unmarshal(*v, &location) 16156 if err != nil { 16157 return err 16158 } 16159 tdea.Location = &location 16160 } 16161 case "properties": 16162 if v != nil { 16163 var transparentDataEncryptionActivityProperties TransparentDataEncryptionActivityProperties 16164 err = json.Unmarshal(*v, &transparentDataEncryptionActivityProperties) 16165 if err != nil { 16166 return err 16167 } 16168 tdea.TransparentDataEncryptionActivityProperties = &transparentDataEncryptionActivityProperties 16169 } 16170 case "id": 16171 if v != nil { 16172 var ID string 16173 err = json.Unmarshal(*v, &ID) 16174 if err != nil { 16175 return err 16176 } 16177 tdea.ID = &ID 16178 } 16179 case "name": 16180 if v != nil { 16181 var name string 16182 err = json.Unmarshal(*v, &name) 16183 if err != nil { 16184 return err 16185 } 16186 tdea.Name = &name 16187 } 16188 case "type": 16189 if v != nil { 16190 var typeVar string 16191 err = json.Unmarshal(*v, &typeVar) 16192 if err != nil { 16193 return err 16194 } 16195 tdea.Type = &typeVar 16196 } 16197 } 16198 } 16199 16200 return nil 16201} 16202 16203// TransparentDataEncryptionActivityListResult represents the response to a list database transparent data 16204// encryption activity request. 16205type TransparentDataEncryptionActivityListResult struct { 16206 autorest.Response `json:"-"` 16207 // Value - The list of database transparent data encryption activities. 16208 Value *[]TransparentDataEncryptionActivity `json:"value,omitempty"` 16209} 16210 16211// TransparentDataEncryptionActivityProperties represents the properties of a database transparent data 16212// encryption Scan. 16213type TransparentDataEncryptionActivityProperties struct { 16214 // Status - READ-ONLY; The status of the database. Possible values include: 'Encrypting', 'Decrypting' 16215 Status TransparentDataEncryptionActivityStatus `json:"status,omitempty"` 16216 // PercentComplete - READ-ONLY; The percent complete of the transparent data encryption scan for a database. 16217 PercentComplete *float64 `json:"percentComplete,omitempty"` 16218} 16219 16220// MarshalJSON is the custom marshaler for TransparentDataEncryptionActivityProperties. 16221func (tdeap TransparentDataEncryptionActivityProperties) MarshalJSON() ([]byte, error) { 16222 objectMap := make(map[string]interface{}) 16223 return json.Marshal(objectMap) 16224} 16225 16226// TransparentDataEncryptionProperties represents the properties of a database transparent data encryption. 16227type TransparentDataEncryptionProperties struct { 16228 // Status - The status of the database transparent data encryption. Possible values include: 'TransparentDataEncryptionStatusEnabled', 'TransparentDataEncryptionStatusDisabled' 16229 Status TransparentDataEncryptionStatus `json:"status,omitempty"` 16230} 16231 16232// UnlinkParameters represents the parameters for Unlink Replication Link request. 16233type UnlinkParameters struct { 16234 // ForcedTermination - Determines whether link will be terminated in a forced or a friendly way. 16235 ForcedTermination *bool `json:"forcedTermination,omitempty"` 16236} 16237 16238// VirtualCluster an Azure SQL virtual cluster. 16239type VirtualCluster struct { 16240 autorest.Response `json:"-"` 16241 // VirtualClusterProperties - Resource properties. 16242 *VirtualClusterProperties `json:"properties,omitempty"` 16243 // Location - Resource location. 16244 Location *string `json:"location,omitempty"` 16245 // Tags - Resource tags. 16246 Tags map[string]*string `json:"tags"` 16247 // ID - READ-ONLY; Resource ID. 16248 ID *string `json:"id,omitempty"` 16249 // Name - READ-ONLY; Resource name. 16250 Name *string `json:"name,omitempty"` 16251 // Type - READ-ONLY; Resource type. 16252 Type *string `json:"type,omitempty"` 16253} 16254 16255// MarshalJSON is the custom marshaler for VirtualCluster. 16256func (vc VirtualCluster) MarshalJSON() ([]byte, error) { 16257 objectMap := make(map[string]interface{}) 16258 if vc.VirtualClusterProperties != nil { 16259 objectMap["properties"] = vc.VirtualClusterProperties 16260 } 16261 if vc.Location != nil { 16262 objectMap["location"] = vc.Location 16263 } 16264 if vc.Tags != nil { 16265 objectMap["tags"] = vc.Tags 16266 } 16267 return json.Marshal(objectMap) 16268} 16269 16270// UnmarshalJSON is the custom unmarshaler for VirtualCluster struct. 16271func (vc *VirtualCluster) UnmarshalJSON(body []byte) error { 16272 var m map[string]*json.RawMessage 16273 err := json.Unmarshal(body, &m) 16274 if err != nil { 16275 return err 16276 } 16277 for k, v := range m { 16278 switch k { 16279 case "properties": 16280 if v != nil { 16281 var virtualClusterProperties VirtualClusterProperties 16282 err = json.Unmarshal(*v, &virtualClusterProperties) 16283 if err != nil { 16284 return err 16285 } 16286 vc.VirtualClusterProperties = &virtualClusterProperties 16287 } 16288 case "location": 16289 if v != nil { 16290 var location string 16291 err = json.Unmarshal(*v, &location) 16292 if err != nil { 16293 return err 16294 } 16295 vc.Location = &location 16296 } 16297 case "tags": 16298 if v != nil { 16299 var tags map[string]*string 16300 err = json.Unmarshal(*v, &tags) 16301 if err != nil { 16302 return err 16303 } 16304 vc.Tags = tags 16305 } 16306 case "id": 16307 if v != nil { 16308 var ID string 16309 err = json.Unmarshal(*v, &ID) 16310 if err != nil { 16311 return err 16312 } 16313 vc.ID = &ID 16314 } 16315 case "name": 16316 if v != nil { 16317 var name string 16318 err = json.Unmarshal(*v, &name) 16319 if err != nil { 16320 return err 16321 } 16322 vc.Name = &name 16323 } 16324 case "type": 16325 if v != nil { 16326 var typeVar string 16327 err = json.Unmarshal(*v, &typeVar) 16328 if err != nil { 16329 return err 16330 } 16331 vc.Type = &typeVar 16332 } 16333 } 16334 } 16335 16336 return nil 16337} 16338 16339// VirtualClusterListResult a list of virtual clusters. 16340type VirtualClusterListResult struct { 16341 autorest.Response `json:"-"` 16342 // Value - READ-ONLY; Array of results. 16343 Value *[]VirtualCluster `json:"value,omitempty"` 16344 // NextLink - READ-ONLY; Link to retrieve next page of results. 16345 NextLink *string `json:"nextLink,omitempty"` 16346} 16347 16348// MarshalJSON is the custom marshaler for VirtualClusterListResult. 16349func (vclr VirtualClusterListResult) MarshalJSON() ([]byte, error) { 16350 objectMap := make(map[string]interface{}) 16351 return json.Marshal(objectMap) 16352} 16353 16354// VirtualClusterListResultIterator provides access to a complete listing of VirtualCluster values. 16355type VirtualClusterListResultIterator struct { 16356 i int 16357 page VirtualClusterListResultPage 16358} 16359 16360// NextWithContext advances to the next value. If there was an error making 16361// the request the iterator does not advance and the error is returned. 16362func (iter *VirtualClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { 16363 if tracing.IsEnabled() { 16364 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClusterListResultIterator.NextWithContext") 16365 defer func() { 16366 sc := -1 16367 if iter.Response().Response.Response != nil { 16368 sc = iter.Response().Response.Response.StatusCode 16369 } 16370 tracing.EndSpan(ctx, sc, err) 16371 }() 16372 } 16373 iter.i++ 16374 if iter.i < len(iter.page.Values()) { 16375 return nil 16376 } 16377 err = iter.page.NextWithContext(ctx) 16378 if err != nil { 16379 iter.i-- 16380 return err 16381 } 16382 iter.i = 0 16383 return nil 16384} 16385 16386// Next advances to the next value. If there was an error making 16387// the request the iterator does not advance and the error is returned. 16388// Deprecated: Use NextWithContext() instead. 16389func (iter *VirtualClusterListResultIterator) Next() error { 16390 return iter.NextWithContext(context.Background()) 16391} 16392 16393// NotDone returns true if the enumeration should be started or is not yet complete. 16394func (iter VirtualClusterListResultIterator) NotDone() bool { 16395 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 16396} 16397 16398// Response returns the raw server response from the last page request. 16399func (iter VirtualClusterListResultIterator) Response() VirtualClusterListResult { 16400 return iter.page.Response() 16401} 16402 16403// Value returns the current value or a zero-initialized value if the 16404// iterator has advanced beyond the end of the collection. 16405func (iter VirtualClusterListResultIterator) Value() VirtualCluster { 16406 if !iter.page.NotDone() { 16407 return VirtualCluster{} 16408 } 16409 return iter.page.Values()[iter.i] 16410} 16411 16412// Creates a new instance of the VirtualClusterListResultIterator type. 16413func NewVirtualClusterListResultIterator(page VirtualClusterListResultPage) VirtualClusterListResultIterator { 16414 return VirtualClusterListResultIterator{page: page} 16415} 16416 16417// IsEmpty returns true if the ListResult contains no values. 16418func (vclr VirtualClusterListResult) IsEmpty() bool { 16419 return vclr.Value == nil || len(*vclr.Value) == 0 16420} 16421 16422// hasNextLink returns true if the NextLink is not empty. 16423func (vclr VirtualClusterListResult) hasNextLink() bool { 16424 return vclr.NextLink != nil && len(*vclr.NextLink) != 0 16425} 16426 16427// virtualClusterListResultPreparer prepares a request to retrieve the next set of results. 16428// It returns nil if no more results exist. 16429func (vclr VirtualClusterListResult) virtualClusterListResultPreparer(ctx context.Context) (*http.Request, error) { 16430 if !vclr.hasNextLink() { 16431 return nil, nil 16432 } 16433 return autorest.Prepare((&http.Request{}).WithContext(ctx), 16434 autorest.AsJSON(), 16435 autorest.AsGet(), 16436 autorest.WithBaseURL(to.String(vclr.NextLink))) 16437} 16438 16439// VirtualClusterListResultPage contains a page of VirtualCluster values. 16440type VirtualClusterListResultPage struct { 16441 fn func(context.Context, VirtualClusterListResult) (VirtualClusterListResult, error) 16442 vclr VirtualClusterListResult 16443} 16444 16445// NextWithContext advances to the next page of values. If there was an error making 16446// the request the page does not advance and the error is returned. 16447func (page *VirtualClusterListResultPage) NextWithContext(ctx context.Context) (err error) { 16448 if tracing.IsEnabled() { 16449 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualClusterListResultPage.NextWithContext") 16450 defer func() { 16451 sc := -1 16452 if page.Response().Response.Response != nil { 16453 sc = page.Response().Response.Response.StatusCode 16454 } 16455 tracing.EndSpan(ctx, sc, err) 16456 }() 16457 } 16458 for { 16459 next, err := page.fn(ctx, page.vclr) 16460 if err != nil { 16461 return err 16462 } 16463 page.vclr = next 16464 if !next.hasNextLink() || !next.IsEmpty() { 16465 break 16466 } 16467 } 16468 return nil 16469} 16470 16471// Next advances to the next page of values. If there was an error making 16472// the request the page does not advance and the error is returned. 16473// Deprecated: Use NextWithContext() instead. 16474func (page *VirtualClusterListResultPage) Next() error { 16475 return page.NextWithContext(context.Background()) 16476} 16477 16478// NotDone returns true if the page enumeration should be started or is not yet complete. 16479func (page VirtualClusterListResultPage) NotDone() bool { 16480 return !page.vclr.IsEmpty() 16481} 16482 16483// Response returns the raw server response from the last page request. 16484func (page VirtualClusterListResultPage) Response() VirtualClusterListResult { 16485 return page.vclr 16486} 16487 16488// Values returns the slice of values for the current page or nil if there are no values. 16489func (page VirtualClusterListResultPage) Values() []VirtualCluster { 16490 if page.vclr.IsEmpty() { 16491 return nil 16492 } 16493 return *page.vclr.Value 16494} 16495 16496// Creates a new instance of the VirtualClusterListResultPage type. 16497func NewVirtualClusterListResultPage(cur VirtualClusterListResult, getNextPage func(context.Context, VirtualClusterListResult) (VirtualClusterListResult, error)) VirtualClusterListResultPage { 16498 return VirtualClusterListResultPage{ 16499 fn: getNextPage, 16500 vclr: cur, 16501 } 16502} 16503 16504// VirtualClusterProperties the properties of a virtual cluster. 16505type VirtualClusterProperties struct { 16506 // SubnetID - READ-ONLY; Subnet resource ID for the virtual cluster. 16507 SubnetID *string `json:"subnetId,omitempty"` 16508 // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. 16509 Family *string `json:"family,omitempty"` 16510 // ChildResources - READ-ONLY; List of resources in this virtual cluster. 16511 ChildResources *[]string `json:"childResources,omitempty"` 16512} 16513 16514// MarshalJSON is the custom marshaler for VirtualClusterProperties. 16515func (vcp VirtualClusterProperties) MarshalJSON() ([]byte, error) { 16516 objectMap := make(map[string]interface{}) 16517 if vcp.Family != nil { 16518 objectMap["family"] = vcp.Family 16519 } 16520 return json.Marshal(objectMap) 16521} 16522 16523// VirtualClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 16524// operation. 16525type VirtualClustersDeleteFuture struct { 16526 azure.FutureAPI 16527 // Result returns the result of the asynchronous operation. 16528 // If the operation has not completed it will return an error. 16529 Result func(VirtualClustersClient) (autorest.Response, error) 16530} 16531 16532// UnmarshalJSON is the custom unmarshaller for CreateFuture. 16533func (future *VirtualClustersDeleteFuture) UnmarshalJSON(body []byte) error { 16534 var azFuture azure.Future 16535 if err := json.Unmarshal(body, &azFuture); err != nil { 16536 return err 16537 } 16538 future.FutureAPI = &azFuture 16539 future.Result = future.result 16540 return nil 16541} 16542 16543// result is the default implementation for VirtualClustersDeleteFuture.Result. 16544func (future *VirtualClustersDeleteFuture) result(client VirtualClustersClient) (ar autorest.Response, err error) { 16545 var done bool 16546 done, err = future.DoneWithContext(context.Background(), client) 16547 if err != nil { 16548 err = autorest.NewErrorWithError(err, "sql.VirtualClustersDeleteFuture", "Result", future.Response(), "Polling failure") 16549 return 16550 } 16551 if !done { 16552 ar.Response = future.Response() 16553 err = azure.NewAsyncOpIncompleteError("sql.VirtualClustersDeleteFuture") 16554 return 16555 } 16556 ar.Response = future.Response() 16557 return 16558} 16559 16560// VirtualClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 16561// operation. 16562type VirtualClustersUpdateFuture struct { 16563 azure.FutureAPI 16564 // Result returns the result of the asynchronous operation. 16565 // If the operation has not completed it will return an error. 16566 Result func(VirtualClustersClient) (VirtualCluster, error) 16567} 16568 16569// UnmarshalJSON is the custom unmarshaller for CreateFuture. 16570func (future *VirtualClustersUpdateFuture) UnmarshalJSON(body []byte) error { 16571 var azFuture azure.Future 16572 if err := json.Unmarshal(body, &azFuture); err != nil { 16573 return err 16574 } 16575 future.FutureAPI = &azFuture 16576 future.Result = future.result 16577 return nil 16578} 16579 16580// result is the default implementation for VirtualClustersUpdateFuture.Result. 16581func (future *VirtualClustersUpdateFuture) result(client VirtualClustersClient) (vc VirtualCluster, err error) { 16582 var done bool 16583 done, err = future.DoneWithContext(context.Background(), client) 16584 if err != nil { 16585 err = autorest.NewErrorWithError(err, "sql.VirtualClustersUpdateFuture", "Result", future.Response(), "Polling failure") 16586 return 16587 } 16588 if !done { 16589 vc.Response.Response = future.Response() 16590 err = azure.NewAsyncOpIncompleteError("sql.VirtualClustersUpdateFuture") 16591 return 16592 } 16593 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 16594 if vc.Response.Response, err = future.GetResult(sender); err == nil && vc.Response.Response.StatusCode != http.StatusNoContent { 16595 vc, err = client.UpdateResponder(vc.Response.Response) 16596 if err != nil { 16597 err = autorest.NewErrorWithError(err, "sql.VirtualClustersUpdateFuture", "Result", vc.Response.Response, "Failure responding to request") 16598 } 16599 } 16600 return 16601} 16602 16603// VirtualClusterUpdate an update request for an Azure SQL Database virtual cluster. 16604type VirtualClusterUpdate struct { 16605 // VirtualClusterProperties - Resource properties. 16606 *VirtualClusterProperties `json:"properties,omitempty"` 16607 // Tags - Resource tags. 16608 Tags map[string]*string `json:"tags"` 16609} 16610 16611// MarshalJSON is the custom marshaler for VirtualClusterUpdate. 16612func (vcu VirtualClusterUpdate) MarshalJSON() ([]byte, error) { 16613 objectMap := make(map[string]interface{}) 16614 if vcu.VirtualClusterProperties != nil { 16615 objectMap["properties"] = vcu.VirtualClusterProperties 16616 } 16617 if vcu.Tags != nil { 16618 objectMap["tags"] = vcu.Tags 16619 } 16620 return json.Marshal(objectMap) 16621} 16622 16623// UnmarshalJSON is the custom unmarshaler for VirtualClusterUpdate struct. 16624func (vcu *VirtualClusterUpdate) UnmarshalJSON(body []byte) error { 16625 var m map[string]*json.RawMessage 16626 err := json.Unmarshal(body, &m) 16627 if err != nil { 16628 return err 16629 } 16630 for k, v := range m { 16631 switch k { 16632 case "properties": 16633 if v != nil { 16634 var virtualClusterProperties VirtualClusterProperties 16635 err = json.Unmarshal(*v, &virtualClusterProperties) 16636 if err != nil { 16637 return err 16638 } 16639 vcu.VirtualClusterProperties = &virtualClusterProperties 16640 } 16641 case "tags": 16642 if v != nil { 16643 var tags map[string]*string 16644 err = json.Unmarshal(*v, &tags) 16645 if err != nil { 16646 return err 16647 } 16648 vcu.Tags = tags 16649 } 16650 } 16651 } 16652 16653 return nil 16654} 16655 16656// VirtualNetworkRule a virtual network rule. 16657type VirtualNetworkRule struct { 16658 autorest.Response `json:"-"` 16659 // VirtualNetworkRuleProperties - Resource properties. 16660 *VirtualNetworkRuleProperties `json:"properties,omitempty"` 16661 // ID - READ-ONLY; Resource ID. 16662 ID *string `json:"id,omitempty"` 16663 // Name - READ-ONLY; Resource name. 16664 Name *string `json:"name,omitempty"` 16665 // Type - READ-ONLY; Resource type. 16666 Type *string `json:"type,omitempty"` 16667} 16668 16669// MarshalJSON is the custom marshaler for VirtualNetworkRule. 16670func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { 16671 objectMap := make(map[string]interface{}) 16672 if vnr.VirtualNetworkRuleProperties != nil { 16673 objectMap["properties"] = vnr.VirtualNetworkRuleProperties 16674 } 16675 return json.Marshal(objectMap) 16676} 16677 16678// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct. 16679func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error { 16680 var m map[string]*json.RawMessage 16681 err := json.Unmarshal(body, &m) 16682 if err != nil { 16683 return err 16684 } 16685 for k, v := range m { 16686 switch k { 16687 case "properties": 16688 if v != nil { 16689 var virtualNetworkRuleProperties VirtualNetworkRuleProperties 16690 err = json.Unmarshal(*v, &virtualNetworkRuleProperties) 16691 if err != nil { 16692 return err 16693 } 16694 vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties 16695 } 16696 case "id": 16697 if v != nil { 16698 var ID string 16699 err = json.Unmarshal(*v, &ID) 16700 if err != nil { 16701 return err 16702 } 16703 vnr.ID = &ID 16704 } 16705 case "name": 16706 if v != nil { 16707 var name string 16708 err = json.Unmarshal(*v, &name) 16709 if err != nil { 16710 return err 16711 } 16712 vnr.Name = &name 16713 } 16714 case "type": 16715 if v != nil { 16716 var typeVar string 16717 err = json.Unmarshal(*v, &typeVar) 16718 if err != nil { 16719 return err 16720 } 16721 vnr.Type = &typeVar 16722 } 16723 } 16724 } 16725 16726 return nil 16727} 16728 16729// VirtualNetworkRuleListResult a list of virtual network rules. 16730type VirtualNetworkRuleListResult struct { 16731 autorest.Response `json:"-"` 16732 // Value - READ-ONLY; Array of results. 16733 Value *[]VirtualNetworkRule `json:"value,omitempty"` 16734 // NextLink - READ-ONLY; Link to retrieve next page of results. 16735 NextLink *string `json:"nextLink,omitempty"` 16736} 16737 16738// MarshalJSON is the custom marshaler for VirtualNetworkRuleListResult. 16739func (vnrlr VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { 16740 objectMap := make(map[string]interface{}) 16741 return json.Marshal(objectMap) 16742} 16743 16744// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values. 16745type VirtualNetworkRuleListResultIterator struct { 16746 i int 16747 page VirtualNetworkRuleListResultPage 16748} 16749 16750// NextWithContext advances to the next value. If there was an error making 16751// the request the iterator does not advance and the error is returned. 16752func (iter *VirtualNetworkRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { 16753 if tracing.IsEnabled() { 16754 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultIterator.NextWithContext") 16755 defer func() { 16756 sc := -1 16757 if iter.Response().Response.Response != nil { 16758 sc = iter.Response().Response.Response.StatusCode 16759 } 16760 tracing.EndSpan(ctx, sc, err) 16761 }() 16762 } 16763 iter.i++ 16764 if iter.i < len(iter.page.Values()) { 16765 return nil 16766 } 16767 err = iter.page.NextWithContext(ctx) 16768 if err != nil { 16769 iter.i-- 16770 return err 16771 } 16772 iter.i = 0 16773 return nil 16774} 16775 16776// Next advances to the next value. If there was an error making 16777// the request the iterator does not advance and the error is returned. 16778// Deprecated: Use NextWithContext() instead. 16779func (iter *VirtualNetworkRuleListResultIterator) Next() error { 16780 return iter.NextWithContext(context.Background()) 16781} 16782 16783// NotDone returns true if the enumeration should be started or is not yet complete. 16784func (iter VirtualNetworkRuleListResultIterator) NotDone() bool { 16785 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 16786} 16787 16788// Response returns the raw server response from the last page request. 16789func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult { 16790 return iter.page.Response() 16791} 16792 16793// Value returns the current value or a zero-initialized value if the 16794// iterator has advanced beyond the end of the collection. 16795func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { 16796 if !iter.page.NotDone() { 16797 return VirtualNetworkRule{} 16798 } 16799 return iter.page.Values()[iter.i] 16800} 16801 16802// Creates a new instance of the VirtualNetworkRuleListResultIterator type. 16803func NewVirtualNetworkRuleListResultIterator(page VirtualNetworkRuleListResultPage) VirtualNetworkRuleListResultIterator { 16804 return VirtualNetworkRuleListResultIterator{page: page} 16805} 16806 16807// IsEmpty returns true if the ListResult contains no values. 16808func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool { 16809 return vnrlr.Value == nil || len(*vnrlr.Value) == 0 16810} 16811 16812// hasNextLink returns true if the NextLink is not empty. 16813func (vnrlr VirtualNetworkRuleListResult) hasNextLink() bool { 16814 return vnrlr.NextLink != nil && len(*vnrlr.NextLink) != 0 16815} 16816 16817// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results. 16818// It returns nil if no more results exist. 16819func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer(ctx context.Context) (*http.Request, error) { 16820 if !vnrlr.hasNextLink() { 16821 return nil, nil 16822 } 16823 return autorest.Prepare((&http.Request{}).WithContext(ctx), 16824 autorest.AsJSON(), 16825 autorest.AsGet(), 16826 autorest.WithBaseURL(to.String(vnrlr.NextLink))) 16827} 16828 16829// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values. 16830type VirtualNetworkRuleListResultPage struct { 16831 fn func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error) 16832 vnrlr VirtualNetworkRuleListResult 16833} 16834 16835// NextWithContext advances to the next page of values. If there was an error making 16836// the request the page does not advance and the error is returned. 16837func (page *VirtualNetworkRuleListResultPage) NextWithContext(ctx context.Context) (err error) { 16838 if tracing.IsEnabled() { 16839 ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultPage.NextWithContext") 16840 defer func() { 16841 sc := -1 16842 if page.Response().Response.Response != nil { 16843 sc = page.Response().Response.Response.StatusCode 16844 } 16845 tracing.EndSpan(ctx, sc, err) 16846 }() 16847 } 16848 for { 16849 next, err := page.fn(ctx, page.vnrlr) 16850 if err != nil { 16851 return err 16852 } 16853 page.vnrlr = next 16854 if !next.hasNextLink() || !next.IsEmpty() { 16855 break 16856 } 16857 } 16858 return nil 16859} 16860 16861// Next advances to the next page of values. If there was an error making 16862// the request the page does not advance and the error is returned. 16863// Deprecated: Use NextWithContext() instead. 16864func (page *VirtualNetworkRuleListResultPage) Next() error { 16865 return page.NextWithContext(context.Background()) 16866} 16867 16868// NotDone returns true if the page enumeration should be started or is not yet complete. 16869func (page VirtualNetworkRuleListResultPage) NotDone() bool { 16870 return !page.vnrlr.IsEmpty() 16871} 16872 16873// Response returns the raw server response from the last page request. 16874func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult { 16875 return page.vnrlr 16876} 16877 16878// Values returns the slice of values for the current page or nil if there are no values. 16879func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { 16880 if page.vnrlr.IsEmpty() { 16881 return nil 16882 } 16883 return *page.vnrlr.Value 16884} 16885 16886// Creates a new instance of the VirtualNetworkRuleListResultPage type. 16887func NewVirtualNetworkRuleListResultPage(cur VirtualNetworkRuleListResult, getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage { 16888 return VirtualNetworkRuleListResultPage{ 16889 fn: getNextPage, 16890 vnrlr: cur, 16891 } 16892} 16893 16894// VirtualNetworkRuleProperties properties of a virtual network rule. 16895type VirtualNetworkRuleProperties struct { 16896 // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. 16897 VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` 16898 // IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. 16899 IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` 16900 // State - READ-ONLY; Virtual Network Rule State. Possible values include: 'VirtualNetworkRuleStateInitializing', 'VirtualNetworkRuleStateInProgress', 'VirtualNetworkRuleStateReady', 'VirtualNetworkRuleStateDeleting', 'VirtualNetworkRuleStateUnknown' 16901 State VirtualNetworkRuleState `json:"state,omitempty"` 16902} 16903 16904// MarshalJSON is the custom marshaler for VirtualNetworkRuleProperties. 16905func (vnrp VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) { 16906 objectMap := make(map[string]interface{}) 16907 if vnrp.VirtualNetworkSubnetID != nil { 16908 objectMap["virtualNetworkSubnetId"] = vnrp.VirtualNetworkSubnetID 16909 } 16910 if vnrp.IgnoreMissingVnetServiceEndpoint != nil { 16911 objectMap["ignoreMissingVnetServiceEndpoint"] = vnrp.IgnoreMissingVnetServiceEndpoint 16912 } 16913 return json.Marshal(objectMap) 16914} 16915 16916// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 16917// long-running operation. 16918type VirtualNetworkRulesCreateOrUpdateFuture struct { 16919 azure.FutureAPI 16920 // Result returns the result of the asynchronous operation. 16921 // If the operation has not completed it will return an error. 16922 Result func(VirtualNetworkRulesClient) (VirtualNetworkRule, error) 16923} 16924 16925// UnmarshalJSON is the custom unmarshaller for CreateFuture. 16926func (future *VirtualNetworkRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 16927 var azFuture azure.Future 16928 if err := json.Unmarshal(body, &azFuture); err != nil { 16929 return err 16930 } 16931 future.FutureAPI = &azFuture 16932 future.Result = future.result 16933 return nil 16934} 16935 16936// result is the default implementation for VirtualNetworkRulesCreateOrUpdateFuture.Result. 16937func (future *VirtualNetworkRulesCreateOrUpdateFuture) result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { 16938 var done bool 16939 done, err = future.DoneWithContext(context.Background(), client) 16940 if err != nil { 16941 err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 16942 return 16943 } 16944 if !done { 16945 vnr.Response.Response = future.Response() 16946 err = azure.NewAsyncOpIncompleteError("sql.VirtualNetworkRulesCreateOrUpdateFuture") 16947 return 16948 } 16949 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 16950 if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent { 16951 vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response) 16952 if err != nil { 16953 err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request") 16954 } 16955 } 16956 return 16957} 16958 16959// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a 16960// long-running operation. 16961type VirtualNetworkRulesDeleteFuture struct { 16962 azure.FutureAPI 16963 // Result returns the result of the asynchronous operation. 16964 // If the operation has not completed it will return an error. 16965 Result func(VirtualNetworkRulesClient) (autorest.Response, error) 16966} 16967 16968// UnmarshalJSON is the custom unmarshaller for CreateFuture. 16969func (future *VirtualNetworkRulesDeleteFuture) UnmarshalJSON(body []byte) error { 16970 var azFuture azure.Future 16971 if err := json.Unmarshal(body, &azFuture); err != nil { 16972 return err 16973 } 16974 future.FutureAPI = &azFuture 16975 future.Result = future.result 16976 return nil 16977} 16978 16979// result is the default implementation for VirtualNetworkRulesDeleteFuture.Result. 16980func (future *VirtualNetworkRulesDeleteFuture) result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { 16981 var done bool 16982 done, err = future.DoneWithContext(context.Background(), client) 16983 if err != nil { 16984 err = autorest.NewErrorWithError(err, "sql.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure") 16985 return 16986 } 16987 if !done { 16988 ar.Response = future.Response() 16989 err = azure.NewAsyncOpIncompleteError("sql.VirtualNetworkRulesDeleteFuture") 16990 return 16991 } 16992 ar.Response = future.Response() 16993 return 16994} 16995 16996// VulnerabilityAssessmentRecurringScansProperties properties of a Vulnerability Assessment recurring 16997// scans. 16998type VulnerabilityAssessmentRecurringScansProperties struct { 16999 // IsEnabled - Recurring scans state. 17000 IsEnabled *bool `json:"isEnabled,omitempty"` 17001 // EmailSubscriptionAdmins - Specifies that the schedule scan notification will be is sent to the subscription administrators. 17002 EmailSubscriptionAdmins *bool `json:"emailSubscriptionAdmins,omitempty"` 17003 // Emails - Specifies an array of e-mail addresses to which the scan notification is sent. 17004 Emails *[]string `json:"emails,omitempty"` 17005} 17006