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