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