1package signalr 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "encoding/json" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/to" 25 "net/http" 26) 27 28// KeyType enumerates the values for key type. 29type KeyType string 30 31const ( 32 // Primary ... 33 Primary KeyType = "Primary" 34 // Secondary ... 35 Secondary KeyType = "Secondary" 36) 37 38// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. 39func PossibleKeyTypeValues() []KeyType { 40 return []KeyType{Primary, Secondary} 41} 42 43// ProvisioningState enumerates the values for provisioning state. 44type ProvisioningState string 45 46const ( 47 // Canceled ... 48 Canceled ProvisioningState = "Canceled" 49 // Creating ... 50 Creating ProvisioningState = "Creating" 51 // Deleting ... 52 Deleting ProvisioningState = "Deleting" 53 // Failed ... 54 Failed ProvisioningState = "Failed" 55 // Moving ... 56 Moving ProvisioningState = "Moving" 57 // Running ... 58 Running ProvisioningState = "Running" 59 // Succeeded ... 60 Succeeded ProvisioningState = "Succeeded" 61 // Unknown ... 62 Unknown ProvisioningState = "Unknown" 63 // Updating ... 64 Updating ProvisioningState = "Updating" 65) 66 67// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. 68func PossibleProvisioningStateValues() []ProvisioningState { 69 return []ProvisioningState{Canceled, Creating, Deleting, Failed, Moving, Running, Succeeded, Unknown, Updating} 70} 71 72// SkuTier enumerates the values for sku tier. 73type SkuTier string 74 75const ( 76 // Basic ... 77 Basic SkuTier = "Basic" 78 // Free ... 79 Free SkuTier = "Free" 80 // Premium ... 81 Premium SkuTier = "Premium" 82 // Standard ... 83 Standard SkuTier = "Standard" 84) 85 86// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. 87func PossibleSkuTierValues() []SkuTier { 88 return []SkuTier{Basic, Free, Premium, Standard} 89} 90 91// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 92type CreateOrUpdateFuture struct { 93 azure.Future 94} 95 96// Result returns the result of the asynchronous operation. 97// If the operation has not completed it will return an error. 98func (future *CreateOrUpdateFuture) Result(client Client) (rt ResourceType, err error) { 99 var done bool 100 done, err = future.Done(client) 101 if err != nil { 102 err = autorest.NewErrorWithError(err, "signalr.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 103 return 104 } 105 if !done { 106 err = azure.NewAsyncOpIncompleteError("signalr.CreateOrUpdateFuture") 107 return 108 } 109 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 110 if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { 111 rt, err = client.CreateOrUpdateResponder(rt.Response.Response) 112 if err != nil { 113 err = autorest.NewErrorWithError(err, "signalr.CreateOrUpdateFuture", "Result", rt.Response.Response, "Failure responding to request") 114 } 115 } 116 return 117} 118 119// CreateOrUpdateProperties settings used to provision or configure the resource. 120type CreateOrUpdateProperties struct { 121 // HostNamePrefix - Prefix for the hostName of the SignalR service. Retained for future use. 122 // The hostname will be of format: <hostNamePrefix>.service.signalr.net. 123 HostNamePrefix *string `json:"hostNamePrefix,omitempty"` 124} 125 126// CreateParameters parameters for SignalR service create/update operation. 127// 128// Keep the same schema as AzSignalR.Models.SignalRResource 129type CreateParameters struct { 130 // Location - Azure GEO region: e.g. West US | East US | North Central US | South Central US | West Europe | North Europe | East Asia | Southeast Asia | etc. 131 // The geo region of a resource never changes after it is created. 132 Location *string `json:"location,omitempty"` 133 // Tags - A list of key value pairs that describe the resource. 134 Tags map[string]*string `json:"tags"` 135 // Sku - The billing information of the resource.(e.g. basic vs. standard) 136 Sku *ResourceSku `json:"sku,omitempty"` 137 // Properties - Settings used to provision or configure the resource 138 Properties *CreateOrUpdateProperties `json:"properties,omitempty"` 139} 140 141// MarshalJSON is the custom marshaler for CreateParameters. 142func (cp CreateParameters) MarshalJSON() ([]byte, error) { 143 objectMap := make(map[string]interface{}) 144 if cp.Location != nil { 145 objectMap["location"] = cp.Location 146 } 147 if cp.Tags != nil { 148 objectMap["tags"] = cp.Tags 149 } 150 if cp.Sku != nil { 151 objectMap["sku"] = cp.Sku 152 } 153 if cp.Properties != nil { 154 objectMap["properties"] = cp.Properties 155 } 156 return json.Marshal(objectMap) 157} 158 159// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 160type DeleteFuture struct { 161 azure.Future 162} 163 164// Result returns the result of the asynchronous operation. 165// If the operation has not completed it will return an error. 166func (future *DeleteFuture) Result(client Client) (ar autorest.Response, err error) { 167 var done bool 168 done, err = future.Done(client) 169 if err != nil { 170 err = autorest.NewErrorWithError(err, "signalr.DeleteFuture", "Result", future.Response(), "Polling failure") 171 return 172 } 173 if !done { 174 err = azure.NewAsyncOpIncompleteError("signalr.DeleteFuture") 175 return 176 } 177 ar.Response = future.Response() 178 return 179} 180 181// Dimension specifications of the Dimension of metrics. 182type Dimension struct { 183 // Name - The public facing name of the dimension. 184 Name *string `json:"name,omitempty"` 185 // DisplayName - Localized friendly display name of the dimension. 186 DisplayName *string `json:"displayName,omitempty"` 187 // InternalName - Name of the dimension as it appears in MDM. 188 InternalName *string `json:"internalName,omitempty"` 189 // ToBeExportedForShoebox - A Boolean flag indicating whether this dimension should be included for the shoebox export scenario. 190 ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` 191} 192 193// Keys a class represents the access keys of SignalR service. 194type Keys struct { 195 autorest.Response `json:"-"` 196 // PrimaryKey - The primary access key. 197 PrimaryKey *string `json:"primaryKey,omitempty"` 198 // SecondaryKey - The secondary access key. 199 SecondaryKey *string `json:"secondaryKey,omitempty"` 200 // PrimaryConnectionString - SignalR connection string constructed via the primaryKey 201 PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` 202 // SecondaryConnectionString - SignalR connection string constructed via the secondaryKey 203 SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` 204} 205 206// MetricSpecification specifications of the Metrics for Azure Monitoring. 207type MetricSpecification struct { 208 // Name - Name of the metric. 209 Name *string `json:"name,omitempty"` 210 // DisplayName - Localized friendly display name of the metric. 211 DisplayName *string `json:"displayName,omitempty"` 212 // DisplayDescription - Localized friendly description of the metric. 213 DisplayDescription *string `json:"displayDescription,omitempty"` 214 // Unit - The unit that makes sense for the metric. 215 Unit *string `json:"unit,omitempty"` 216 // AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. 217 AggregationType *string `json:"aggregationType,omitempty"` 218 // FillGapWithZero - Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. 219 // Ex. a metric that returns the number of times a particular error code was emitted. The error code may not appear 220 // often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing was emitted. 221 FillGapWithZero *string `json:"fillGapWithZero,omitempty"` 222 // Category - The name of the metric category that the metric belongs to. A metric can only belong to a single category. 223 Category *string `json:"category,omitempty"` 224 // Dimensions - The dimensions of the metrics. 225 Dimensions *[]Dimension `json:"dimensions,omitempty"` 226} 227 228// NameAvailability result of the request to check name availability. It contains a flag and possible reason of 229// failure. 230type NameAvailability struct { 231 autorest.Response `json:"-"` 232 // NameAvailable - Indicates whether the name is available or not. 233 NameAvailable *bool `json:"nameAvailable,omitempty"` 234 // Reason - The reason of the availability. Required if name is not available. 235 Reason *string `json:"reason,omitempty"` 236 // Message - The message of the operation. 237 Message *string `json:"message,omitempty"` 238} 239 240// NameAvailabilityParameters data POST-ed to the nameAvailability action 241type NameAvailabilityParameters struct { 242 // Type - The resource type. Should be always "Microsoft.SignalRService/SignalR". 243 Type *string `json:"type,omitempty"` 244 // Name - The SignalR service name to validate. e.g."my-signalR-name-here" 245 Name *string `json:"name,omitempty"` 246} 247 248// Operation REST API operation supported by SignalR resource provider. 249type Operation struct { 250 // Name - Name of the operation with format: {provider}/{resource}/{operation} 251 Name *string `json:"name,omitempty"` 252 // Display - The object that describes the operation. 253 Display *OperationDisplay `json:"display,omitempty"` 254 // Origin - Optional. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. 255 Origin *string `json:"origin,omitempty"` 256 // Properties - Extra properties for the operation. 257 Properties *OperationProperties `json:"properties,omitempty"` 258} 259 260// OperationDisplay the object that describes a operation. 261type OperationDisplay struct { 262 // Provider - Friendly name of the resource provider 263 Provider *string `json:"provider,omitempty"` 264 // Resource - Resource type on which the operation is performed. 265 Resource *string `json:"resource,omitempty"` 266 // Operation - The localized friendly name for the operation. 267 Operation *string `json:"operation,omitempty"` 268 // Description - The localized friendly description for the operation 269 Description *string `json:"description,omitempty"` 270} 271 272// OperationList result of the request to list REST API operations. It contains a list of operations. 273type OperationList struct { 274 autorest.Response `json:"-"` 275 // Value - List of operations supported by the resource provider. 276 Value *[]Operation `json:"value,omitempty"` 277 // NextLink - The URL the client should use to fetch the next page (per server side paging). 278 // It's null for now, added for future use. 279 NextLink *string `json:"nextLink,omitempty"` 280} 281 282// OperationListIterator provides access to a complete listing of Operation values. 283type OperationListIterator struct { 284 i int 285 page OperationListPage 286} 287 288// Next advances to the next value. If there was an error making 289// the request the iterator does not advance and the error is returned. 290func (iter *OperationListIterator) Next() error { 291 iter.i++ 292 if iter.i < len(iter.page.Values()) { 293 return nil 294 } 295 err := iter.page.Next() 296 if err != nil { 297 iter.i-- 298 return err 299 } 300 iter.i = 0 301 return nil 302} 303 304// NotDone returns true if the enumeration should be started or is not yet complete. 305func (iter OperationListIterator) NotDone() bool { 306 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 307} 308 309// Response returns the raw server response from the last page request. 310func (iter OperationListIterator) Response() OperationList { 311 return iter.page.Response() 312} 313 314// Value returns the current value or a zero-initialized value if the 315// iterator has advanced beyond the end of the collection. 316func (iter OperationListIterator) Value() Operation { 317 if !iter.page.NotDone() { 318 return Operation{} 319 } 320 return iter.page.Values()[iter.i] 321} 322 323// IsEmpty returns true if the ListResult contains no values. 324func (ol OperationList) IsEmpty() bool { 325 return ol.Value == nil || len(*ol.Value) == 0 326} 327 328// operationListPreparer prepares a request to retrieve the next set of results. 329// It returns nil if no more results exist. 330func (ol OperationList) operationListPreparer() (*http.Request, error) { 331 if ol.NextLink == nil || len(to.String(ol.NextLink)) < 1 { 332 return nil, nil 333 } 334 return autorest.Prepare(&http.Request{}, 335 autorest.AsJSON(), 336 autorest.AsGet(), 337 autorest.WithBaseURL(to.String(ol.NextLink))) 338} 339 340// OperationListPage contains a page of Operation values. 341type OperationListPage struct { 342 fn func(OperationList) (OperationList, error) 343 ol OperationList 344} 345 346// Next advances to the next page of values. If there was an error making 347// the request the page does not advance and the error is returned. 348func (page *OperationListPage) Next() error { 349 next, err := page.fn(page.ol) 350 if err != nil { 351 return err 352 } 353 page.ol = next 354 return nil 355} 356 357// NotDone returns true if the page enumeration should be started or is not yet complete. 358func (page OperationListPage) NotDone() bool { 359 return !page.ol.IsEmpty() 360} 361 362// Response returns the raw server response from the last page request. 363func (page OperationListPage) Response() OperationList { 364 return page.ol 365} 366 367// Values returns the slice of values for the current page or nil if there are no values. 368func (page OperationListPage) Values() []Operation { 369 if page.ol.IsEmpty() { 370 return nil 371 } 372 return *page.ol.Value 373} 374 375// OperationProperties extra Operation properties. 376type OperationProperties struct { 377 // ServiceSpecification - The service specifications. 378 ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` 379} 380 381// Properties a class that describes the properties of the SignalR service that should contain more read-only 382// properties than AzSignalR.Models.SignalRCreateOrUpdateProperties 383type Properties struct { 384 // ProvisioningState - Provisioning state of the resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' 385 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 386 // ExternalIP - The publicly accessible IP of the SignalR service. 387 ExternalIP *string `json:"externalIP,omitempty"` 388 // HostName - FQDN of the SignalR service instance. Format: xxx.service.signalr.net 389 HostName *string `json:"hostName,omitempty"` 390 // PublicPort - The publicly accessibly port of the SignalR service which is designed for browser/client side usage. 391 PublicPort *int32 `json:"publicPort,omitempty"` 392 // ServerPort - The publicly accessibly port of the SignalR service which is designed for customer server side usage. 393 ServerPort *int32 `json:"serverPort,omitempty"` 394 // Version - Version of the SignalR resource. Probably you need the same or higher version of client SDKs. 395 Version *string `json:"version,omitempty"` 396 // HostNamePrefix - Prefix for the hostName of the SignalR service. Retained for future use. 397 // The hostname will be of format: <hostNamePrefix>.service.signalr.net. 398 HostNamePrefix *string `json:"hostNamePrefix,omitempty"` 399} 400 401// RegenerateKeyFuture an abstraction for monitoring and retrieving the results of a long-running operation. 402type RegenerateKeyFuture struct { 403 azure.Future 404} 405 406// Result returns the result of the asynchronous operation. 407// If the operation has not completed it will return an error. 408func (future *RegenerateKeyFuture) Result(client Client) (kVar Keys, err error) { 409 var done bool 410 done, err = future.Done(client) 411 if err != nil { 412 err = autorest.NewErrorWithError(err, "signalr.RegenerateKeyFuture", "Result", future.Response(), "Polling failure") 413 return 414 } 415 if !done { 416 err = azure.NewAsyncOpIncompleteError("signalr.RegenerateKeyFuture") 417 return 418 } 419 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 420 if kVar.Response.Response, err = future.GetResult(sender); err == nil && kVar.Response.Response.StatusCode != http.StatusNoContent { 421 kVar, err = client.RegenerateKeyResponder(kVar.Response.Response) 422 if err != nil { 423 err = autorest.NewErrorWithError(err, "signalr.RegenerateKeyFuture", "Result", kVar.Response.Response, "Failure responding to request") 424 } 425 } 426 return 427} 428 429// RegenerateKeyParameters parameters describes the request to regenerate access keys 430type RegenerateKeyParameters struct { 431 // KeyType - The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' 432 KeyType KeyType `json:"keyType,omitempty"` 433} 434 435// Resource the core properties of ARM resources. 436type Resource struct { 437 // ID - Fully qualified resource Id for the resource. 438 ID *string `json:"id,omitempty"` 439 // Name - The name of the resouce. 440 Name *string `json:"name,omitempty"` 441 // Type - The type of the service - e.g. "Microsoft.SignalRService/SignalR" 442 Type *string `json:"type,omitempty"` 443} 444 445// ResourceList object that includes an array of SignalR services and a possible link for next set. 446type ResourceList struct { 447 autorest.Response `json:"-"` 448 // Value - List of SignalR services 449 Value *[]ResourceType `json:"value,omitempty"` 450 // NextLink - The URL the client should use to fetch the next page (per server side paging). 451 // It's null for now, added for future use. 452 NextLink *string `json:"nextLink,omitempty"` 453} 454 455// ResourceListIterator provides access to a complete listing of ResourceType values. 456type ResourceListIterator struct { 457 i int 458 page ResourceListPage 459} 460 461// Next advances to the next value. If there was an error making 462// the request the iterator does not advance and the error is returned. 463func (iter *ResourceListIterator) Next() error { 464 iter.i++ 465 if iter.i < len(iter.page.Values()) { 466 return nil 467 } 468 err := iter.page.Next() 469 if err != nil { 470 iter.i-- 471 return err 472 } 473 iter.i = 0 474 return nil 475} 476 477// NotDone returns true if the enumeration should be started or is not yet complete. 478func (iter ResourceListIterator) NotDone() bool { 479 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 480} 481 482// Response returns the raw server response from the last page request. 483func (iter ResourceListIterator) Response() ResourceList { 484 return iter.page.Response() 485} 486 487// Value returns the current value or a zero-initialized value if the 488// iterator has advanced beyond the end of the collection. 489func (iter ResourceListIterator) Value() ResourceType { 490 if !iter.page.NotDone() { 491 return ResourceType{} 492 } 493 return iter.page.Values()[iter.i] 494} 495 496// IsEmpty returns true if the ListResult contains no values. 497func (rl ResourceList) IsEmpty() bool { 498 return rl.Value == nil || len(*rl.Value) == 0 499} 500 501// resourceListPreparer prepares a request to retrieve the next set of results. 502// It returns nil if no more results exist. 503func (rl ResourceList) resourceListPreparer() (*http.Request, error) { 504 if rl.NextLink == nil || len(to.String(rl.NextLink)) < 1 { 505 return nil, nil 506 } 507 return autorest.Prepare(&http.Request{}, 508 autorest.AsJSON(), 509 autorest.AsGet(), 510 autorest.WithBaseURL(to.String(rl.NextLink))) 511} 512 513// ResourceListPage contains a page of ResourceType values. 514type ResourceListPage struct { 515 fn func(ResourceList) (ResourceList, error) 516 rl ResourceList 517} 518 519// Next advances to the next page of values. If there was an error making 520// the request the page does not advance and the error is returned. 521func (page *ResourceListPage) Next() error { 522 next, err := page.fn(page.rl) 523 if err != nil { 524 return err 525 } 526 page.rl = next 527 return nil 528} 529 530// NotDone returns true if the page enumeration should be started or is not yet complete. 531func (page ResourceListPage) NotDone() bool { 532 return !page.rl.IsEmpty() 533} 534 535// Response returns the raw server response from the last page request. 536func (page ResourceListPage) Response() ResourceList { 537 return page.rl 538} 539 540// Values returns the slice of values for the current page or nil if there are no values. 541func (page ResourceListPage) Values() []ResourceType { 542 if page.rl.IsEmpty() { 543 return nil 544 } 545 return *page.rl.Value 546} 547 548// ResourceSku the billing information of the resource.(e.g. basic vs. standard) 549type ResourceSku struct { 550 // Name - The name of the SKU. This is typically a letter + number code, such as A0 or P3. Required (if sku is specified) 551 Name *string `json:"name,omitempty"` 552 // Tier - Optional tier of this particular SKU. `Basic` is deprecated, use `Standard` instead for Basic tier. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' 553 Tier SkuTier `json:"tier,omitempty"` 554 // Size - Optional, string. When the name field is the combination of tier and some other value, this would be the standalone code. 555 Size *string `json:"size,omitempty"` 556 // Family - Optional, string. If the service has different generations of hardware, for the same SKU, then that can be captured here. 557 Family *string `json:"family,omitempty"` 558 // Capacity - Optional, integer. If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not 559 // possible for the resource this may be omitted. 560 Capacity *int32 `json:"capacity,omitempty"` 561} 562 563// ResourceType a class represent a SignalR service resource. 564type ResourceType struct { 565 autorest.Response `json:"-"` 566 // Sku - SKU of the service. 567 Sku *ResourceSku `json:"sku,omitempty"` 568 // Properties - The properties of the service. 569 *Properties `json:"properties,omitempty"` 570 // Location - The GEO location of the SignalR service. e.g. West US | East US | North Central US | South Central US. 571 Location *string `json:"location,omitempty"` 572 // Tags - Tags of the service which is a list of key value pairs that describe the resource. 573 Tags map[string]*string `json:"tags"` 574 // ID - Fully qualified resource Id for the resource. 575 ID *string `json:"id,omitempty"` 576 // Name - The name of the resouce. 577 Name *string `json:"name,omitempty"` 578 // Type - The type of the service - e.g. "Microsoft.SignalRService/SignalR" 579 Type *string `json:"type,omitempty"` 580} 581 582// MarshalJSON is the custom marshaler for ResourceType. 583func (rt ResourceType) MarshalJSON() ([]byte, error) { 584 objectMap := make(map[string]interface{}) 585 if rt.Sku != nil { 586 objectMap["sku"] = rt.Sku 587 } 588 if rt.Properties != nil { 589 objectMap["properties"] = rt.Properties 590 } 591 if rt.Location != nil { 592 objectMap["location"] = rt.Location 593 } 594 if rt.Tags != nil { 595 objectMap["tags"] = rt.Tags 596 } 597 if rt.ID != nil { 598 objectMap["id"] = rt.ID 599 } 600 if rt.Name != nil { 601 objectMap["name"] = rt.Name 602 } 603 if rt.Type != nil { 604 objectMap["type"] = rt.Type 605 } 606 return json.Marshal(objectMap) 607} 608 609// UnmarshalJSON is the custom unmarshaler for ResourceType struct. 610func (rt *ResourceType) UnmarshalJSON(body []byte) error { 611 var m map[string]*json.RawMessage 612 err := json.Unmarshal(body, &m) 613 if err != nil { 614 return err 615 } 616 for k, v := range m { 617 switch k { 618 case "sku": 619 if v != nil { 620 var sku ResourceSku 621 err = json.Unmarshal(*v, &sku) 622 if err != nil { 623 return err 624 } 625 rt.Sku = &sku 626 } 627 case "properties": 628 if v != nil { 629 var properties Properties 630 err = json.Unmarshal(*v, &properties) 631 if err != nil { 632 return err 633 } 634 rt.Properties = &properties 635 } 636 case "location": 637 if v != nil { 638 var location string 639 err = json.Unmarshal(*v, &location) 640 if err != nil { 641 return err 642 } 643 rt.Location = &location 644 } 645 case "tags": 646 if v != nil { 647 var tags map[string]*string 648 err = json.Unmarshal(*v, &tags) 649 if err != nil { 650 return err 651 } 652 rt.Tags = tags 653 } 654 case "id": 655 if v != nil { 656 var ID string 657 err = json.Unmarshal(*v, &ID) 658 if err != nil { 659 return err 660 } 661 rt.ID = &ID 662 } 663 case "name": 664 if v != nil { 665 var name string 666 err = json.Unmarshal(*v, &name) 667 if err != nil { 668 return err 669 } 670 rt.Name = &name 671 } 672 case "type": 673 if v != nil { 674 var typeVar string 675 err = json.Unmarshal(*v, &typeVar) 676 if err != nil { 677 return err 678 } 679 rt.Type = &typeVar 680 } 681 } 682 } 683 684 return nil 685} 686 687// ServiceSpecification an object that describes a specification. 688type ServiceSpecification struct { 689 // MetricSpecifications - Specifications of the Metrics for Azure Monitoring. 690 MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` 691} 692 693// TrackedResource the resource model definition for a ARM tracked top level resource. 694type TrackedResource struct { 695 // Location - The GEO location of the SignalR service. e.g. West US | East US | North Central US | South Central US. 696 Location *string `json:"location,omitempty"` 697 // Tags - Tags of the service which is a list of key value pairs that describe the resource. 698 Tags map[string]*string `json:"tags"` 699 // ID - Fully qualified resource Id for the resource. 700 ID *string `json:"id,omitempty"` 701 // Name - The name of the resouce. 702 Name *string `json:"name,omitempty"` 703 // Type - The type of the service - e.g. "Microsoft.SignalRService/SignalR" 704 Type *string `json:"type,omitempty"` 705} 706 707// MarshalJSON is the custom marshaler for TrackedResource. 708func (tr TrackedResource) MarshalJSON() ([]byte, error) { 709 objectMap := make(map[string]interface{}) 710 if tr.Location != nil { 711 objectMap["location"] = tr.Location 712 } 713 if tr.Tags != nil { 714 objectMap["tags"] = tr.Tags 715 } 716 if tr.ID != nil { 717 objectMap["id"] = tr.ID 718 } 719 if tr.Name != nil { 720 objectMap["name"] = tr.Name 721 } 722 if tr.Type != nil { 723 objectMap["type"] = tr.Type 724 } 725 return json.Marshal(objectMap) 726} 727 728// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 729type UpdateFuture struct { 730 azure.Future 731} 732 733// Result returns the result of the asynchronous operation. 734// If the operation has not completed it will return an error. 735func (future *UpdateFuture) Result(client Client) (rt ResourceType, err error) { 736 var done bool 737 done, err = future.Done(client) 738 if err != nil { 739 err = autorest.NewErrorWithError(err, "signalr.UpdateFuture", "Result", future.Response(), "Polling failure") 740 return 741 } 742 if !done { 743 err = azure.NewAsyncOpIncompleteError("signalr.UpdateFuture") 744 return 745 } 746 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 747 if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { 748 rt, err = client.UpdateResponder(rt.Response.Response) 749 if err != nil { 750 err = autorest.NewErrorWithError(err, "signalr.UpdateFuture", "Result", rt.Response.Response, "Failure responding to request") 751 } 752 } 753 return 754} 755 756// UpdateParameters parameters for SignalR service update operation 757type UpdateParameters struct { 758 // Tags - A list of key value pairs that describe the resource. 759 Tags map[string]*string `json:"tags"` 760 // Sku - The billing information of the resource.(e.g. basic vs. standard) 761 Sku *ResourceSku `json:"sku,omitempty"` 762 // Properties - Settings used to provision or configure the resource 763 Properties *CreateOrUpdateProperties `json:"properties,omitempty"` 764} 765 766// MarshalJSON is the custom marshaler for UpdateParameters. 767func (up UpdateParameters) MarshalJSON() ([]byte, error) { 768 objectMap := make(map[string]interface{}) 769 if up.Tags != nil { 770 objectMap["tags"] = up.Tags 771 } 772 if up.Sku != nil { 773 objectMap["sku"] = up.Sku 774 } 775 if up.Properties != nil { 776 objectMap["properties"] = up.Properties 777 } 778 return json.Marshal(objectMap) 779} 780 781// Usage object that describes a specific usage of SignalR resources. 782type Usage struct { 783 // ID - Fully qualified ARM resource id 784 ID *string `json:"id,omitempty"` 785 // CurrentValue - Current value for the usage quota. 786 CurrentValue *int64 `json:"currentValue,omitempty"` 787 // Limit - The maximum permitted value for the usage quota. If there is no limit, this value will be -1. 788 Limit *int64 `json:"limit,omitempty"` 789 // Name - Localizable String object containing the name and a localized value. 790 Name *UsageName `json:"name,omitempty"` 791 // Unit - Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. 792 Unit *string `json:"unit,omitempty"` 793} 794 795// UsageList object that includes an array of SignalR resource usages and a possible link for next set. 796type UsageList struct { 797 autorest.Response `json:"-"` 798 // Value - List of SignalR usages 799 Value *[]Usage `json:"value,omitempty"` 800 // NextLink - The URL the client should use to fetch the next page (per server side paging). 801 // It's null for now, added for future use. 802 NextLink *string `json:"nextLink,omitempty"` 803} 804 805// UsageListIterator provides access to a complete listing of Usage values. 806type UsageListIterator struct { 807 i int 808 page UsageListPage 809} 810 811// Next advances to the next value. If there was an error making 812// the request the iterator does not advance and the error is returned. 813func (iter *UsageListIterator) Next() error { 814 iter.i++ 815 if iter.i < len(iter.page.Values()) { 816 return nil 817 } 818 err := iter.page.Next() 819 if err != nil { 820 iter.i-- 821 return err 822 } 823 iter.i = 0 824 return nil 825} 826 827// NotDone returns true if the enumeration should be started or is not yet complete. 828func (iter UsageListIterator) NotDone() bool { 829 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 830} 831 832// Response returns the raw server response from the last page request. 833func (iter UsageListIterator) Response() UsageList { 834 return iter.page.Response() 835} 836 837// Value returns the current value or a zero-initialized value if the 838// iterator has advanced beyond the end of the collection. 839func (iter UsageListIterator) Value() Usage { 840 if !iter.page.NotDone() { 841 return Usage{} 842 } 843 return iter.page.Values()[iter.i] 844} 845 846// IsEmpty returns true if the ListResult contains no values. 847func (ul UsageList) IsEmpty() bool { 848 return ul.Value == nil || len(*ul.Value) == 0 849} 850 851// usageListPreparer prepares a request to retrieve the next set of results. 852// It returns nil if no more results exist. 853func (ul UsageList) usageListPreparer() (*http.Request, error) { 854 if ul.NextLink == nil || len(to.String(ul.NextLink)) < 1 { 855 return nil, nil 856 } 857 return autorest.Prepare(&http.Request{}, 858 autorest.AsJSON(), 859 autorest.AsGet(), 860 autorest.WithBaseURL(to.String(ul.NextLink))) 861} 862 863// UsageListPage contains a page of Usage values. 864type UsageListPage struct { 865 fn func(UsageList) (UsageList, error) 866 ul UsageList 867} 868 869// Next advances to the next page of values. If there was an error making 870// the request the page does not advance and the error is returned. 871func (page *UsageListPage) Next() error { 872 next, err := page.fn(page.ul) 873 if err != nil { 874 return err 875 } 876 page.ul = next 877 return nil 878} 879 880// NotDone returns true if the page enumeration should be started or is not yet complete. 881func (page UsageListPage) NotDone() bool { 882 return !page.ul.IsEmpty() 883} 884 885// Response returns the raw server response from the last page request. 886func (page UsageListPage) Response() UsageList { 887 return page.ul 888} 889 890// Values returns the slice of values for the current page or nil if there are no values. 891func (page UsageListPage) Values() []Usage { 892 if page.ul.IsEmpty() { 893 return nil 894 } 895 return *page.ul.Value 896} 897 898// UsageName localizable String object containing the name and a localized value. 899type UsageName struct { 900 // Value - The indentifier of the usage. 901 Value *string `json:"value,omitempty"` 902 // LocalizedValue - Localized name of the usage. 903 LocalizedValue *string `json:"localizedValue,omitempty"` 904} 905