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