1package redis 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/to" 15 "github.com/Azure/go-autorest/tracing" 16 "net/http" 17) 18 19// The package's fully qualified name. 20const fqdn = "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2017-02-01/redis" 21 22// AccessKeys redis cache access keys. 23type AccessKeys struct { 24 autorest.Response `json:"-"` 25 // PrimaryKey - READ-ONLY; The current primary key that clients can use to authenticate with Redis cache. 26 PrimaryKey *string `json:"primaryKey,omitempty"` 27 // SecondaryKey - READ-ONLY; The current secondary key that clients can use to authenticate with Redis cache. 28 SecondaryKey *string `json:"secondaryKey,omitempty"` 29} 30 31// MarshalJSON is the custom marshaler for AccessKeys. 32func (ak AccessKeys) MarshalJSON() ([]byte, error) { 33 objectMap := make(map[string]interface{}) 34 return json.Marshal(objectMap) 35} 36 37// CreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 38type CreateFuture struct { 39 azure.FutureAPI 40 // Result returns the result of the asynchronous operation. 41 // If the operation has not completed it will return an error. 42 Result func(Client) (ResourceType, error) 43} 44 45// UnmarshalJSON is the custom unmarshaller for CreateFuture. 46func (future *CreateFuture) UnmarshalJSON(body []byte) error { 47 var azFuture azure.Future 48 if err := json.Unmarshal(body, &azFuture); err != nil { 49 return err 50 } 51 future.FutureAPI = &azFuture 52 future.Result = future.result 53 return nil 54} 55 56// result is the default implementation for CreateFuture.Result. 57func (future *CreateFuture) result(client Client) (rt ResourceType, err error) { 58 var done bool 59 done, err = future.DoneWithContext(context.Background(), client) 60 if err != nil { 61 err = autorest.NewErrorWithError(err, "redis.CreateFuture", "Result", future.Response(), "Polling failure") 62 return 63 } 64 if !done { 65 rt.Response.Response = future.Response() 66 err = azure.NewAsyncOpIncompleteError("redis.CreateFuture") 67 return 68 } 69 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 70 if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { 71 rt, err = client.CreateResponder(rt.Response.Response) 72 if err != nil { 73 err = autorest.NewErrorWithError(err, "redis.CreateFuture", "Result", rt.Response.Response, "Failure responding to request") 74 } 75 } 76 return 77} 78 79// CreateParameters parameters supplied to the Create Redis operation. 80type CreateParameters struct { 81 // CreateProperties - Redis cache properties. 82 *CreateProperties `json:"properties,omitempty"` 83 // Tags - Resource tags. 84 Tags map[string]*string `json:"tags"` 85 // Location - The geo-location where the resource lives 86 Location *string `json:"location,omitempty"` 87 // ID - READ-ONLY; Resource ID. 88 ID *string `json:"id,omitempty"` 89 // Name - READ-ONLY; Resource name. 90 Name *string `json:"name,omitempty"` 91 // Type - READ-ONLY; Resource type. 92 Type *string `json:"type,omitempty"` 93} 94 95// MarshalJSON is the custom marshaler for CreateParameters. 96func (cp CreateParameters) MarshalJSON() ([]byte, error) { 97 objectMap := make(map[string]interface{}) 98 if cp.CreateProperties != nil { 99 objectMap["properties"] = cp.CreateProperties 100 } 101 if cp.Tags != nil { 102 objectMap["tags"] = cp.Tags 103 } 104 if cp.Location != nil { 105 objectMap["location"] = cp.Location 106 } 107 return json.Marshal(objectMap) 108} 109 110// UnmarshalJSON is the custom unmarshaler for CreateParameters struct. 111func (cp *CreateParameters) UnmarshalJSON(body []byte) error { 112 var m map[string]*json.RawMessage 113 err := json.Unmarshal(body, &m) 114 if err != nil { 115 return err 116 } 117 for k, v := range m { 118 switch k { 119 case "properties": 120 if v != nil { 121 var createProperties CreateProperties 122 err = json.Unmarshal(*v, &createProperties) 123 if err != nil { 124 return err 125 } 126 cp.CreateProperties = &createProperties 127 } 128 case "tags": 129 if v != nil { 130 var tags map[string]*string 131 err = json.Unmarshal(*v, &tags) 132 if err != nil { 133 return err 134 } 135 cp.Tags = tags 136 } 137 case "location": 138 if v != nil { 139 var location string 140 err = json.Unmarshal(*v, &location) 141 if err != nil { 142 return err 143 } 144 cp.Location = &location 145 } 146 case "id": 147 if v != nil { 148 var ID string 149 err = json.Unmarshal(*v, &ID) 150 if err != nil { 151 return err 152 } 153 cp.ID = &ID 154 } 155 case "name": 156 if v != nil { 157 var name string 158 err = json.Unmarshal(*v, &name) 159 if err != nil { 160 return err 161 } 162 cp.Name = &name 163 } 164 case "type": 165 if v != nil { 166 var typeVar string 167 err = json.Unmarshal(*v, &typeVar) 168 if err != nil { 169 return err 170 } 171 cp.Type = &typeVar 172 } 173 } 174 } 175 176 return nil 177} 178 179// CreateProperties properties supplied to Create Redis operation. 180type CreateProperties struct { 181 // Sku - The SKU of the Redis cache to deploy. 182 Sku *Sku `json:"sku,omitempty"` 183 // RedisConfiguration - All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. 184 RedisConfiguration map[string]*string `json:"redisConfiguration"` 185 // EnableNonSslPort - Specifies whether the non-ssl Redis server port (6379) is enabled. 186 EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` 187 // TenantSettings - tenantSettings 188 TenantSettings map[string]*string `json:"tenantSettings"` 189 // ShardCount - The number of shards to be created on a Premium Cluster Cache. 190 ShardCount *int32 `json:"shardCount,omitempty"` 191 // SubnetID - The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 192 SubnetID *string `json:"subnetId,omitempty"` 193 // StaticIP - Static IP address. Required when deploying a Redis cache inside an existing Azure Virtual Network. 194 StaticIP *string `json:"staticIP,omitempty"` 195} 196 197// MarshalJSON is the custom marshaler for CreateProperties. 198func (cp CreateProperties) MarshalJSON() ([]byte, error) { 199 objectMap := make(map[string]interface{}) 200 if cp.Sku != nil { 201 objectMap["sku"] = cp.Sku 202 } 203 if cp.RedisConfiguration != nil { 204 objectMap["redisConfiguration"] = cp.RedisConfiguration 205 } 206 if cp.EnableNonSslPort != nil { 207 objectMap["enableNonSslPort"] = cp.EnableNonSslPort 208 } 209 if cp.TenantSettings != nil { 210 objectMap["tenantSettings"] = cp.TenantSettings 211 } 212 if cp.ShardCount != nil { 213 objectMap["shardCount"] = cp.ShardCount 214 } 215 if cp.SubnetID != nil { 216 objectMap["subnetId"] = cp.SubnetID 217 } 218 if cp.StaticIP != nil { 219 objectMap["staticIP"] = cp.StaticIP 220 } 221 return json.Marshal(objectMap) 222} 223 224// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 225type DeleteFuture struct { 226 azure.FutureAPI 227 // Result returns the result of the asynchronous operation. 228 // If the operation has not completed it will return an error. 229 Result func(Client) (autorest.Response, error) 230} 231 232// UnmarshalJSON is the custom unmarshaller for CreateFuture. 233func (future *DeleteFuture) UnmarshalJSON(body []byte) error { 234 var azFuture azure.Future 235 if err := json.Unmarshal(body, &azFuture); err != nil { 236 return err 237 } 238 future.FutureAPI = &azFuture 239 future.Result = future.result 240 return nil 241} 242 243// result is the default implementation for DeleteFuture.Result. 244func (future *DeleteFuture) result(client Client) (ar autorest.Response, err error) { 245 var done bool 246 done, err = future.DoneWithContext(context.Background(), client) 247 if err != nil { 248 err = autorest.NewErrorWithError(err, "redis.DeleteFuture", "Result", future.Response(), "Polling failure") 249 return 250 } 251 if !done { 252 ar.Response = future.Response() 253 err = azure.NewAsyncOpIncompleteError("redis.DeleteFuture") 254 return 255 } 256 ar.Response = future.Response() 257 return 258} 259 260// ExportDataFuture an abstraction for monitoring and retrieving the results of a long-running operation. 261type ExportDataFuture struct { 262 azure.FutureAPI 263 // Result returns the result of the asynchronous operation. 264 // If the operation has not completed it will return an error. 265 Result func(Client) (autorest.Response, error) 266} 267 268// UnmarshalJSON is the custom unmarshaller for CreateFuture. 269func (future *ExportDataFuture) UnmarshalJSON(body []byte) error { 270 var azFuture azure.Future 271 if err := json.Unmarshal(body, &azFuture); err != nil { 272 return err 273 } 274 future.FutureAPI = &azFuture 275 future.Result = future.result 276 return nil 277} 278 279// result is the default implementation for ExportDataFuture.Result. 280func (future *ExportDataFuture) result(client Client) (ar autorest.Response, err error) { 281 var done bool 282 done, err = future.DoneWithContext(context.Background(), client) 283 if err != nil { 284 err = autorest.NewErrorWithError(err, "redis.ExportDataFuture", "Result", future.Response(), "Polling failure") 285 return 286 } 287 if !done { 288 ar.Response = future.Response() 289 err = azure.NewAsyncOpIncompleteError("redis.ExportDataFuture") 290 return 291 } 292 ar.Response = future.Response() 293 return 294} 295 296// ExportRDBParameters parameters for Redis export operation. 297type ExportRDBParameters struct { 298 // Format - File format. 299 Format *string `json:"format,omitempty"` 300 // Prefix - Prefix to use for exported files. 301 Prefix *string `json:"prefix,omitempty"` 302 // Container - Container name to export to. 303 Container *string `json:"container,omitempty"` 304} 305 306// FirewallRule a firewall rule on a redis cache has a name, and describes a contiguous range of IP 307// addresses permitted to connect 308type FirewallRule struct { 309 autorest.Response `json:"-"` 310 // FirewallRuleProperties - redis cache firewall rule properties 311 *FirewallRuleProperties `json:"properties,omitempty"` 312 // ID - READ-ONLY; Resource ID. 313 ID *string `json:"id,omitempty"` 314 // Name - READ-ONLY; Resource name. 315 Name *string `json:"name,omitempty"` 316 // Type - READ-ONLY; Resource type. 317 Type *string `json:"type,omitempty"` 318} 319 320// MarshalJSON is the custom marshaler for FirewallRule. 321func (fr FirewallRule) MarshalJSON() ([]byte, error) { 322 objectMap := make(map[string]interface{}) 323 if fr.FirewallRuleProperties != nil { 324 objectMap["properties"] = fr.FirewallRuleProperties 325 } 326 return json.Marshal(objectMap) 327} 328 329// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. 330func (fr *FirewallRule) UnmarshalJSON(body []byte) error { 331 var m map[string]*json.RawMessage 332 err := json.Unmarshal(body, &m) 333 if err != nil { 334 return err 335 } 336 for k, v := range m { 337 switch k { 338 case "properties": 339 if v != nil { 340 var firewallRuleProperties FirewallRuleProperties 341 err = json.Unmarshal(*v, &firewallRuleProperties) 342 if err != nil { 343 return err 344 } 345 fr.FirewallRuleProperties = &firewallRuleProperties 346 } 347 case "id": 348 if v != nil { 349 var ID string 350 err = json.Unmarshal(*v, &ID) 351 if err != nil { 352 return err 353 } 354 fr.ID = &ID 355 } 356 case "name": 357 if v != nil { 358 var name string 359 err = json.Unmarshal(*v, &name) 360 if err != nil { 361 return err 362 } 363 fr.Name = &name 364 } 365 case "type": 366 if v != nil { 367 var typeVar string 368 err = json.Unmarshal(*v, &typeVar) 369 if err != nil { 370 return err 371 } 372 fr.Type = &typeVar 373 } 374 } 375 } 376 377 return nil 378} 379 380// FirewallRuleListResult the response of list firewall rules Redis operation. 381type FirewallRuleListResult struct { 382 autorest.Response `json:"-"` 383 // Value - Results of the list firewall rules operation. 384 Value *[]FirewallRule `json:"value,omitempty"` 385 // NextLink - READ-ONLY; Link for next set of locations. 386 NextLink *string `json:"nextLink,omitempty"` 387} 388 389// MarshalJSON is the custom marshaler for FirewallRuleListResult. 390func (frlr FirewallRuleListResult) MarshalJSON() ([]byte, error) { 391 objectMap := make(map[string]interface{}) 392 if frlr.Value != nil { 393 objectMap["value"] = frlr.Value 394 } 395 return json.Marshal(objectMap) 396} 397 398// FirewallRuleListResultIterator provides access to a complete listing of FirewallRule values. 399type FirewallRuleListResultIterator struct { 400 i int 401 page FirewallRuleListResultPage 402} 403 404// NextWithContext advances to the next value. If there was an error making 405// the request the iterator does not advance and the error is returned. 406func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { 407 if tracing.IsEnabled() { 408 ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext") 409 defer func() { 410 sc := -1 411 if iter.Response().Response.Response != nil { 412 sc = iter.Response().Response.Response.StatusCode 413 } 414 tracing.EndSpan(ctx, sc, err) 415 }() 416 } 417 iter.i++ 418 if iter.i < len(iter.page.Values()) { 419 return nil 420 } 421 err = iter.page.NextWithContext(ctx) 422 if err != nil { 423 iter.i-- 424 return err 425 } 426 iter.i = 0 427 return nil 428} 429 430// Next advances to the next value. If there was an error making 431// the request the iterator does not advance and the error is returned. 432// Deprecated: Use NextWithContext() instead. 433func (iter *FirewallRuleListResultIterator) Next() error { 434 return iter.NextWithContext(context.Background()) 435} 436 437// NotDone returns true if the enumeration should be started or is not yet complete. 438func (iter FirewallRuleListResultIterator) NotDone() bool { 439 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 440} 441 442// Response returns the raw server response from the last page request. 443func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult { 444 return iter.page.Response() 445} 446 447// Value returns the current value or a zero-initialized value if the 448// iterator has advanced beyond the end of the collection. 449func (iter FirewallRuleListResultIterator) Value() FirewallRule { 450 if !iter.page.NotDone() { 451 return FirewallRule{} 452 } 453 return iter.page.Values()[iter.i] 454} 455 456// Creates a new instance of the FirewallRuleListResultIterator type. 457func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator { 458 return FirewallRuleListResultIterator{page: page} 459} 460 461// IsEmpty returns true if the ListResult contains no values. 462func (frlr FirewallRuleListResult) IsEmpty() bool { 463 return frlr.Value == nil || len(*frlr.Value) == 0 464} 465 466// hasNextLink returns true if the NextLink is not empty. 467func (frlr FirewallRuleListResult) hasNextLink() bool { 468 return frlr.NextLink != nil && len(*frlr.NextLink) != 0 469} 470 471// firewallRuleListResultPreparer prepares a request to retrieve the next set of results. 472// It returns nil if no more results exist. 473func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) { 474 if !frlr.hasNextLink() { 475 return nil, nil 476 } 477 return autorest.Prepare((&http.Request{}).WithContext(ctx), 478 autorest.AsJSON(), 479 autorest.AsGet(), 480 autorest.WithBaseURL(to.String(frlr.NextLink))) 481} 482 483// FirewallRuleListResultPage contains a page of FirewallRule values. 484type FirewallRuleListResultPage struct { 485 fn func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error) 486 frlr FirewallRuleListResult 487} 488 489// NextWithContext advances to the next page of values. If there was an error making 490// the request the page does not advance and the error is returned. 491func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) { 492 if tracing.IsEnabled() { 493 ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext") 494 defer func() { 495 sc := -1 496 if page.Response().Response.Response != nil { 497 sc = page.Response().Response.Response.StatusCode 498 } 499 tracing.EndSpan(ctx, sc, err) 500 }() 501 } 502 for { 503 next, err := page.fn(ctx, page.frlr) 504 if err != nil { 505 return err 506 } 507 page.frlr = next 508 if !next.hasNextLink() || !next.IsEmpty() { 509 break 510 } 511 } 512 return nil 513} 514 515// Next advances to the next page of values. If there was an error making 516// the request the page does not advance and the error is returned. 517// Deprecated: Use NextWithContext() instead. 518func (page *FirewallRuleListResultPage) Next() error { 519 return page.NextWithContext(context.Background()) 520} 521 522// NotDone returns true if the page enumeration should be started or is not yet complete. 523func (page FirewallRuleListResultPage) NotDone() bool { 524 return !page.frlr.IsEmpty() 525} 526 527// Response returns the raw server response from the last page request. 528func (page FirewallRuleListResultPage) Response() FirewallRuleListResult { 529 return page.frlr 530} 531 532// Values returns the slice of values for the current page or nil if there are no values. 533func (page FirewallRuleListResultPage) Values() []FirewallRule { 534 if page.frlr.IsEmpty() { 535 return nil 536 } 537 return *page.frlr.Value 538} 539 540// Creates a new instance of the FirewallRuleListResultPage type. 541func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage { 542 return FirewallRuleListResultPage{ 543 fn: getNextPage, 544 frlr: cur, 545 } 546} 547 548// FirewallRuleProperties specifies a range of IP addresses permitted to connect to the cache 549type FirewallRuleProperties struct { 550 // StartIP - lowest IP address included in the range 551 StartIP *string `json:"startIP,omitempty"` 552 // EndIP - highest IP address included in the range 553 EndIP *string `json:"endIP,omitempty"` 554} 555 556// ForceRebootResponse response to force reboot for Redis cache. 557type ForceRebootResponse struct { 558 autorest.Response `json:"-"` 559 // Message - READ-ONLY; Status message 560 Message *string `json:"Message,omitempty"` 561} 562 563// MarshalJSON is the custom marshaler for ForceRebootResponse. 564func (frr ForceRebootResponse) MarshalJSON() ([]byte, error) { 565 objectMap := make(map[string]interface{}) 566 return json.Marshal(objectMap) 567} 568 569// ImportDataFuture an abstraction for monitoring and retrieving the results of a long-running operation. 570type ImportDataFuture struct { 571 azure.FutureAPI 572 // Result returns the result of the asynchronous operation. 573 // If the operation has not completed it will return an error. 574 Result func(Client) (autorest.Response, error) 575} 576 577// UnmarshalJSON is the custom unmarshaller for CreateFuture. 578func (future *ImportDataFuture) UnmarshalJSON(body []byte) error { 579 var azFuture azure.Future 580 if err := json.Unmarshal(body, &azFuture); err != nil { 581 return err 582 } 583 future.FutureAPI = &azFuture 584 future.Result = future.result 585 return nil 586} 587 588// result is the default implementation for ImportDataFuture.Result. 589func (future *ImportDataFuture) result(client Client) (ar autorest.Response, err error) { 590 var done bool 591 done, err = future.DoneWithContext(context.Background(), client) 592 if err != nil { 593 err = autorest.NewErrorWithError(err, "redis.ImportDataFuture", "Result", future.Response(), "Polling failure") 594 return 595 } 596 if !done { 597 ar.Response = future.Response() 598 err = azure.NewAsyncOpIncompleteError("redis.ImportDataFuture") 599 return 600 } 601 ar.Response = future.Response() 602 return 603} 604 605// ImportRDBParameters parameters for Redis import operation. 606type ImportRDBParameters struct { 607 // Format - File format. 608 Format *string `json:"format,omitempty"` 609 // Files - files to import. 610 Files *[]string `json:"files,omitempty"` 611} 612 613// LinkedServer linked server Id 614type LinkedServer struct { 615 // ID - READ-ONLY; Linked server Id. 616 ID *string `json:"id,omitempty"` 617} 618 619// MarshalJSON is the custom marshaler for LinkedServer. 620func (ls LinkedServer) MarshalJSON() ([]byte, error) { 621 objectMap := make(map[string]interface{}) 622 return json.Marshal(objectMap) 623} 624 625// LinkedServerCreateFuture an abstraction for monitoring and retrieving the results of a long-running 626// operation. 627type LinkedServerCreateFuture struct { 628 azure.FutureAPI 629 // Result returns the result of the asynchronous operation. 630 // If the operation has not completed it will return an error. 631 Result func(LinkedServerClient) (LinkedServerWithProperties, error) 632} 633 634// UnmarshalJSON is the custom unmarshaller for CreateFuture. 635func (future *LinkedServerCreateFuture) UnmarshalJSON(body []byte) error { 636 var azFuture azure.Future 637 if err := json.Unmarshal(body, &azFuture); err != nil { 638 return err 639 } 640 future.FutureAPI = &azFuture 641 future.Result = future.result 642 return nil 643} 644 645// result is the default implementation for LinkedServerCreateFuture.Result. 646func (future *LinkedServerCreateFuture) result(client LinkedServerClient) (lswp LinkedServerWithProperties, err error) { 647 var done bool 648 done, err = future.DoneWithContext(context.Background(), client) 649 if err != nil { 650 err = autorest.NewErrorWithError(err, "redis.LinkedServerCreateFuture", "Result", future.Response(), "Polling failure") 651 return 652 } 653 if !done { 654 lswp.Response.Response = future.Response() 655 err = azure.NewAsyncOpIncompleteError("redis.LinkedServerCreateFuture") 656 return 657 } 658 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 659 if lswp.Response.Response, err = future.GetResult(sender); err == nil && lswp.Response.Response.StatusCode != http.StatusNoContent { 660 lswp, err = client.CreateResponder(lswp.Response.Response) 661 if err != nil { 662 err = autorest.NewErrorWithError(err, "redis.LinkedServerCreateFuture", "Result", lswp.Response.Response, "Failure responding to request") 663 } 664 } 665 return 666} 667 668// LinkedServerCreateParameters parameter required for creating a linked server to redis cache. 669type LinkedServerCreateParameters struct { 670 // LinkedServerCreateProperties - Properties required to create a linked server. 671 *LinkedServerCreateProperties `json:"properties,omitempty"` 672} 673 674// MarshalJSON is the custom marshaler for LinkedServerCreateParameters. 675func (lscp LinkedServerCreateParameters) MarshalJSON() ([]byte, error) { 676 objectMap := make(map[string]interface{}) 677 if lscp.LinkedServerCreateProperties != nil { 678 objectMap["properties"] = lscp.LinkedServerCreateProperties 679 } 680 return json.Marshal(objectMap) 681} 682 683// UnmarshalJSON is the custom unmarshaler for LinkedServerCreateParameters struct. 684func (lscp *LinkedServerCreateParameters) UnmarshalJSON(body []byte) error { 685 var m map[string]*json.RawMessage 686 err := json.Unmarshal(body, &m) 687 if err != nil { 688 return err 689 } 690 for k, v := range m { 691 switch k { 692 case "properties": 693 if v != nil { 694 var linkedServerCreateProperties LinkedServerCreateProperties 695 err = json.Unmarshal(*v, &linkedServerCreateProperties) 696 if err != nil { 697 return err 698 } 699 lscp.LinkedServerCreateProperties = &linkedServerCreateProperties 700 } 701 } 702 } 703 704 return nil 705} 706 707// LinkedServerCreateProperties create properties for a linked server 708type LinkedServerCreateProperties struct { 709 // LinkedRedisCacheID - Fully qualified resourceId of the linked redis cache. 710 LinkedRedisCacheID *string `json:"linkedRedisCacheId,omitempty"` 711 // LinkedRedisCacheLocation - Location of the linked redis cache. 712 LinkedRedisCacheLocation *string `json:"linkedRedisCacheLocation,omitempty"` 713 // ServerRole - Role of the linked server. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary' 714 ServerRole ReplicationRole `json:"serverRole,omitempty"` 715} 716 717// LinkedServerList list of linked server Ids of a Redis cache. 718type LinkedServerList struct { 719 // Value - List of linked server Ids of a Redis cache. 720 Value *[]LinkedServer `json:"value,omitempty"` 721} 722 723// LinkedServerProperties properties of a linked server to be returned in get/put response 724type LinkedServerProperties struct { 725 // ProvisioningState - READ-ONLY; Terminal state of the link between primary and secondary redis cache. 726 ProvisioningState *string `json:"provisioningState,omitempty"` 727 // LinkedRedisCacheID - Fully qualified resourceId of the linked redis cache. 728 LinkedRedisCacheID *string `json:"linkedRedisCacheId,omitempty"` 729 // LinkedRedisCacheLocation - Location of the linked redis cache. 730 LinkedRedisCacheLocation *string `json:"linkedRedisCacheLocation,omitempty"` 731 // ServerRole - Role of the linked server. Possible values include: 'ReplicationRolePrimary', 'ReplicationRoleSecondary' 732 ServerRole ReplicationRole `json:"serverRole,omitempty"` 733} 734 735// MarshalJSON is the custom marshaler for LinkedServerProperties. 736func (lsp LinkedServerProperties) MarshalJSON() ([]byte, error) { 737 objectMap := make(map[string]interface{}) 738 if lsp.LinkedRedisCacheID != nil { 739 objectMap["linkedRedisCacheId"] = lsp.LinkedRedisCacheID 740 } 741 if lsp.LinkedRedisCacheLocation != nil { 742 objectMap["linkedRedisCacheLocation"] = lsp.LinkedRedisCacheLocation 743 } 744 if lsp.ServerRole != "" { 745 objectMap["serverRole"] = lsp.ServerRole 746 } 747 return json.Marshal(objectMap) 748} 749 750// LinkedServerWithProperties response to put/get linked server (with properties) for Redis cache. 751type LinkedServerWithProperties struct { 752 autorest.Response `json:"-"` 753 // ID - READ-ONLY; Resource ID. 754 ID *string `json:"id,omitempty"` 755 // Name - READ-ONLY; Resource name. 756 Name *string `json:"name,omitempty"` 757 // Type - READ-ONLY; Resource type. 758 Type *string `json:"type,omitempty"` 759 // LinkedServerProperties - Properties of the linked server. 760 *LinkedServerProperties `json:"properties,omitempty"` 761} 762 763// MarshalJSON is the custom marshaler for LinkedServerWithProperties. 764func (lswp LinkedServerWithProperties) MarshalJSON() ([]byte, error) { 765 objectMap := make(map[string]interface{}) 766 if lswp.LinkedServerProperties != nil { 767 objectMap["properties"] = lswp.LinkedServerProperties 768 } 769 return json.Marshal(objectMap) 770} 771 772// UnmarshalJSON is the custom unmarshaler for LinkedServerWithProperties struct. 773func (lswp *LinkedServerWithProperties) UnmarshalJSON(body []byte) error { 774 var m map[string]*json.RawMessage 775 err := json.Unmarshal(body, &m) 776 if err != nil { 777 return err 778 } 779 for k, v := range m { 780 switch k { 781 case "id": 782 if v != nil { 783 var ID string 784 err = json.Unmarshal(*v, &ID) 785 if err != nil { 786 return err 787 } 788 lswp.ID = &ID 789 } 790 case "name": 791 if v != nil { 792 var name string 793 err = json.Unmarshal(*v, &name) 794 if err != nil { 795 return err 796 } 797 lswp.Name = &name 798 } 799 case "type": 800 if v != nil { 801 var typeVar string 802 err = json.Unmarshal(*v, &typeVar) 803 if err != nil { 804 return err 805 } 806 lswp.Type = &typeVar 807 } 808 case "properties": 809 if v != nil { 810 var linkedServerProperties LinkedServerProperties 811 err = json.Unmarshal(*v, &linkedServerProperties) 812 if err != nil { 813 return err 814 } 815 lswp.LinkedServerProperties = &linkedServerProperties 816 } 817 } 818 } 819 820 return nil 821} 822 823// LinkedServerWithPropertiesList list of linked servers (with properties) of a Redis cache. 824type LinkedServerWithPropertiesList struct { 825 autorest.Response `json:"-"` 826 // Value - List of linked servers (with properties) of a Redis cache. 827 Value *[]LinkedServerWithProperties `json:"value,omitempty"` 828} 829 830// ListResult the response of list Redis operation. 831type ListResult struct { 832 autorest.Response `json:"-"` 833 // Value - List of Redis cache instances. 834 Value *[]ResourceType `json:"value,omitempty"` 835 // NextLink - READ-ONLY; Link for next set of locations. 836 NextLink *string `json:"nextLink,omitempty"` 837} 838 839// MarshalJSON is the custom marshaler for ListResult. 840func (lr ListResult) MarshalJSON() ([]byte, error) { 841 objectMap := make(map[string]interface{}) 842 if lr.Value != nil { 843 objectMap["value"] = lr.Value 844 } 845 return json.Marshal(objectMap) 846} 847 848// ListResultIterator provides access to a complete listing of ResourceType values. 849type ListResultIterator struct { 850 i int 851 page ListResultPage 852} 853 854// NextWithContext advances to the next value. If there was an error making 855// the request the iterator does not advance and the error is returned. 856func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { 857 if tracing.IsEnabled() { 858 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") 859 defer func() { 860 sc := -1 861 if iter.Response().Response.Response != nil { 862 sc = iter.Response().Response.Response.StatusCode 863 } 864 tracing.EndSpan(ctx, sc, err) 865 }() 866 } 867 iter.i++ 868 if iter.i < len(iter.page.Values()) { 869 return nil 870 } 871 err = iter.page.NextWithContext(ctx) 872 if err != nil { 873 iter.i-- 874 return err 875 } 876 iter.i = 0 877 return nil 878} 879 880// Next advances to the next value. If there was an error making 881// the request the iterator does not advance and the error is returned. 882// Deprecated: Use NextWithContext() instead. 883func (iter *ListResultIterator) Next() error { 884 return iter.NextWithContext(context.Background()) 885} 886 887// NotDone returns true if the enumeration should be started or is not yet complete. 888func (iter ListResultIterator) NotDone() bool { 889 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 890} 891 892// Response returns the raw server response from the last page request. 893func (iter ListResultIterator) Response() ListResult { 894 return iter.page.Response() 895} 896 897// Value returns the current value or a zero-initialized value if the 898// iterator has advanced beyond the end of the collection. 899func (iter ListResultIterator) Value() ResourceType { 900 if !iter.page.NotDone() { 901 return ResourceType{} 902 } 903 return iter.page.Values()[iter.i] 904} 905 906// Creates a new instance of the ListResultIterator type. 907func NewListResultIterator(page ListResultPage) ListResultIterator { 908 return ListResultIterator{page: page} 909} 910 911// IsEmpty returns true if the ListResult contains no values. 912func (lr ListResult) IsEmpty() bool { 913 return lr.Value == nil || len(*lr.Value) == 0 914} 915 916// hasNextLink returns true if the NextLink is not empty. 917func (lr ListResult) hasNextLink() bool { 918 return lr.NextLink != nil && len(*lr.NextLink) != 0 919} 920 921// listResultPreparer prepares a request to retrieve the next set of results. 922// It returns nil if no more results exist. 923func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { 924 if !lr.hasNextLink() { 925 return nil, nil 926 } 927 return autorest.Prepare((&http.Request{}).WithContext(ctx), 928 autorest.AsJSON(), 929 autorest.AsGet(), 930 autorest.WithBaseURL(to.String(lr.NextLink))) 931} 932 933// ListResultPage contains a page of ResourceType values. 934type ListResultPage struct { 935 fn func(context.Context, ListResult) (ListResult, error) 936 lr ListResult 937} 938 939// NextWithContext advances to the next page of values. If there was an error making 940// the request the page does not advance and the error is returned. 941func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { 942 if tracing.IsEnabled() { 943 ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") 944 defer func() { 945 sc := -1 946 if page.Response().Response.Response != nil { 947 sc = page.Response().Response.Response.StatusCode 948 } 949 tracing.EndSpan(ctx, sc, err) 950 }() 951 } 952 for { 953 next, err := page.fn(ctx, page.lr) 954 if err != nil { 955 return err 956 } 957 page.lr = next 958 if !next.hasNextLink() || !next.IsEmpty() { 959 break 960 } 961 } 962 return nil 963} 964 965// Next advances to the next page of values. If there was an error making 966// the request the page does not advance and the error is returned. 967// Deprecated: Use NextWithContext() instead. 968func (page *ListResultPage) Next() error { 969 return page.NextWithContext(context.Background()) 970} 971 972// NotDone returns true if the page enumeration should be started or is not yet complete. 973func (page ListResultPage) NotDone() bool { 974 return !page.lr.IsEmpty() 975} 976 977// Response returns the raw server response from the last page request. 978func (page ListResultPage) Response() ListResult { 979 return page.lr 980} 981 982// Values returns the slice of values for the current page or nil if there are no values. 983func (page ListResultPage) Values() []ResourceType { 984 if page.lr.IsEmpty() { 985 return nil 986 } 987 return *page.lr.Value 988} 989 990// Creates a new instance of the ListResultPage type. 991func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { 992 return ListResultPage{ 993 fn: getNextPage, 994 lr: cur, 995 } 996} 997 998// Operation REST API operation 999type Operation struct { 1000 // Name - Operation name: {provider}/{resource}/{operation} 1001 Name *string `json:"name,omitempty"` 1002 // Display - The object that describes the operation. 1003 Display *OperationDisplay `json:"display,omitempty"` 1004} 1005 1006// OperationDisplay the object that describes the operation. 1007type OperationDisplay struct { 1008 // Provider - Friendly name of the resource provider 1009 Provider *string `json:"provider,omitempty"` 1010 // Operation - Operation type: read, write, delete, listKeys/action, etc. 1011 Operation *string `json:"operation,omitempty"` 1012 // Resource - Resource type on which the operation is performed. 1013 Resource *string `json:"resource,omitempty"` 1014 // Description - Friendly name of the operation 1015 Description *string `json:"description,omitempty"` 1016} 1017 1018// OperationListResult result of the request to list REST API operations. It contains a list of operations 1019// and a URL nextLink to get the next set of results. 1020type OperationListResult struct { 1021 autorest.Response `json:"-"` 1022 // Value - List of operations supported by the resource provider. 1023 Value *[]Operation `json:"value,omitempty"` 1024 // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. 1025 NextLink *string `json:"nextLink,omitempty"` 1026} 1027 1028// MarshalJSON is the custom marshaler for OperationListResult. 1029func (olr OperationListResult) MarshalJSON() ([]byte, error) { 1030 objectMap := make(map[string]interface{}) 1031 if olr.Value != nil { 1032 objectMap["value"] = olr.Value 1033 } 1034 return json.Marshal(objectMap) 1035} 1036 1037// OperationListResultIterator provides access to a complete listing of Operation values. 1038type OperationListResultIterator struct { 1039 i int 1040 page OperationListResultPage 1041} 1042 1043// NextWithContext advances to the next value. If there was an error making 1044// the request the iterator does not advance and the error is returned. 1045func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1046 if tracing.IsEnabled() { 1047 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1048 defer func() { 1049 sc := -1 1050 if iter.Response().Response.Response != nil { 1051 sc = iter.Response().Response.Response.StatusCode 1052 } 1053 tracing.EndSpan(ctx, sc, err) 1054 }() 1055 } 1056 iter.i++ 1057 if iter.i < len(iter.page.Values()) { 1058 return nil 1059 } 1060 err = iter.page.NextWithContext(ctx) 1061 if err != nil { 1062 iter.i-- 1063 return err 1064 } 1065 iter.i = 0 1066 return nil 1067} 1068 1069// Next advances to the next value. If there was an error making 1070// the request the iterator does not advance and the error is returned. 1071// Deprecated: Use NextWithContext() instead. 1072func (iter *OperationListResultIterator) Next() error { 1073 return iter.NextWithContext(context.Background()) 1074} 1075 1076// NotDone returns true if the enumeration should be started or is not yet complete. 1077func (iter OperationListResultIterator) NotDone() bool { 1078 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1079} 1080 1081// Response returns the raw server response from the last page request. 1082func (iter OperationListResultIterator) Response() OperationListResult { 1083 return iter.page.Response() 1084} 1085 1086// Value returns the current value or a zero-initialized value if the 1087// iterator has advanced beyond the end of the collection. 1088func (iter OperationListResultIterator) Value() Operation { 1089 if !iter.page.NotDone() { 1090 return Operation{} 1091 } 1092 return iter.page.Values()[iter.i] 1093} 1094 1095// Creates a new instance of the OperationListResultIterator type. 1096func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1097 return OperationListResultIterator{page: page} 1098} 1099 1100// IsEmpty returns true if the ListResult contains no values. 1101func (olr OperationListResult) IsEmpty() bool { 1102 return olr.Value == nil || len(*olr.Value) == 0 1103} 1104 1105// hasNextLink returns true if the NextLink is not empty. 1106func (olr OperationListResult) hasNextLink() bool { 1107 return olr.NextLink != nil && len(*olr.NextLink) != 0 1108} 1109 1110// operationListResultPreparer prepares a request to retrieve the next set of results. 1111// It returns nil if no more results exist. 1112func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1113 if !olr.hasNextLink() { 1114 return nil, nil 1115 } 1116 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1117 autorest.AsJSON(), 1118 autorest.AsGet(), 1119 autorest.WithBaseURL(to.String(olr.NextLink))) 1120} 1121 1122// OperationListResultPage contains a page of Operation values. 1123type OperationListResultPage struct { 1124 fn func(context.Context, OperationListResult) (OperationListResult, error) 1125 olr OperationListResult 1126} 1127 1128// NextWithContext advances to the next page of values. If there was an error making 1129// the request the page does not advance and the error is returned. 1130func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1131 if tracing.IsEnabled() { 1132 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1133 defer func() { 1134 sc := -1 1135 if page.Response().Response.Response != nil { 1136 sc = page.Response().Response.Response.StatusCode 1137 } 1138 tracing.EndSpan(ctx, sc, err) 1139 }() 1140 } 1141 for { 1142 next, err := page.fn(ctx, page.olr) 1143 if err != nil { 1144 return err 1145 } 1146 page.olr = next 1147 if !next.hasNextLink() || !next.IsEmpty() { 1148 break 1149 } 1150 } 1151 return nil 1152} 1153 1154// Next advances to the next page of values. If there was an error making 1155// the request the page does not advance and the error is returned. 1156// Deprecated: Use NextWithContext() instead. 1157func (page *OperationListResultPage) Next() error { 1158 return page.NextWithContext(context.Background()) 1159} 1160 1161// NotDone returns true if the page enumeration should be started or is not yet complete. 1162func (page OperationListResultPage) NotDone() bool { 1163 return !page.olr.IsEmpty() 1164} 1165 1166// Response returns the raw server response from the last page request. 1167func (page OperationListResultPage) Response() OperationListResult { 1168 return page.olr 1169} 1170 1171// Values returns the slice of values for the current page or nil if there are no values. 1172func (page OperationListResultPage) Values() []Operation { 1173 if page.olr.IsEmpty() { 1174 return nil 1175 } 1176 return *page.olr.Value 1177} 1178 1179// Creates a new instance of the OperationListResultPage type. 1180func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1181 return OperationListResultPage{ 1182 fn: getNextPage, 1183 olr: cur, 1184 } 1185} 1186 1187// PatchSchedule response to put/get patch schedules for Redis cache. 1188type PatchSchedule struct { 1189 autorest.Response `json:"-"` 1190 // ID - READ-ONLY; Resource ID. 1191 ID *string `json:"id,omitempty"` 1192 // Name - READ-ONLY; Resource name. 1193 Name *string `json:"name,omitempty"` 1194 // Type - READ-ONLY; Resource type. 1195 Type *string `json:"type,omitempty"` 1196 // Location - READ-ONLY; Resource location. 1197 Location *string `json:"location,omitempty"` 1198 // ScheduleEntries - List of patch schedules for a Redis cache. 1199 *ScheduleEntries `json:"properties,omitempty"` 1200} 1201 1202// MarshalJSON is the custom marshaler for PatchSchedule. 1203func (ps PatchSchedule) MarshalJSON() ([]byte, error) { 1204 objectMap := make(map[string]interface{}) 1205 if ps.ScheduleEntries != nil { 1206 objectMap["properties"] = ps.ScheduleEntries 1207 } 1208 return json.Marshal(objectMap) 1209} 1210 1211// UnmarshalJSON is the custom unmarshaler for PatchSchedule struct. 1212func (ps *PatchSchedule) UnmarshalJSON(body []byte) error { 1213 var m map[string]*json.RawMessage 1214 err := json.Unmarshal(body, &m) 1215 if err != nil { 1216 return err 1217 } 1218 for k, v := range m { 1219 switch k { 1220 case "id": 1221 if v != nil { 1222 var ID string 1223 err = json.Unmarshal(*v, &ID) 1224 if err != nil { 1225 return err 1226 } 1227 ps.ID = &ID 1228 } 1229 case "name": 1230 if v != nil { 1231 var name string 1232 err = json.Unmarshal(*v, &name) 1233 if err != nil { 1234 return err 1235 } 1236 ps.Name = &name 1237 } 1238 case "type": 1239 if v != nil { 1240 var typeVar string 1241 err = json.Unmarshal(*v, &typeVar) 1242 if err != nil { 1243 return err 1244 } 1245 ps.Type = &typeVar 1246 } 1247 case "location": 1248 if v != nil { 1249 var location string 1250 err = json.Unmarshal(*v, &location) 1251 if err != nil { 1252 return err 1253 } 1254 ps.Location = &location 1255 } 1256 case "properties": 1257 if v != nil { 1258 var scheduleEntries ScheduleEntries 1259 err = json.Unmarshal(*v, &scheduleEntries) 1260 if err != nil { 1261 return err 1262 } 1263 ps.ScheduleEntries = &scheduleEntries 1264 } 1265 } 1266 } 1267 1268 return nil 1269} 1270 1271// Properties properties supplied to Create or Update Redis operation. 1272type Properties struct { 1273 // RedisConfiguration - All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. 1274 RedisConfiguration map[string]*string `json:"redisConfiguration"` 1275 // EnableNonSslPort - Specifies whether the non-ssl Redis server port (6379) is enabled. 1276 EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` 1277 // TenantSettings - tenantSettings 1278 TenantSettings map[string]*string `json:"tenantSettings"` 1279 // ShardCount - The number of shards to be created on a Premium Cluster Cache. 1280 ShardCount *int32 `json:"shardCount,omitempty"` 1281 // SubnetID - The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 1282 SubnetID *string `json:"subnetId,omitempty"` 1283 // StaticIP - Static IP address. Required when deploying a Redis cache inside an existing Azure Virtual Network. 1284 StaticIP *string `json:"staticIP,omitempty"` 1285} 1286 1287// MarshalJSON is the custom marshaler for Properties. 1288func (p Properties) MarshalJSON() ([]byte, error) { 1289 objectMap := make(map[string]interface{}) 1290 if p.RedisConfiguration != nil { 1291 objectMap["redisConfiguration"] = p.RedisConfiguration 1292 } 1293 if p.EnableNonSslPort != nil { 1294 objectMap["enableNonSslPort"] = p.EnableNonSslPort 1295 } 1296 if p.TenantSettings != nil { 1297 objectMap["tenantSettings"] = p.TenantSettings 1298 } 1299 if p.ShardCount != nil { 1300 objectMap["shardCount"] = p.ShardCount 1301 } 1302 if p.SubnetID != nil { 1303 objectMap["subnetId"] = p.SubnetID 1304 } 1305 if p.StaticIP != nil { 1306 objectMap["staticIP"] = p.StaticIP 1307 } 1308 return json.Marshal(objectMap) 1309} 1310 1311// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than 1312// required location and tags 1313type ProxyResource struct { 1314 // ID - READ-ONLY; Resource ID. 1315 ID *string `json:"id,omitempty"` 1316 // Name - READ-ONLY; Resource name. 1317 Name *string `json:"name,omitempty"` 1318 // Type - READ-ONLY; Resource type. 1319 Type *string `json:"type,omitempty"` 1320} 1321 1322// MarshalJSON is the custom marshaler for ProxyResource. 1323func (pr ProxyResource) MarshalJSON() ([]byte, error) { 1324 objectMap := make(map[string]interface{}) 1325 return json.Marshal(objectMap) 1326} 1327 1328// RebootParameters specifies which Redis node(s) to reboot. 1329type RebootParameters struct { 1330 // RebootType - Which Redis node(s) to reboot. Depending on this value data loss is possible. Possible values include: 'PrimaryNode', 'SecondaryNode', 'AllNodes' 1331 RebootType RebootType `json:"rebootType,omitempty"` 1332 // ShardID - If clustering is enabled, the ID of the shard to be rebooted. 1333 ShardID *int32 `json:"shardId,omitempty"` 1334} 1335 1336// RegenerateKeyParameters specifies which Redis access keys to reset. 1337type RegenerateKeyParameters struct { 1338 // KeyType - The Redis access key to regenerate. Possible values include: 'Primary', 'Secondary' 1339 KeyType KeyType `json:"keyType,omitempty"` 1340} 1341 1342// Resource the Resource definition. 1343type Resource struct { 1344 // ID - READ-ONLY; Resource ID. 1345 ID *string `json:"id,omitempty"` 1346 // Name - READ-ONLY; Resource name. 1347 Name *string `json:"name,omitempty"` 1348 // Type - READ-ONLY; Resource type. 1349 Type *string `json:"type,omitempty"` 1350} 1351 1352// MarshalJSON is the custom marshaler for Resource. 1353func (r Resource) MarshalJSON() ([]byte, error) { 1354 objectMap := make(map[string]interface{}) 1355 return json.Marshal(objectMap) 1356} 1357 1358// ResourceProperties parameters describing a Redis instance. 1359type ResourceProperties struct { 1360 // Sku - The SKU of the Redis cache to deploy. 1361 Sku *Sku `json:"sku,omitempty"` 1362 // RedisVersion - READ-ONLY; Redis version. 1363 RedisVersion *string `json:"redisVersion,omitempty"` 1364 // ProvisioningState - READ-ONLY; Redis instance provisioning status. 1365 ProvisioningState *string `json:"provisioningState,omitempty"` 1366 // HostName - READ-ONLY; Redis host name. 1367 HostName *string `json:"hostName,omitempty"` 1368 // Port - READ-ONLY; Redis non-SSL port. 1369 Port *int32 `json:"port,omitempty"` 1370 // SslPort - READ-ONLY; Redis SSL port. 1371 SslPort *int32 `json:"sslPort,omitempty"` 1372 // AccessKeys - READ-ONLY; The keys of the Redis cache - not set if this object is not the response to Create or Update redis cache 1373 AccessKeys *AccessKeys `json:"accessKeys,omitempty"` 1374 // LinkedServers - READ-ONLY; List of the linked servers associated with the cache 1375 LinkedServers *LinkedServerList `json:"linkedServers,omitempty"` 1376 // RedisConfiguration - All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. 1377 RedisConfiguration map[string]*string `json:"redisConfiguration"` 1378 // EnableNonSslPort - Specifies whether the non-ssl Redis server port (6379) is enabled. 1379 EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` 1380 // TenantSettings - tenantSettings 1381 TenantSettings map[string]*string `json:"tenantSettings"` 1382 // ShardCount - The number of shards to be created on a Premium Cluster Cache. 1383 ShardCount *int32 `json:"shardCount,omitempty"` 1384 // SubnetID - The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 1385 SubnetID *string `json:"subnetId,omitempty"` 1386 // StaticIP - Static IP address. Required when deploying a Redis cache inside an existing Azure Virtual Network. 1387 StaticIP *string `json:"staticIP,omitempty"` 1388} 1389 1390// MarshalJSON is the custom marshaler for ResourceProperties. 1391func (rp ResourceProperties) MarshalJSON() ([]byte, error) { 1392 objectMap := make(map[string]interface{}) 1393 if rp.Sku != nil { 1394 objectMap["sku"] = rp.Sku 1395 } 1396 if rp.RedisConfiguration != nil { 1397 objectMap["redisConfiguration"] = rp.RedisConfiguration 1398 } 1399 if rp.EnableNonSslPort != nil { 1400 objectMap["enableNonSslPort"] = rp.EnableNonSslPort 1401 } 1402 if rp.TenantSettings != nil { 1403 objectMap["tenantSettings"] = rp.TenantSettings 1404 } 1405 if rp.ShardCount != nil { 1406 objectMap["shardCount"] = rp.ShardCount 1407 } 1408 if rp.SubnetID != nil { 1409 objectMap["subnetId"] = rp.SubnetID 1410 } 1411 if rp.StaticIP != nil { 1412 objectMap["staticIP"] = rp.StaticIP 1413 } 1414 return json.Marshal(objectMap) 1415} 1416 1417// ResourceType a single Redis item in List or Get Operation. 1418type ResourceType struct { 1419 autorest.Response `json:"-"` 1420 // ResourceProperties - Redis cache properties. 1421 *ResourceProperties `json:"properties,omitempty"` 1422 // Tags - Resource tags. 1423 Tags map[string]*string `json:"tags"` 1424 // Location - The geo-location where the resource lives 1425 Location *string `json:"location,omitempty"` 1426 // ID - READ-ONLY; Resource ID. 1427 ID *string `json:"id,omitempty"` 1428 // Name - READ-ONLY; Resource name. 1429 Name *string `json:"name,omitempty"` 1430 // Type - READ-ONLY; Resource type. 1431 Type *string `json:"type,omitempty"` 1432} 1433 1434// MarshalJSON is the custom marshaler for ResourceType. 1435func (rt ResourceType) MarshalJSON() ([]byte, error) { 1436 objectMap := make(map[string]interface{}) 1437 if rt.ResourceProperties != nil { 1438 objectMap["properties"] = rt.ResourceProperties 1439 } 1440 if rt.Tags != nil { 1441 objectMap["tags"] = rt.Tags 1442 } 1443 if rt.Location != nil { 1444 objectMap["location"] = rt.Location 1445 } 1446 return json.Marshal(objectMap) 1447} 1448 1449// UnmarshalJSON is the custom unmarshaler for ResourceType struct. 1450func (rt *ResourceType) UnmarshalJSON(body []byte) error { 1451 var m map[string]*json.RawMessage 1452 err := json.Unmarshal(body, &m) 1453 if err != nil { 1454 return err 1455 } 1456 for k, v := range m { 1457 switch k { 1458 case "properties": 1459 if v != nil { 1460 var resourceProperties ResourceProperties 1461 err = json.Unmarshal(*v, &resourceProperties) 1462 if err != nil { 1463 return err 1464 } 1465 rt.ResourceProperties = &resourceProperties 1466 } 1467 case "tags": 1468 if v != nil { 1469 var tags map[string]*string 1470 err = json.Unmarshal(*v, &tags) 1471 if err != nil { 1472 return err 1473 } 1474 rt.Tags = tags 1475 } 1476 case "location": 1477 if v != nil { 1478 var location string 1479 err = json.Unmarshal(*v, &location) 1480 if err != nil { 1481 return err 1482 } 1483 rt.Location = &location 1484 } 1485 case "id": 1486 if v != nil { 1487 var ID string 1488 err = json.Unmarshal(*v, &ID) 1489 if err != nil { 1490 return err 1491 } 1492 rt.ID = &ID 1493 } 1494 case "name": 1495 if v != nil { 1496 var name string 1497 err = json.Unmarshal(*v, &name) 1498 if err != nil { 1499 return err 1500 } 1501 rt.Name = &name 1502 } 1503 case "type": 1504 if v != nil { 1505 var typeVar string 1506 err = json.Unmarshal(*v, &typeVar) 1507 if err != nil { 1508 return err 1509 } 1510 rt.Type = &typeVar 1511 } 1512 } 1513 } 1514 1515 return nil 1516} 1517 1518// ScheduleEntries list of patch schedules for a Redis cache. 1519type ScheduleEntries struct { 1520 // ScheduleEntries - List of patch schedules for a Redis cache. 1521 ScheduleEntries *[]ScheduleEntry `json:"scheduleEntries,omitempty"` 1522} 1523 1524// ScheduleEntry patch schedule entry for a Premium Redis Cache. 1525type ScheduleEntry struct { 1526 // DayOfWeek - Day of the week when a cache can be patched. Possible values include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Everyday', 'Weekend' 1527 DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` 1528 // StartHourUtc - Start hour after which cache patching can start. 1529 StartHourUtc *int32 `json:"startHourUtc,omitempty"` 1530 // MaintenanceWindow - ISO8601 timespan specifying how much time cache patching can take. 1531 MaintenanceWindow *string `json:"maintenanceWindow,omitempty"` 1532} 1533 1534// Sku SKU parameters supplied to the create Redis operation. 1535type Sku struct { 1536 // Name - The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium). Possible values include: 'Basic', 'Standard', 'Premium' 1537 Name SkuName `json:"name,omitempty"` 1538 // Family - The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = Premium). Possible values include: 'C', 'P' 1539 Family SkuFamily `json:"family,omitempty"` 1540 // Capacity - The size of the Redis cache to deploy. Valid values: for C (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for P (Premium) family (1, 2, 3, 4). 1541 Capacity *int32 `json:"capacity,omitempty"` 1542} 1543 1544// TrackedResource the resource model definition for a ARM tracked top level resource 1545type TrackedResource struct { 1546 // Tags - Resource tags. 1547 Tags map[string]*string `json:"tags"` 1548 // Location - The geo-location where the resource lives 1549 Location *string `json:"location,omitempty"` 1550 // ID - READ-ONLY; Resource ID. 1551 ID *string `json:"id,omitempty"` 1552 // Name - READ-ONLY; Resource name. 1553 Name *string `json:"name,omitempty"` 1554 // Type - READ-ONLY; Resource type. 1555 Type *string `json:"type,omitempty"` 1556} 1557 1558// MarshalJSON is the custom marshaler for TrackedResource. 1559func (tr TrackedResource) MarshalJSON() ([]byte, error) { 1560 objectMap := make(map[string]interface{}) 1561 if tr.Tags != nil { 1562 objectMap["tags"] = tr.Tags 1563 } 1564 if tr.Location != nil { 1565 objectMap["location"] = tr.Location 1566 } 1567 return json.Marshal(objectMap) 1568} 1569 1570// UpdateParameters parameters supplied to the Update Redis operation. 1571type UpdateParameters struct { 1572 // UpdateProperties - Redis cache properties. 1573 *UpdateProperties `json:"properties,omitempty"` 1574 // Tags - Resource tags. 1575 Tags map[string]*string `json:"tags"` 1576} 1577 1578// MarshalJSON is the custom marshaler for UpdateParameters. 1579func (up UpdateParameters) MarshalJSON() ([]byte, error) { 1580 objectMap := make(map[string]interface{}) 1581 if up.UpdateProperties != nil { 1582 objectMap["properties"] = up.UpdateProperties 1583 } 1584 if up.Tags != nil { 1585 objectMap["tags"] = up.Tags 1586 } 1587 return json.Marshal(objectMap) 1588} 1589 1590// UnmarshalJSON is the custom unmarshaler for UpdateParameters struct. 1591func (up *UpdateParameters) UnmarshalJSON(body []byte) error { 1592 var m map[string]*json.RawMessage 1593 err := json.Unmarshal(body, &m) 1594 if err != nil { 1595 return err 1596 } 1597 for k, v := range m { 1598 switch k { 1599 case "properties": 1600 if v != nil { 1601 var updateProperties UpdateProperties 1602 err = json.Unmarshal(*v, &updateProperties) 1603 if err != nil { 1604 return err 1605 } 1606 up.UpdateProperties = &updateProperties 1607 } 1608 case "tags": 1609 if v != nil { 1610 var tags map[string]*string 1611 err = json.Unmarshal(*v, &tags) 1612 if err != nil { 1613 return err 1614 } 1615 up.Tags = tags 1616 } 1617 } 1618 } 1619 1620 return nil 1621} 1622 1623// UpdateProperties properties supplied to Update Redis operation. 1624type UpdateProperties struct { 1625 // Sku - The SKU of the Redis cache to deploy. 1626 Sku *Sku `json:"sku,omitempty"` 1627 // RedisConfiguration - All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. 1628 RedisConfiguration map[string]*string `json:"redisConfiguration"` 1629 // EnableNonSslPort - Specifies whether the non-ssl Redis server port (6379) is enabled. 1630 EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"` 1631 // TenantSettings - tenantSettings 1632 TenantSettings map[string]*string `json:"tenantSettings"` 1633 // ShardCount - The number of shards to be created on a Premium Cluster Cache. 1634 ShardCount *int32 `json:"shardCount,omitempty"` 1635 // SubnetID - The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 1636 SubnetID *string `json:"subnetId,omitempty"` 1637 // StaticIP - Static IP address. Required when deploying a Redis cache inside an existing Azure Virtual Network. 1638 StaticIP *string `json:"staticIP,omitempty"` 1639} 1640 1641// MarshalJSON is the custom marshaler for UpdateProperties. 1642func (up UpdateProperties) MarshalJSON() ([]byte, error) { 1643 objectMap := make(map[string]interface{}) 1644 if up.Sku != nil { 1645 objectMap["sku"] = up.Sku 1646 } 1647 if up.RedisConfiguration != nil { 1648 objectMap["redisConfiguration"] = up.RedisConfiguration 1649 } 1650 if up.EnableNonSslPort != nil { 1651 objectMap["enableNonSslPort"] = up.EnableNonSslPort 1652 } 1653 if up.TenantSettings != nil { 1654 objectMap["tenantSettings"] = up.TenantSettings 1655 } 1656 if up.ShardCount != nil { 1657 objectMap["shardCount"] = up.ShardCount 1658 } 1659 if up.SubnetID != nil { 1660 objectMap["subnetId"] = up.SubnetID 1661 } 1662 if up.StaticIP != nil { 1663 objectMap["staticIP"] = up.StaticIP 1664 } 1665 return json.Marshal(objectMap) 1666} 1667