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