1package servicefabricmesh 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/date" 25 "github.com/Azure/go-autorest/autorest/to" 26 "github.com/Azure/go-autorest/tracing" 27 "net/http" 28) 29 30// The package's fully qualified name. 31const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/servicefabricmesh/mgmt/2018-09-01-preview/servicefabricmesh" 32 33// AddRemoveReplicaScalingMechanism describes the horizontal auto scaling mechanism that adds or removes 34// replicas (containers or container groups). 35type AddRemoveReplicaScalingMechanism struct { 36 // MinCount - Minimum number of containers (scale down won't be performed below this number). 37 MinCount *int32 `json:"minCount,omitempty"` 38 // MaxCount - Maximum number of containers (scale up won't be performed above this number). 39 MaxCount *int32 `json:"maxCount,omitempty"` 40 // ScaleIncrement - Each time auto scaling is performed, this number of containers will be added or removed. 41 ScaleIncrement *int32 `json:"scaleIncrement,omitempty"` 42 // Kind - Possible values include: 'KindAutoScalingMechanism', 'KindAddRemoveReplica' 43 Kind KindBasicAutoScalingMechanism `json:"kind,omitempty"` 44} 45 46// MarshalJSON is the custom marshaler for AddRemoveReplicaScalingMechanism. 47func (arrsm AddRemoveReplicaScalingMechanism) MarshalJSON() ([]byte, error) { 48 arrsm.Kind = KindAddRemoveReplica 49 objectMap := make(map[string]interface{}) 50 if arrsm.MinCount != nil { 51 objectMap["minCount"] = arrsm.MinCount 52 } 53 if arrsm.MaxCount != nil { 54 objectMap["maxCount"] = arrsm.MaxCount 55 } 56 if arrsm.ScaleIncrement != nil { 57 objectMap["scaleIncrement"] = arrsm.ScaleIncrement 58 } 59 if arrsm.Kind != "" { 60 objectMap["kind"] = arrsm.Kind 61 } 62 return json.Marshal(objectMap) 63} 64 65// AsAddRemoveReplicaScalingMechanism is the BasicAutoScalingMechanism implementation for AddRemoveReplicaScalingMechanism. 66func (arrsm AddRemoveReplicaScalingMechanism) AsAddRemoveReplicaScalingMechanism() (*AddRemoveReplicaScalingMechanism, bool) { 67 return &arrsm, true 68} 69 70// AsAutoScalingMechanism is the BasicAutoScalingMechanism implementation for AddRemoveReplicaScalingMechanism. 71func (arrsm AddRemoveReplicaScalingMechanism) AsAutoScalingMechanism() (*AutoScalingMechanism, bool) { 72 return nil, false 73} 74 75// AsBasicAutoScalingMechanism is the BasicAutoScalingMechanism implementation for AddRemoveReplicaScalingMechanism. 76func (arrsm AddRemoveReplicaScalingMechanism) AsBasicAutoScalingMechanism() (BasicAutoScalingMechanism, bool) { 77 return &arrsm, true 78} 79 80// ApplicationProperties describes properties of a application resource. 81type ApplicationProperties struct { 82 // Description - User readable description of the application. 83 Description *string `json:"description,omitempty"` 84 // Services - Describes the services in the application. This property is used to create or modify services of the application. On get only the name of the service is returned. The service description can be obtained by querying for the service resource. 85 Services *[]ServiceResourceDescription `json:"services,omitempty"` 86 // Diagnostics - Describes the diagnostics definition and usage for an application resource. 87 Diagnostics *DiagnosticsDescription `json:"diagnostics,omitempty"` 88 // DebugParams - Internal - used by Visual Studio to setup the debugging session on the local development environment. 89 DebugParams *string `json:"debugParams,omitempty"` 90 // ServiceNames - READ-ONLY; Names of the services in the application. 91 ServiceNames *[]string `json:"serviceNames,omitempty"` 92 // Status - READ-ONLY; Status of the application. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 93 Status ResourceStatus `json:"status,omitempty"` 94 // StatusDetails - READ-ONLY; Gives additional information about the current status of the application. 95 StatusDetails *string `json:"statusDetails,omitempty"` 96 // HealthState - READ-ONLY; Describes the health state of an application resource. Possible values include: 'HealthStateInvalid', 'HealthStateOk', 'HealthStateWarning', 'HealthStateError', 'HealthStateUnknown' 97 HealthState HealthState `json:"healthState,omitempty"` 98 // UnhealthyEvaluation - READ-ONLY; When the application's health state is not 'Ok', this additional details from service fabric Health Manager for the user to know why the application is marked unhealthy. 99 UnhealthyEvaluation *string `json:"unhealthyEvaluation,omitempty"` 100} 101 102// MarshalJSON is the custom marshaler for ApplicationProperties. 103func (ap ApplicationProperties) MarshalJSON() ([]byte, error) { 104 objectMap := make(map[string]interface{}) 105 if ap.Description != nil { 106 objectMap["description"] = ap.Description 107 } 108 if ap.Services != nil { 109 objectMap["services"] = ap.Services 110 } 111 if ap.Diagnostics != nil { 112 objectMap["diagnostics"] = ap.Diagnostics 113 } 114 if ap.DebugParams != nil { 115 objectMap["debugParams"] = ap.DebugParams 116 } 117 return json.Marshal(objectMap) 118} 119 120// ApplicationResourceDescription this type describes an application resource. 121type ApplicationResourceDescription struct { 122 autorest.Response `json:"-"` 123 // ApplicationResourceProperties - This type describes properties of an application resource. 124 *ApplicationResourceProperties `json:"properties,omitempty"` 125 // Tags - Resource tags. 126 Tags map[string]*string `json:"tags"` 127 // Location - The geo-location where the resource lives 128 Location *string `json:"location,omitempty"` 129 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 130 ID *string `json:"id,omitempty"` 131 // Name - READ-ONLY; The name of the resource 132 Name *string `json:"name,omitempty"` 133 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 134 Type *string `json:"type,omitempty"` 135} 136 137// MarshalJSON is the custom marshaler for ApplicationResourceDescription. 138func (ard ApplicationResourceDescription) MarshalJSON() ([]byte, error) { 139 objectMap := make(map[string]interface{}) 140 if ard.ApplicationResourceProperties != nil { 141 objectMap["properties"] = ard.ApplicationResourceProperties 142 } 143 if ard.Tags != nil { 144 objectMap["tags"] = ard.Tags 145 } 146 if ard.Location != nil { 147 objectMap["location"] = ard.Location 148 } 149 return json.Marshal(objectMap) 150} 151 152// UnmarshalJSON is the custom unmarshaler for ApplicationResourceDescription struct. 153func (ard *ApplicationResourceDescription) UnmarshalJSON(body []byte) error { 154 var m map[string]*json.RawMessage 155 err := json.Unmarshal(body, &m) 156 if err != nil { 157 return err 158 } 159 for k, v := range m { 160 switch k { 161 case "properties": 162 if v != nil { 163 var applicationResourceProperties ApplicationResourceProperties 164 err = json.Unmarshal(*v, &applicationResourceProperties) 165 if err != nil { 166 return err 167 } 168 ard.ApplicationResourceProperties = &applicationResourceProperties 169 } 170 case "tags": 171 if v != nil { 172 var tags map[string]*string 173 err = json.Unmarshal(*v, &tags) 174 if err != nil { 175 return err 176 } 177 ard.Tags = tags 178 } 179 case "location": 180 if v != nil { 181 var location string 182 err = json.Unmarshal(*v, &location) 183 if err != nil { 184 return err 185 } 186 ard.Location = &location 187 } 188 case "id": 189 if v != nil { 190 var ID string 191 err = json.Unmarshal(*v, &ID) 192 if err != nil { 193 return err 194 } 195 ard.ID = &ID 196 } 197 case "name": 198 if v != nil { 199 var name string 200 err = json.Unmarshal(*v, &name) 201 if err != nil { 202 return err 203 } 204 ard.Name = &name 205 } 206 case "type": 207 if v != nil { 208 var typeVar string 209 err = json.Unmarshal(*v, &typeVar) 210 if err != nil { 211 return err 212 } 213 ard.Type = &typeVar 214 } 215 } 216 } 217 218 return nil 219} 220 221// ApplicationResourceDescriptionList a pageable list of application resources. 222type ApplicationResourceDescriptionList struct { 223 autorest.Response `json:"-"` 224 // Value - One page of the list. 225 Value *[]ApplicationResourceDescription `json:"value,omitempty"` 226 // NextLink - URI to fetch the next page of the list. 227 NextLink *string `json:"nextLink,omitempty"` 228} 229 230// ApplicationResourceDescriptionListIterator provides access to a complete listing of 231// ApplicationResourceDescription values. 232type ApplicationResourceDescriptionListIterator struct { 233 i int 234 page ApplicationResourceDescriptionListPage 235} 236 237// NextWithContext advances to the next value. If there was an error making 238// the request the iterator does not advance and the error is returned. 239func (iter *ApplicationResourceDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 240 if tracing.IsEnabled() { 241 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationResourceDescriptionListIterator.NextWithContext") 242 defer func() { 243 sc := -1 244 if iter.Response().Response.Response != nil { 245 sc = iter.Response().Response.Response.StatusCode 246 } 247 tracing.EndSpan(ctx, sc, err) 248 }() 249 } 250 iter.i++ 251 if iter.i < len(iter.page.Values()) { 252 return nil 253 } 254 err = iter.page.NextWithContext(ctx) 255 if err != nil { 256 iter.i-- 257 return err 258 } 259 iter.i = 0 260 return nil 261} 262 263// Next advances to the next value. If there was an error making 264// the request the iterator does not advance and the error is returned. 265// Deprecated: Use NextWithContext() instead. 266func (iter *ApplicationResourceDescriptionListIterator) Next() error { 267 return iter.NextWithContext(context.Background()) 268} 269 270// NotDone returns true if the enumeration should be started or is not yet complete. 271func (iter ApplicationResourceDescriptionListIterator) NotDone() bool { 272 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 273} 274 275// Response returns the raw server response from the last page request. 276func (iter ApplicationResourceDescriptionListIterator) Response() ApplicationResourceDescriptionList { 277 return iter.page.Response() 278} 279 280// Value returns the current value or a zero-initialized value if the 281// iterator has advanced beyond the end of the collection. 282func (iter ApplicationResourceDescriptionListIterator) Value() ApplicationResourceDescription { 283 if !iter.page.NotDone() { 284 return ApplicationResourceDescription{} 285 } 286 return iter.page.Values()[iter.i] 287} 288 289// Creates a new instance of the ApplicationResourceDescriptionListIterator type. 290func NewApplicationResourceDescriptionListIterator(page ApplicationResourceDescriptionListPage) ApplicationResourceDescriptionListIterator { 291 return ApplicationResourceDescriptionListIterator{page: page} 292} 293 294// IsEmpty returns true if the ListResult contains no values. 295func (ardl ApplicationResourceDescriptionList) IsEmpty() bool { 296 return ardl.Value == nil || len(*ardl.Value) == 0 297} 298 299// hasNextLink returns true if the NextLink is not empty. 300func (ardl ApplicationResourceDescriptionList) hasNextLink() bool { 301 return ardl.NextLink != nil && len(*ardl.NextLink) != 0 302} 303 304// applicationResourceDescriptionListPreparer prepares a request to retrieve the next set of results. 305// It returns nil if no more results exist. 306func (ardl ApplicationResourceDescriptionList) applicationResourceDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 307 if !ardl.hasNextLink() { 308 return nil, nil 309 } 310 return autorest.Prepare((&http.Request{}).WithContext(ctx), 311 autorest.AsJSON(), 312 autorest.AsGet(), 313 autorest.WithBaseURL(to.String(ardl.NextLink))) 314} 315 316// ApplicationResourceDescriptionListPage contains a page of ApplicationResourceDescription values. 317type ApplicationResourceDescriptionListPage struct { 318 fn func(context.Context, ApplicationResourceDescriptionList) (ApplicationResourceDescriptionList, error) 319 ardl ApplicationResourceDescriptionList 320} 321 322// NextWithContext advances to the next page of values. If there was an error making 323// the request the page does not advance and the error is returned. 324func (page *ApplicationResourceDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 325 if tracing.IsEnabled() { 326 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationResourceDescriptionListPage.NextWithContext") 327 defer func() { 328 sc := -1 329 if page.Response().Response.Response != nil { 330 sc = page.Response().Response.Response.StatusCode 331 } 332 tracing.EndSpan(ctx, sc, err) 333 }() 334 } 335 for { 336 next, err := page.fn(ctx, page.ardl) 337 if err != nil { 338 return err 339 } 340 page.ardl = next 341 if !next.hasNextLink() || !next.IsEmpty() { 342 break 343 } 344 } 345 return nil 346} 347 348// Next advances to the next page of values. If there was an error making 349// the request the page does not advance and the error is returned. 350// Deprecated: Use NextWithContext() instead. 351func (page *ApplicationResourceDescriptionListPage) Next() error { 352 return page.NextWithContext(context.Background()) 353} 354 355// NotDone returns true if the page enumeration should be started or is not yet complete. 356func (page ApplicationResourceDescriptionListPage) NotDone() bool { 357 return !page.ardl.IsEmpty() 358} 359 360// Response returns the raw server response from the last page request. 361func (page ApplicationResourceDescriptionListPage) Response() ApplicationResourceDescriptionList { 362 return page.ardl 363} 364 365// Values returns the slice of values for the current page or nil if there are no values. 366func (page ApplicationResourceDescriptionListPage) Values() []ApplicationResourceDescription { 367 if page.ardl.IsEmpty() { 368 return nil 369 } 370 return *page.ardl.Value 371} 372 373// Creates a new instance of the ApplicationResourceDescriptionListPage type. 374func NewApplicationResourceDescriptionListPage(cur ApplicationResourceDescriptionList, getNextPage func(context.Context, ApplicationResourceDescriptionList) (ApplicationResourceDescriptionList, error)) ApplicationResourceDescriptionListPage { 375 return ApplicationResourceDescriptionListPage{ 376 fn: getNextPage, 377 ardl: cur, 378 } 379} 380 381// ApplicationResourceProperties this type describes properties of an application resource. 382type ApplicationResourceProperties struct { 383 // ProvisioningState - READ-ONLY; State of the resource. 384 ProvisioningState *string `json:"provisioningState,omitempty"` 385 // Description - User readable description of the application. 386 Description *string `json:"description,omitempty"` 387 // Services - Describes the services in the application. This property is used to create or modify services of the application. On get only the name of the service is returned. The service description can be obtained by querying for the service resource. 388 Services *[]ServiceResourceDescription `json:"services,omitempty"` 389 // Diagnostics - Describes the diagnostics definition and usage for an application resource. 390 Diagnostics *DiagnosticsDescription `json:"diagnostics,omitempty"` 391 // DebugParams - Internal - used by Visual Studio to setup the debugging session on the local development environment. 392 DebugParams *string `json:"debugParams,omitempty"` 393 // ServiceNames - READ-ONLY; Names of the services in the application. 394 ServiceNames *[]string `json:"serviceNames,omitempty"` 395 // Status - READ-ONLY; Status of the application. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 396 Status ResourceStatus `json:"status,omitempty"` 397 // StatusDetails - READ-ONLY; Gives additional information about the current status of the application. 398 StatusDetails *string `json:"statusDetails,omitempty"` 399 // HealthState - READ-ONLY; Describes the health state of an application resource. Possible values include: 'HealthStateInvalid', 'HealthStateOk', 'HealthStateWarning', 'HealthStateError', 'HealthStateUnknown' 400 HealthState HealthState `json:"healthState,omitempty"` 401 // UnhealthyEvaluation - READ-ONLY; When the application's health state is not 'Ok', this additional details from service fabric Health Manager for the user to know why the application is marked unhealthy. 402 UnhealthyEvaluation *string `json:"unhealthyEvaluation,omitempty"` 403} 404 405// MarshalJSON is the custom marshaler for ApplicationResourceProperties. 406func (arp ApplicationResourceProperties) MarshalJSON() ([]byte, error) { 407 objectMap := make(map[string]interface{}) 408 if arp.Description != nil { 409 objectMap["description"] = arp.Description 410 } 411 if arp.Services != nil { 412 objectMap["services"] = arp.Services 413 } 414 if arp.Diagnostics != nil { 415 objectMap["diagnostics"] = arp.Diagnostics 416 } 417 if arp.DebugParams != nil { 418 objectMap["debugParams"] = arp.DebugParams 419 } 420 return json.Marshal(objectMap) 421} 422 423// ApplicationScopedVolume describes a volume whose lifetime is scoped to the application's lifetime. 424type ApplicationScopedVolume struct { 425 // CreationParameters - Describes parameters for creating application-scoped volumes. 426 CreationParameters BasicApplicationScopedVolumeCreationParameters `json:"creationParameters,omitempty"` 427 // Name - Name of the volume being referenced. 428 Name *string `json:"name,omitempty"` 429 // ReadOnly - The flag indicating whether the volume is read only. Default is 'false'. 430 ReadOnly *bool `json:"readOnly,omitempty"` 431 // DestinationPath - The path within the container at which the volume should be mounted. Only valid path characters are allowed. 432 DestinationPath *string `json:"destinationPath,omitempty"` 433} 434 435// UnmarshalJSON is the custom unmarshaler for ApplicationScopedVolume struct. 436func (asv *ApplicationScopedVolume) UnmarshalJSON(body []byte) error { 437 var m map[string]*json.RawMessage 438 err := json.Unmarshal(body, &m) 439 if err != nil { 440 return err 441 } 442 for k, v := range m { 443 switch k { 444 case "creationParameters": 445 if v != nil { 446 creationParameters, err := unmarshalBasicApplicationScopedVolumeCreationParameters(*v) 447 if err != nil { 448 return err 449 } 450 asv.CreationParameters = creationParameters 451 } 452 case "name": 453 if v != nil { 454 var name string 455 err = json.Unmarshal(*v, &name) 456 if err != nil { 457 return err 458 } 459 asv.Name = &name 460 } 461 case "readOnly": 462 if v != nil { 463 var readOnly bool 464 err = json.Unmarshal(*v, &readOnly) 465 if err != nil { 466 return err 467 } 468 asv.ReadOnly = &readOnly 469 } 470 case "destinationPath": 471 if v != nil { 472 var destinationPath string 473 err = json.Unmarshal(*v, &destinationPath) 474 if err != nil { 475 return err 476 } 477 asv.DestinationPath = &destinationPath 478 } 479 } 480 } 481 482 return nil 483} 484 485// BasicApplicationScopedVolumeCreationParameters describes parameters for creating application-scoped volumes. 486type BasicApplicationScopedVolumeCreationParameters interface { 487 AsApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk() (*ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk, bool) 488 AsApplicationScopedVolumeCreationParameters() (*ApplicationScopedVolumeCreationParameters, bool) 489} 490 491// ApplicationScopedVolumeCreationParameters describes parameters for creating application-scoped volumes. 492type ApplicationScopedVolumeCreationParameters struct { 493 // Description - User readable description of the volume. 494 Description *string `json:"description,omitempty"` 495 // Kind - Possible values include: 'KindApplicationScopedVolumeCreationParameters', 'KindServiceFabricVolumeDisk' 496 Kind KindBasicApplicationScopedVolumeCreationParameters `json:"kind,omitempty"` 497} 498 499func unmarshalBasicApplicationScopedVolumeCreationParameters(body []byte) (BasicApplicationScopedVolumeCreationParameters, error) { 500 var m map[string]interface{} 501 err := json.Unmarshal(body, &m) 502 if err != nil { 503 return nil, err 504 } 505 506 switch m["kind"] { 507 case string(KindServiceFabricVolumeDisk): 508 var asvcpsfvd ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk 509 err := json.Unmarshal(body, &asvcpsfvd) 510 return asvcpsfvd, err 511 default: 512 var asvcp ApplicationScopedVolumeCreationParameters 513 err := json.Unmarshal(body, &asvcp) 514 return asvcp, err 515 } 516} 517func unmarshalBasicApplicationScopedVolumeCreationParametersArray(body []byte) ([]BasicApplicationScopedVolumeCreationParameters, error) { 518 var rawMessages []*json.RawMessage 519 err := json.Unmarshal(body, &rawMessages) 520 if err != nil { 521 return nil, err 522 } 523 524 asvcpArray := make([]BasicApplicationScopedVolumeCreationParameters, len(rawMessages)) 525 526 for index, rawMessage := range rawMessages { 527 asvcp, err := unmarshalBasicApplicationScopedVolumeCreationParameters(*rawMessage) 528 if err != nil { 529 return nil, err 530 } 531 asvcpArray[index] = asvcp 532 } 533 return asvcpArray, nil 534} 535 536// MarshalJSON is the custom marshaler for ApplicationScopedVolumeCreationParameters. 537func (asvcp ApplicationScopedVolumeCreationParameters) MarshalJSON() ([]byte, error) { 538 asvcp.Kind = KindApplicationScopedVolumeCreationParameters 539 objectMap := make(map[string]interface{}) 540 if asvcp.Description != nil { 541 objectMap["description"] = asvcp.Description 542 } 543 if asvcp.Kind != "" { 544 objectMap["kind"] = asvcp.Kind 545 } 546 return json.Marshal(objectMap) 547} 548 549// AsApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk is the BasicApplicationScopedVolumeCreationParameters implementation for ApplicationScopedVolumeCreationParameters. 550func (asvcp ApplicationScopedVolumeCreationParameters) AsApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk() (*ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk, bool) { 551 return nil, false 552} 553 554// AsApplicationScopedVolumeCreationParameters is the BasicApplicationScopedVolumeCreationParameters implementation for ApplicationScopedVolumeCreationParameters. 555func (asvcp ApplicationScopedVolumeCreationParameters) AsApplicationScopedVolumeCreationParameters() (*ApplicationScopedVolumeCreationParameters, bool) { 556 return &asvcp, true 557} 558 559// AsBasicApplicationScopedVolumeCreationParameters is the BasicApplicationScopedVolumeCreationParameters implementation for ApplicationScopedVolumeCreationParameters. 560func (asvcp ApplicationScopedVolumeCreationParameters) AsBasicApplicationScopedVolumeCreationParameters() (BasicApplicationScopedVolumeCreationParameters, bool) { 561 return &asvcp, true 562} 563 564// ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk describes parameters for creating 565// application-scoped volumes provided by Service Fabric Volume Disks 566type ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk struct { 567 // SizeDisk - Volume size. Possible values include: 'Small', 'Medium', 'Large' 568 SizeDisk SizeTypes `json:"sizeDisk,omitempty"` 569 // Description - User readable description of the volume. 570 Description *string `json:"description,omitempty"` 571 // Kind - Possible values include: 'KindApplicationScopedVolumeCreationParameters', 'KindServiceFabricVolumeDisk' 572 Kind KindBasicApplicationScopedVolumeCreationParameters `json:"kind,omitempty"` 573} 574 575// MarshalJSON is the custom marshaler for ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk. 576func (asvcpsfvd ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk) MarshalJSON() ([]byte, error) { 577 asvcpsfvd.Kind = KindServiceFabricVolumeDisk 578 objectMap := make(map[string]interface{}) 579 if asvcpsfvd.SizeDisk != "" { 580 objectMap["sizeDisk"] = asvcpsfvd.SizeDisk 581 } 582 if asvcpsfvd.Description != nil { 583 objectMap["description"] = asvcpsfvd.Description 584 } 585 if asvcpsfvd.Kind != "" { 586 objectMap["kind"] = asvcpsfvd.Kind 587 } 588 return json.Marshal(objectMap) 589} 590 591// AsApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk is the BasicApplicationScopedVolumeCreationParameters implementation for ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk. 592func (asvcpsfvd ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk) AsApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk() (*ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk, bool) { 593 return &asvcpsfvd, true 594} 595 596// AsApplicationScopedVolumeCreationParameters is the BasicApplicationScopedVolumeCreationParameters implementation for ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk. 597func (asvcpsfvd ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk) AsApplicationScopedVolumeCreationParameters() (*ApplicationScopedVolumeCreationParameters, bool) { 598 return nil, false 599} 600 601// AsBasicApplicationScopedVolumeCreationParameters is the BasicApplicationScopedVolumeCreationParameters implementation for ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk. 602func (asvcpsfvd ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk) AsBasicApplicationScopedVolumeCreationParameters() (BasicApplicationScopedVolumeCreationParameters, bool) { 603 return &asvcpsfvd, true 604} 605 606// BasicAutoScalingMechanism describes the mechanism for performing auto scaling operation. Derived classes will 607// describe the actual mechanism. 608type BasicAutoScalingMechanism interface { 609 AsAddRemoveReplicaScalingMechanism() (*AddRemoveReplicaScalingMechanism, bool) 610 AsAutoScalingMechanism() (*AutoScalingMechanism, bool) 611} 612 613// AutoScalingMechanism describes the mechanism for performing auto scaling operation. Derived classes will 614// describe the actual mechanism. 615type AutoScalingMechanism struct { 616 // Kind - Possible values include: 'KindAutoScalingMechanism', 'KindAddRemoveReplica' 617 Kind KindBasicAutoScalingMechanism `json:"kind,omitempty"` 618} 619 620func unmarshalBasicAutoScalingMechanism(body []byte) (BasicAutoScalingMechanism, error) { 621 var m map[string]interface{} 622 err := json.Unmarshal(body, &m) 623 if err != nil { 624 return nil, err 625 } 626 627 switch m["kind"] { 628 case string(KindAddRemoveReplica): 629 var arrsm AddRemoveReplicaScalingMechanism 630 err := json.Unmarshal(body, &arrsm) 631 return arrsm, err 632 default: 633 var asm AutoScalingMechanism 634 err := json.Unmarshal(body, &asm) 635 return asm, err 636 } 637} 638func unmarshalBasicAutoScalingMechanismArray(body []byte) ([]BasicAutoScalingMechanism, error) { 639 var rawMessages []*json.RawMessage 640 err := json.Unmarshal(body, &rawMessages) 641 if err != nil { 642 return nil, err 643 } 644 645 asmArray := make([]BasicAutoScalingMechanism, len(rawMessages)) 646 647 for index, rawMessage := range rawMessages { 648 asm, err := unmarshalBasicAutoScalingMechanism(*rawMessage) 649 if err != nil { 650 return nil, err 651 } 652 asmArray[index] = asm 653 } 654 return asmArray, nil 655} 656 657// MarshalJSON is the custom marshaler for AutoScalingMechanism. 658func (asm AutoScalingMechanism) MarshalJSON() ([]byte, error) { 659 asm.Kind = KindAutoScalingMechanism 660 objectMap := make(map[string]interface{}) 661 if asm.Kind != "" { 662 objectMap["kind"] = asm.Kind 663 } 664 return json.Marshal(objectMap) 665} 666 667// AsAddRemoveReplicaScalingMechanism is the BasicAutoScalingMechanism implementation for AutoScalingMechanism. 668func (asm AutoScalingMechanism) AsAddRemoveReplicaScalingMechanism() (*AddRemoveReplicaScalingMechanism, bool) { 669 return nil, false 670} 671 672// AsAutoScalingMechanism is the BasicAutoScalingMechanism implementation for AutoScalingMechanism. 673func (asm AutoScalingMechanism) AsAutoScalingMechanism() (*AutoScalingMechanism, bool) { 674 return &asm, true 675} 676 677// AsBasicAutoScalingMechanism is the BasicAutoScalingMechanism implementation for AutoScalingMechanism. 678func (asm AutoScalingMechanism) AsBasicAutoScalingMechanism() (BasicAutoScalingMechanism, bool) { 679 return &asm, true 680} 681 682// BasicAutoScalingMetric describes the metric that is used for triggering auto scaling operation. Derived classes will 683// describe resources or metrics. 684type BasicAutoScalingMetric interface { 685 AsAutoScalingResourceMetric() (*AutoScalingResourceMetric, bool) 686 AsAutoScalingMetric() (*AutoScalingMetric, bool) 687} 688 689// AutoScalingMetric describes the metric that is used for triggering auto scaling operation. Derived classes 690// will describe resources or metrics. 691type AutoScalingMetric struct { 692 // Kind - Possible values include: 'KindAutoScalingMetric', 'KindResource' 693 Kind KindBasicAutoScalingMetric `json:"kind,omitempty"` 694} 695 696func unmarshalBasicAutoScalingMetric(body []byte) (BasicAutoScalingMetric, error) { 697 var m map[string]interface{} 698 err := json.Unmarshal(body, &m) 699 if err != nil { 700 return nil, err 701 } 702 703 switch m["kind"] { 704 case string(KindResource): 705 var asrm AutoScalingResourceMetric 706 err := json.Unmarshal(body, &asrm) 707 return asrm, err 708 default: 709 var asm AutoScalingMetric 710 err := json.Unmarshal(body, &asm) 711 return asm, err 712 } 713} 714func unmarshalBasicAutoScalingMetricArray(body []byte) ([]BasicAutoScalingMetric, error) { 715 var rawMessages []*json.RawMessage 716 err := json.Unmarshal(body, &rawMessages) 717 if err != nil { 718 return nil, err 719 } 720 721 asmArray := make([]BasicAutoScalingMetric, len(rawMessages)) 722 723 for index, rawMessage := range rawMessages { 724 asm, err := unmarshalBasicAutoScalingMetric(*rawMessage) 725 if err != nil { 726 return nil, err 727 } 728 asmArray[index] = asm 729 } 730 return asmArray, nil 731} 732 733// MarshalJSON is the custom marshaler for AutoScalingMetric. 734func (asm AutoScalingMetric) MarshalJSON() ([]byte, error) { 735 asm.Kind = KindAutoScalingMetric 736 objectMap := make(map[string]interface{}) 737 if asm.Kind != "" { 738 objectMap["kind"] = asm.Kind 739 } 740 return json.Marshal(objectMap) 741} 742 743// AsAutoScalingResourceMetric is the BasicAutoScalingMetric implementation for AutoScalingMetric. 744func (asm AutoScalingMetric) AsAutoScalingResourceMetric() (*AutoScalingResourceMetric, bool) { 745 return nil, false 746} 747 748// AsAutoScalingMetric is the BasicAutoScalingMetric implementation for AutoScalingMetric. 749func (asm AutoScalingMetric) AsAutoScalingMetric() (*AutoScalingMetric, bool) { 750 return &asm, true 751} 752 753// AsBasicAutoScalingMetric is the BasicAutoScalingMetric implementation for AutoScalingMetric. 754func (asm AutoScalingMetric) AsBasicAutoScalingMetric() (BasicAutoScalingMetric, bool) { 755 return &asm, true 756} 757 758// AutoScalingPolicy describes the auto scaling policy 759type AutoScalingPolicy struct { 760 // Name - The name of the auto scaling policy. 761 Name *string `json:"name,omitempty"` 762 // Trigger - Determines when auto scaling operation will be invoked. 763 Trigger BasicAutoScalingTrigger `json:"trigger,omitempty"` 764 // Mechanism - The mechanism that is used to scale when auto scaling operation is invoked. 765 Mechanism BasicAutoScalingMechanism `json:"mechanism,omitempty"` 766} 767 768// UnmarshalJSON is the custom unmarshaler for AutoScalingPolicy struct. 769func (asp *AutoScalingPolicy) UnmarshalJSON(body []byte) error { 770 var m map[string]*json.RawMessage 771 err := json.Unmarshal(body, &m) 772 if err != nil { 773 return err 774 } 775 for k, v := range m { 776 switch k { 777 case "name": 778 if v != nil { 779 var name string 780 err = json.Unmarshal(*v, &name) 781 if err != nil { 782 return err 783 } 784 asp.Name = &name 785 } 786 case "trigger": 787 if v != nil { 788 trigger, err := unmarshalBasicAutoScalingTrigger(*v) 789 if err != nil { 790 return err 791 } 792 asp.Trigger = trigger 793 } 794 case "mechanism": 795 if v != nil { 796 mechanism, err := unmarshalBasicAutoScalingMechanism(*v) 797 if err != nil { 798 return err 799 } 800 asp.Mechanism = mechanism 801 } 802 } 803 } 804 805 return nil 806} 807 808// AutoScalingResourceMetric describes the resource that is used for triggering auto scaling. 809type AutoScalingResourceMetric struct { 810 // Name - Name of the resource. Possible values include: 'CPU', 'MemoryInGB' 811 Name AutoScalingResourceMetricName `json:"name,omitempty"` 812 // Kind - Possible values include: 'KindAutoScalingMetric', 'KindResource' 813 Kind KindBasicAutoScalingMetric `json:"kind,omitempty"` 814} 815 816// MarshalJSON is the custom marshaler for AutoScalingResourceMetric. 817func (asrm AutoScalingResourceMetric) MarshalJSON() ([]byte, error) { 818 asrm.Kind = KindResource 819 objectMap := make(map[string]interface{}) 820 if asrm.Name != "" { 821 objectMap["name"] = asrm.Name 822 } 823 if asrm.Kind != "" { 824 objectMap["kind"] = asrm.Kind 825 } 826 return json.Marshal(objectMap) 827} 828 829// AsAutoScalingResourceMetric is the BasicAutoScalingMetric implementation for AutoScalingResourceMetric. 830func (asrm AutoScalingResourceMetric) AsAutoScalingResourceMetric() (*AutoScalingResourceMetric, bool) { 831 return &asrm, true 832} 833 834// AsAutoScalingMetric is the BasicAutoScalingMetric implementation for AutoScalingResourceMetric. 835func (asrm AutoScalingResourceMetric) AsAutoScalingMetric() (*AutoScalingMetric, bool) { 836 return nil, false 837} 838 839// AsBasicAutoScalingMetric is the BasicAutoScalingMetric implementation for AutoScalingResourceMetric. 840func (asrm AutoScalingResourceMetric) AsBasicAutoScalingMetric() (BasicAutoScalingMetric, bool) { 841 return &asrm, true 842} 843 844// BasicAutoScalingTrigger describes the trigger for performing auto scaling operation. 845type BasicAutoScalingTrigger interface { 846 AsAverageLoadScalingTrigger() (*AverageLoadScalingTrigger, bool) 847 AsAutoScalingTrigger() (*AutoScalingTrigger, bool) 848} 849 850// AutoScalingTrigger describes the trigger for performing auto scaling operation. 851type AutoScalingTrigger struct { 852 // Kind - Possible values include: 'KindAutoScalingTrigger', 'KindAverageLoad' 853 Kind KindBasicAutoScalingTrigger `json:"kind,omitempty"` 854} 855 856func unmarshalBasicAutoScalingTrigger(body []byte) (BasicAutoScalingTrigger, error) { 857 var m map[string]interface{} 858 err := json.Unmarshal(body, &m) 859 if err != nil { 860 return nil, err 861 } 862 863 switch m["kind"] { 864 case string(KindAverageLoad): 865 var alst AverageLoadScalingTrigger 866 err := json.Unmarshal(body, &alst) 867 return alst, err 868 default: 869 var astVar AutoScalingTrigger 870 err := json.Unmarshal(body, &astVar) 871 return astVar, err 872 } 873} 874func unmarshalBasicAutoScalingTriggerArray(body []byte) ([]BasicAutoScalingTrigger, error) { 875 var rawMessages []*json.RawMessage 876 err := json.Unmarshal(body, &rawMessages) 877 if err != nil { 878 return nil, err 879 } 880 881 astVarArray := make([]BasicAutoScalingTrigger, len(rawMessages)) 882 883 for index, rawMessage := range rawMessages { 884 astVar, err := unmarshalBasicAutoScalingTrigger(*rawMessage) 885 if err != nil { 886 return nil, err 887 } 888 astVarArray[index] = astVar 889 } 890 return astVarArray, nil 891} 892 893// MarshalJSON is the custom marshaler for AutoScalingTrigger. 894func (astVar AutoScalingTrigger) MarshalJSON() ([]byte, error) { 895 astVar.Kind = KindAutoScalingTrigger 896 objectMap := make(map[string]interface{}) 897 if astVar.Kind != "" { 898 objectMap["kind"] = astVar.Kind 899 } 900 return json.Marshal(objectMap) 901} 902 903// AsAverageLoadScalingTrigger is the BasicAutoScalingTrigger implementation for AutoScalingTrigger. 904func (astVar AutoScalingTrigger) AsAverageLoadScalingTrigger() (*AverageLoadScalingTrigger, bool) { 905 return nil, false 906} 907 908// AsAutoScalingTrigger is the BasicAutoScalingTrigger implementation for AutoScalingTrigger. 909func (astVar AutoScalingTrigger) AsAutoScalingTrigger() (*AutoScalingTrigger, bool) { 910 return &astVar, true 911} 912 913// AsBasicAutoScalingTrigger is the BasicAutoScalingTrigger implementation for AutoScalingTrigger. 914func (astVar AutoScalingTrigger) AsBasicAutoScalingTrigger() (BasicAutoScalingTrigger, bool) { 915 return &astVar, true 916} 917 918// AvailableOperationDisplay an operation available at the listed Azure resource provider. 919type AvailableOperationDisplay struct { 920 // Provider - Name of the operation provider. 921 Provider *string `json:"provider,omitempty"` 922 // Resource - Name of the resource on which the operation is available. 923 Resource *string `json:"resource,omitempty"` 924 // Operation - Name of the available operation. 925 Operation *string `json:"operation,omitempty"` 926 // Description - Description of the available operation. 927 Description *string `json:"description,omitempty"` 928} 929 930// AverageLoadScalingTrigger describes the average load trigger used for auto scaling. 931type AverageLoadScalingTrigger struct { 932 // Metric - Description of the metric that is used for scaling. 933 Metric BasicAutoScalingMetric `json:"metric,omitempty"` 934 // LowerLoadThreshold - Lower load threshold (if average load is below this threshold, service will scale down). 935 LowerLoadThreshold *float64 `json:"lowerLoadThreshold,omitempty"` 936 // UpperLoadThreshold - Upper load threshold (if average load is above this threshold, service will scale up). 937 UpperLoadThreshold *float64 `json:"upperLoadThreshold,omitempty"` 938 // ScaleIntervalInSeconds - Scale interval that indicates how often will this trigger be checked. 939 ScaleIntervalInSeconds *int32 `json:"scaleIntervalInSeconds,omitempty"` 940 // Kind - Possible values include: 'KindAutoScalingTrigger', 'KindAverageLoad' 941 Kind KindBasicAutoScalingTrigger `json:"kind,omitempty"` 942} 943 944// MarshalJSON is the custom marshaler for AverageLoadScalingTrigger. 945func (alst AverageLoadScalingTrigger) MarshalJSON() ([]byte, error) { 946 alst.Kind = KindAverageLoad 947 objectMap := make(map[string]interface{}) 948 objectMap["metric"] = alst.Metric 949 if alst.LowerLoadThreshold != nil { 950 objectMap["lowerLoadThreshold"] = alst.LowerLoadThreshold 951 } 952 if alst.UpperLoadThreshold != nil { 953 objectMap["upperLoadThreshold"] = alst.UpperLoadThreshold 954 } 955 if alst.ScaleIntervalInSeconds != nil { 956 objectMap["scaleIntervalInSeconds"] = alst.ScaleIntervalInSeconds 957 } 958 if alst.Kind != "" { 959 objectMap["kind"] = alst.Kind 960 } 961 return json.Marshal(objectMap) 962} 963 964// AsAverageLoadScalingTrigger is the BasicAutoScalingTrigger implementation for AverageLoadScalingTrigger. 965func (alst AverageLoadScalingTrigger) AsAverageLoadScalingTrigger() (*AverageLoadScalingTrigger, bool) { 966 return &alst, true 967} 968 969// AsAutoScalingTrigger is the BasicAutoScalingTrigger implementation for AverageLoadScalingTrigger. 970func (alst AverageLoadScalingTrigger) AsAutoScalingTrigger() (*AutoScalingTrigger, bool) { 971 return nil, false 972} 973 974// AsBasicAutoScalingTrigger is the BasicAutoScalingTrigger implementation for AverageLoadScalingTrigger. 975func (alst AverageLoadScalingTrigger) AsBasicAutoScalingTrigger() (BasicAutoScalingTrigger, bool) { 976 return &alst, true 977} 978 979// UnmarshalJSON is the custom unmarshaler for AverageLoadScalingTrigger struct. 980func (alst *AverageLoadScalingTrigger) UnmarshalJSON(body []byte) error { 981 var m map[string]*json.RawMessage 982 err := json.Unmarshal(body, &m) 983 if err != nil { 984 return err 985 } 986 for k, v := range m { 987 switch k { 988 case "metric": 989 if v != nil { 990 metric, err := unmarshalBasicAutoScalingMetric(*v) 991 if err != nil { 992 return err 993 } 994 alst.Metric = metric 995 } 996 case "lowerLoadThreshold": 997 if v != nil { 998 var lowerLoadThreshold float64 999 err = json.Unmarshal(*v, &lowerLoadThreshold) 1000 if err != nil { 1001 return err 1002 } 1003 alst.LowerLoadThreshold = &lowerLoadThreshold 1004 } 1005 case "upperLoadThreshold": 1006 if v != nil { 1007 var upperLoadThreshold float64 1008 err = json.Unmarshal(*v, &upperLoadThreshold) 1009 if err != nil { 1010 return err 1011 } 1012 alst.UpperLoadThreshold = &upperLoadThreshold 1013 } 1014 case "scaleIntervalInSeconds": 1015 if v != nil { 1016 var scaleIntervalInSeconds int32 1017 err = json.Unmarshal(*v, &scaleIntervalInSeconds) 1018 if err != nil { 1019 return err 1020 } 1021 alst.ScaleIntervalInSeconds = &scaleIntervalInSeconds 1022 } 1023 case "kind": 1024 if v != nil { 1025 var kind KindBasicAutoScalingTrigger 1026 err = json.Unmarshal(*v, &kind) 1027 if err != nil { 1028 return err 1029 } 1030 alst.Kind = kind 1031 } 1032 } 1033 } 1034 1035 return nil 1036} 1037 1038// AzureInternalMonitoringPipelineSinkDescription diagnostics settings for Geneva. 1039type AzureInternalMonitoringPipelineSinkDescription struct { 1040 // AccountName - Azure Internal monitoring pipeline account. 1041 AccountName *string `json:"accountName,omitempty"` 1042 // Namespace - Azure Internal monitoring pipeline account namespace. 1043 Namespace *string `json:"namespace,omitempty"` 1044 // MaConfigURL - Azure Internal monitoring agent configuration. 1045 MaConfigURL *string `json:"maConfigUrl,omitempty"` 1046 // FluentdConfigURL - Azure Internal monitoring agent fluentd configuration. 1047 FluentdConfigURL interface{} `json:"fluentdConfigUrl,omitempty"` 1048 // AutoKeyConfigURL - Azure Internal monitoring pipeline autokey associated with the certificate. 1049 AutoKeyConfigURL *string `json:"autoKeyConfigUrl,omitempty"` 1050 // Name - Name of the sink. This value is referenced by DiagnosticsReferenceDescription 1051 Name *string `json:"name,omitempty"` 1052 // Description - A description of the sink. 1053 Description *string `json:"description,omitempty"` 1054 // Kind - Possible values include: 'KindDiagnosticsSinkProperties', 'KindAzureInternalMonitoringPipeline' 1055 Kind KindBasicDiagnosticsSinkProperties `json:"kind,omitempty"` 1056} 1057 1058// MarshalJSON is the custom marshaler for AzureInternalMonitoringPipelineSinkDescription. 1059func (aimpsd AzureInternalMonitoringPipelineSinkDescription) MarshalJSON() ([]byte, error) { 1060 aimpsd.Kind = KindAzureInternalMonitoringPipeline 1061 objectMap := make(map[string]interface{}) 1062 if aimpsd.AccountName != nil { 1063 objectMap["accountName"] = aimpsd.AccountName 1064 } 1065 if aimpsd.Namespace != nil { 1066 objectMap["namespace"] = aimpsd.Namespace 1067 } 1068 if aimpsd.MaConfigURL != nil { 1069 objectMap["maConfigUrl"] = aimpsd.MaConfigURL 1070 } 1071 if aimpsd.FluentdConfigURL != nil { 1072 objectMap["fluentdConfigUrl"] = aimpsd.FluentdConfigURL 1073 } 1074 if aimpsd.AutoKeyConfigURL != nil { 1075 objectMap["autoKeyConfigUrl"] = aimpsd.AutoKeyConfigURL 1076 } 1077 if aimpsd.Name != nil { 1078 objectMap["name"] = aimpsd.Name 1079 } 1080 if aimpsd.Description != nil { 1081 objectMap["description"] = aimpsd.Description 1082 } 1083 if aimpsd.Kind != "" { 1084 objectMap["kind"] = aimpsd.Kind 1085 } 1086 return json.Marshal(objectMap) 1087} 1088 1089// AsAzureInternalMonitoringPipelineSinkDescription is the BasicDiagnosticsSinkProperties implementation for AzureInternalMonitoringPipelineSinkDescription. 1090func (aimpsd AzureInternalMonitoringPipelineSinkDescription) AsAzureInternalMonitoringPipelineSinkDescription() (*AzureInternalMonitoringPipelineSinkDescription, bool) { 1091 return &aimpsd, true 1092} 1093 1094// AsDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for AzureInternalMonitoringPipelineSinkDescription. 1095func (aimpsd AzureInternalMonitoringPipelineSinkDescription) AsDiagnosticsSinkProperties() (*DiagnosticsSinkProperties, bool) { 1096 return nil, false 1097} 1098 1099// AsBasicDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for AzureInternalMonitoringPipelineSinkDescription. 1100func (aimpsd AzureInternalMonitoringPipelineSinkDescription) AsBasicDiagnosticsSinkProperties() (BasicDiagnosticsSinkProperties, bool) { 1101 return &aimpsd, true 1102} 1103 1104// ContainerCodePackageProperties describes a container and its runtime properties. 1105type ContainerCodePackageProperties struct { 1106 // Name - The name of the code package. 1107 Name *string `json:"name,omitempty"` 1108 // Image - The Container image to use. 1109 Image *string `json:"image,omitempty"` 1110 // ImageRegistryCredential - Image registry credential. 1111 ImageRegistryCredential *ImageRegistryCredential `json:"imageRegistryCredential,omitempty"` 1112 // Entrypoint - Override for the default entry point in the container. 1113 Entrypoint *string `json:"entrypoint,omitempty"` 1114 // Commands - Command array to execute within the container in exec form. 1115 Commands *[]string `json:"commands,omitempty"` 1116 // EnvironmentVariables - The environment variables to set in this container 1117 EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` 1118 // Settings - The settings to set in this container. The setting file path can be fetched from environment variable "Fabric_SettingPath". The path for Windows container is "C:\\secrets". The path for Linux container is "/var/secrets". 1119 Settings *[]Setting `json:"settings,omitempty"` 1120 // Labels - The labels to set in this container. 1121 Labels *[]ContainerLabel `json:"labels,omitempty"` 1122 // Endpoints - The endpoints exposed by this container. 1123 Endpoints *[]EndpointProperties `json:"endpoints,omitempty"` 1124 // Resources - The resources required by this container. 1125 Resources *ResourceRequirements `json:"resources,omitempty"` 1126 // VolumeRefs - Volumes to be attached to the container. The lifetime of these volumes is independent of the application's lifetime. 1127 VolumeRefs *[]VolumeReference `json:"volumeRefs,omitempty"` 1128 // Volumes - Volumes to be attached to the container. The lifetime of these volumes is scoped to the application's lifetime. 1129 Volumes *[]ApplicationScopedVolume `json:"volumes,omitempty"` 1130 // Diagnostics - Reference to sinks in DiagnosticsDescription. 1131 Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` 1132 // ReliableCollectionsRefs - A list of ReliableCollection resources used by this particular code package. Please refer to ReliableCollectionsRef for more details. 1133 ReliableCollectionsRefs *[]ReliableCollectionsRef `json:"reliableCollectionsRefs,omitempty"` 1134 // InstanceView - READ-ONLY; Runtime information of a container instance. 1135 InstanceView *ContainerInstanceView `json:"instanceView,omitempty"` 1136} 1137 1138// MarshalJSON is the custom marshaler for ContainerCodePackageProperties. 1139func (ccpp ContainerCodePackageProperties) MarshalJSON() ([]byte, error) { 1140 objectMap := make(map[string]interface{}) 1141 if ccpp.Name != nil { 1142 objectMap["name"] = ccpp.Name 1143 } 1144 if ccpp.Image != nil { 1145 objectMap["image"] = ccpp.Image 1146 } 1147 if ccpp.ImageRegistryCredential != nil { 1148 objectMap["imageRegistryCredential"] = ccpp.ImageRegistryCredential 1149 } 1150 if ccpp.Entrypoint != nil { 1151 objectMap["entrypoint"] = ccpp.Entrypoint 1152 } 1153 if ccpp.Commands != nil { 1154 objectMap["commands"] = ccpp.Commands 1155 } 1156 if ccpp.EnvironmentVariables != nil { 1157 objectMap["environmentVariables"] = ccpp.EnvironmentVariables 1158 } 1159 if ccpp.Settings != nil { 1160 objectMap["settings"] = ccpp.Settings 1161 } 1162 if ccpp.Labels != nil { 1163 objectMap["labels"] = ccpp.Labels 1164 } 1165 if ccpp.Endpoints != nil { 1166 objectMap["endpoints"] = ccpp.Endpoints 1167 } 1168 if ccpp.Resources != nil { 1169 objectMap["resources"] = ccpp.Resources 1170 } 1171 if ccpp.VolumeRefs != nil { 1172 objectMap["volumeRefs"] = ccpp.VolumeRefs 1173 } 1174 if ccpp.Volumes != nil { 1175 objectMap["volumes"] = ccpp.Volumes 1176 } 1177 if ccpp.Diagnostics != nil { 1178 objectMap["diagnostics"] = ccpp.Diagnostics 1179 } 1180 if ccpp.ReliableCollectionsRefs != nil { 1181 objectMap["reliableCollectionsRefs"] = ccpp.ReliableCollectionsRefs 1182 } 1183 return json.Marshal(objectMap) 1184} 1185 1186// ContainerEvent a container event. 1187type ContainerEvent struct { 1188 // Name - The name of the container event. 1189 Name *string `json:"name,omitempty"` 1190 // Count - The count of the event. 1191 Count *int32 `json:"count,omitempty"` 1192 // FirstTimestamp - Date/time of the first event. 1193 FirstTimestamp *string `json:"firstTimestamp,omitempty"` 1194 // LastTimestamp - Date/time of the last event. 1195 LastTimestamp *string `json:"lastTimestamp,omitempty"` 1196 // Message - The event message 1197 Message *string `json:"message,omitempty"` 1198 // Type - The event type. 1199 Type *string `json:"type,omitempty"` 1200} 1201 1202// ContainerInstanceView runtime information of a container instance. 1203type ContainerInstanceView struct { 1204 // RestartCount - The number of times the container has been restarted. 1205 RestartCount *int32 `json:"restartCount,omitempty"` 1206 // CurrentState - Current container instance state. 1207 CurrentState *ContainerState `json:"currentState,omitempty"` 1208 // PreviousState - Previous container instance state. 1209 PreviousState *ContainerState `json:"previousState,omitempty"` 1210 // Events - The events of this container instance. 1211 Events *[]ContainerEvent `json:"events,omitempty"` 1212} 1213 1214// ContainerLabel describes a container label. 1215type ContainerLabel struct { 1216 // Name - The name of the container label. 1217 Name *string `json:"name,omitempty"` 1218 // Value - The value of the container label. 1219 Value *string `json:"value,omitempty"` 1220} 1221 1222// ContainerLogs container logs. 1223type ContainerLogs struct { 1224 autorest.Response `json:"-"` 1225 // Content - Container logs. 1226 Content *string `json:"content,omitempty"` 1227} 1228 1229// ContainerState the container state. 1230type ContainerState struct { 1231 // State - The state of this container 1232 State *string `json:"state,omitempty"` 1233 // StartTime - Date/time when the container state started. 1234 StartTime *date.Time `json:"startTime,omitempty"` 1235 // ExitCode - The container exit code. 1236 ExitCode *string `json:"exitCode,omitempty"` 1237 // FinishTime - Date/time when the container state finished. 1238 FinishTime *date.Time `json:"finishTime,omitempty"` 1239 // DetailStatus - Human-readable status of this state. 1240 DetailStatus *string `json:"detailStatus,omitempty"` 1241} 1242 1243// DiagnosticsDescription describes the diagnostics options available 1244type DiagnosticsDescription struct { 1245 // Sinks - List of supported sinks that can be referenced. 1246 Sinks *[]BasicDiagnosticsSinkProperties `json:"sinks,omitempty"` 1247 // Enabled - Status of whether or not sinks are enabled. 1248 Enabled *bool `json:"enabled,omitempty"` 1249 // DefaultSinkRefs - The sinks to be used if diagnostics is enabled. Sink choices can be overridden at the service and code package level. 1250 DefaultSinkRefs *[]string `json:"defaultSinkRefs,omitempty"` 1251} 1252 1253// UnmarshalJSON is the custom unmarshaler for DiagnosticsDescription struct. 1254func (dd *DiagnosticsDescription) UnmarshalJSON(body []byte) error { 1255 var m map[string]*json.RawMessage 1256 err := json.Unmarshal(body, &m) 1257 if err != nil { 1258 return err 1259 } 1260 for k, v := range m { 1261 switch k { 1262 case "sinks": 1263 if v != nil { 1264 sinks, err := unmarshalBasicDiagnosticsSinkPropertiesArray(*v) 1265 if err != nil { 1266 return err 1267 } 1268 dd.Sinks = &sinks 1269 } 1270 case "enabled": 1271 if v != nil { 1272 var enabled bool 1273 err = json.Unmarshal(*v, &enabled) 1274 if err != nil { 1275 return err 1276 } 1277 dd.Enabled = &enabled 1278 } 1279 case "defaultSinkRefs": 1280 if v != nil { 1281 var defaultSinkRefs []string 1282 err = json.Unmarshal(*v, &defaultSinkRefs) 1283 if err != nil { 1284 return err 1285 } 1286 dd.DefaultSinkRefs = &defaultSinkRefs 1287 } 1288 } 1289 } 1290 1291 return nil 1292} 1293 1294// DiagnosticsRef reference to sinks in DiagnosticsDescription. 1295type DiagnosticsRef struct { 1296 // Enabled - Status of whether or not sinks are enabled. 1297 Enabled *bool `json:"enabled,omitempty"` 1298 // SinkRefs - List of sinks to be used if enabled. References the list of sinks in DiagnosticsDescription. 1299 SinkRefs *[]string `json:"sinkRefs,omitempty"` 1300} 1301 1302// BasicDiagnosticsSinkProperties properties of a DiagnosticsSink. 1303type BasicDiagnosticsSinkProperties interface { 1304 AsAzureInternalMonitoringPipelineSinkDescription() (*AzureInternalMonitoringPipelineSinkDescription, bool) 1305 AsDiagnosticsSinkProperties() (*DiagnosticsSinkProperties, bool) 1306} 1307 1308// DiagnosticsSinkProperties properties of a DiagnosticsSink. 1309type DiagnosticsSinkProperties struct { 1310 // Name - Name of the sink. This value is referenced by DiagnosticsReferenceDescription 1311 Name *string `json:"name,omitempty"` 1312 // Description - A description of the sink. 1313 Description *string `json:"description,omitempty"` 1314 // Kind - Possible values include: 'KindDiagnosticsSinkProperties', 'KindAzureInternalMonitoringPipeline' 1315 Kind KindBasicDiagnosticsSinkProperties `json:"kind,omitempty"` 1316} 1317 1318func unmarshalBasicDiagnosticsSinkProperties(body []byte) (BasicDiagnosticsSinkProperties, error) { 1319 var m map[string]interface{} 1320 err := json.Unmarshal(body, &m) 1321 if err != nil { 1322 return nil, err 1323 } 1324 1325 switch m["kind"] { 1326 case string(KindAzureInternalMonitoringPipeline): 1327 var aimpsd AzureInternalMonitoringPipelineSinkDescription 1328 err := json.Unmarshal(body, &aimpsd) 1329 return aimpsd, err 1330 default: 1331 var dsp DiagnosticsSinkProperties 1332 err := json.Unmarshal(body, &dsp) 1333 return dsp, err 1334 } 1335} 1336func unmarshalBasicDiagnosticsSinkPropertiesArray(body []byte) ([]BasicDiagnosticsSinkProperties, error) { 1337 var rawMessages []*json.RawMessage 1338 err := json.Unmarshal(body, &rawMessages) 1339 if err != nil { 1340 return nil, err 1341 } 1342 1343 dspArray := make([]BasicDiagnosticsSinkProperties, len(rawMessages)) 1344 1345 for index, rawMessage := range rawMessages { 1346 dsp, err := unmarshalBasicDiagnosticsSinkProperties(*rawMessage) 1347 if err != nil { 1348 return nil, err 1349 } 1350 dspArray[index] = dsp 1351 } 1352 return dspArray, nil 1353} 1354 1355// MarshalJSON is the custom marshaler for DiagnosticsSinkProperties. 1356func (dsp DiagnosticsSinkProperties) MarshalJSON() ([]byte, error) { 1357 dsp.Kind = KindDiagnosticsSinkProperties 1358 objectMap := make(map[string]interface{}) 1359 if dsp.Name != nil { 1360 objectMap["name"] = dsp.Name 1361 } 1362 if dsp.Description != nil { 1363 objectMap["description"] = dsp.Description 1364 } 1365 if dsp.Kind != "" { 1366 objectMap["kind"] = dsp.Kind 1367 } 1368 return json.Marshal(objectMap) 1369} 1370 1371// AsAzureInternalMonitoringPipelineSinkDescription is the BasicDiagnosticsSinkProperties implementation for DiagnosticsSinkProperties. 1372func (dsp DiagnosticsSinkProperties) AsAzureInternalMonitoringPipelineSinkDescription() (*AzureInternalMonitoringPipelineSinkDescription, bool) { 1373 return nil, false 1374} 1375 1376// AsDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for DiagnosticsSinkProperties. 1377func (dsp DiagnosticsSinkProperties) AsDiagnosticsSinkProperties() (*DiagnosticsSinkProperties, bool) { 1378 return &dsp, true 1379} 1380 1381// AsBasicDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for DiagnosticsSinkProperties. 1382func (dsp DiagnosticsSinkProperties) AsBasicDiagnosticsSinkProperties() (BasicDiagnosticsSinkProperties, bool) { 1383 return &dsp, true 1384} 1385 1386// EndpointProperties describes a container endpoint. 1387type EndpointProperties struct { 1388 // Name - The name of the endpoint. 1389 Name *string `json:"name,omitempty"` 1390 // Port - Port used by the container. 1391 Port *int32 `json:"port,omitempty"` 1392} 1393 1394// EndpointRef describes a reference to a service endpoint. 1395type EndpointRef struct { 1396 // Name - Name of the endpoint. 1397 Name *string `json:"name,omitempty"` 1398} 1399 1400// EnvironmentVariable describes an environment variable for the container. 1401type EnvironmentVariable struct { 1402 // Name - The name of the environment variable. 1403 Name *string `json:"name,omitempty"` 1404 // Value - The value of the environment variable. 1405 Value *string `json:"value,omitempty"` 1406} 1407 1408// ErrorDetailsModel error model details information 1409type ErrorDetailsModel struct { 1410 Code *string `json:"code,omitempty"` 1411 // Message - Error message. 1412 Message *string `json:"message,omitempty"` 1413} 1414 1415// ErrorErrorModel error model information 1416type ErrorErrorModel struct { 1417 Code *string `json:"code,omitempty"` 1418 // Message - Error message. 1419 Message *string `json:"message,omitempty"` 1420 InnerError *string `json:"innerError,omitempty"` 1421 // Details - List of error message details. 1422 Details *[]ErrorDetailsModel `json:"details,omitempty"` 1423} 1424 1425// ErrorModel the error details. 1426type ErrorModel struct { 1427 // Error - Error model information 1428 Error *ErrorErrorModel `json:"error,omitempty"` 1429} 1430 1431// GatewayDestination describes destination endpoint for routing traffic. 1432type GatewayDestination struct { 1433 // ApplicationName - Name of the service fabric Mesh application. 1434 ApplicationName *string `json:"applicationName,omitempty"` 1435 // ServiceName - service that contains the endpoint. 1436 ServiceName *string `json:"serviceName,omitempty"` 1437 // EndpointName - name of the endpoint in the service. 1438 EndpointName *string `json:"endpointName,omitempty"` 1439} 1440 1441// GatewayProperties describes properties of a gateway resource. 1442type GatewayProperties struct { 1443 // Description - User readable description of the gateway. 1444 Description *string `json:"description,omitempty"` 1445 // SourceNetwork - Network the gateway should listen on for requests. 1446 SourceNetwork *NetworkRef `json:"sourceNetwork,omitempty"` 1447 // DestinationNetwork - Network that the Application is using. 1448 DestinationNetwork *NetworkRef `json:"destinationNetwork,omitempty"` 1449 // TCP - Configuration for tcp connectivity for this gateway. 1450 TCP *[]TCPConfig `json:"tcp,omitempty"` 1451 // HTTP - Configuration for http connectivity for this gateway. 1452 HTTP *[]HTTPConfig `json:"http,omitempty"` 1453 // Status - READ-ONLY; Status of the resource. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 1454 Status ResourceStatus `json:"status,omitempty"` 1455 // StatusDetails - READ-ONLY; Gives additional information about the current status of the gateway. 1456 StatusDetails *string `json:"statusDetails,omitempty"` 1457 // IPAddress - READ-ONLY; IP address of the gateway. This is populated in the response and is ignored for incoming requests. 1458 IPAddress *string `json:"ipAddress,omitempty"` 1459} 1460 1461// MarshalJSON is the custom marshaler for GatewayProperties. 1462func (gp GatewayProperties) MarshalJSON() ([]byte, error) { 1463 objectMap := make(map[string]interface{}) 1464 if gp.Description != nil { 1465 objectMap["description"] = gp.Description 1466 } 1467 if gp.SourceNetwork != nil { 1468 objectMap["sourceNetwork"] = gp.SourceNetwork 1469 } 1470 if gp.DestinationNetwork != nil { 1471 objectMap["destinationNetwork"] = gp.DestinationNetwork 1472 } 1473 if gp.TCP != nil { 1474 objectMap["tcp"] = gp.TCP 1475 } 1476 if gp.HTTP != nil { 1477 objectMap["http"] = gp.HTTP 1478 } 1479 return json.Marshal(objectMap) 1480} 1481 1482// GatewayResourceDescription this type describes a gateway resource. 1483type GatewayResourceDescription struct { 1484 autorest.Response `json:"-"` 1485 // GatewayResourceProperties - This type describes properties of a gateway resource. 1486 *GatewayResourceProperties `json:"properties,omitempty"` 1487 // Tags - Resource tags. 1488 Tags map[string]*string `json:"tags"` 1489 // Location - The geo-location where the resource lives 1490 Location *string `json:"location,omitempty"` 1491 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1492 ID *string `json:"id,omitempty"` 1493 // Name - READ-ONLY; The name of the resource 1494 Name *string `json:"name,omitempty"` 1495 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1496 Type *string `json:"type,omitempty"` 1497} 1498 1499// MarshalJSON is the custom marshaler for GatewayResourceDescription. 1500func (grd GatewayResourceDescription) MarshalJSON() ([]byte, error) { 1501 objectMap := make(map[string]interface{}) 1502 if grd.GatewayResourceProperties != nil { 1503 objectMap["properties"] = grd.GatewayResourceProperties 1504 } 1505 if grd.Tags != nil { 1506 objectMap["tags"] = grd.Tags 1507 } 1508 if grd.Location != nil { 1509 objectMap["location"] = grd.Location 1510 } 1511 return json.Marshal(objectMap) 1512} 1513 1514// UnmarshalJSON is the custom unmarshaler for GatewayResourceDescription struct. 1515func (grd *GatewayResourceDescription) UnmarshalJSON(body []byte) error { 1516 var m map[string]*json.RawMessage 1517 err := json.Unmarshal(body, &m) 1518 if err != nil { 1519 return err 1520 } 1521 for k, v := range m { 1522 switch k { 1523 case "properties": 1524 if v != nil { 1525 var gatewayResourceProperties GatewayResourceProperties 1526 err = json.Unmarshal(*v, &gatewayResourceProperties) 1527 if err != nil { 1528 return err 1529 } 1530 grd.GatewayResourceProperties = &gatewayResourceProperties 1531 } 1532 case "tags": 1533 if v != nil { 1534 var tags map[string]*string 1535 err = json.Unmarshal(*v, &tags) 1536 if err != nil { 1537 return err 1538 } 1539 grd.Tags = tags 1540 } 1541 case "location": 1542 if v != nil { 1543 var location string 1544 err = json.Unmarshal(*v, &location) 1545 if err != nil { 1546 return err 1547 } 1548 grd.Location = &location 1549 } 1550 case "id": 1551 if v != nil { 1552 var ID string 1553 err = json.Unmarshal(*v, &ID) 1554 if err != nil { 1555 return err 1556 } 1557 grd.ID = &ID 1558 } 1559 case "name": 1560 if v != nil { 1561 var name string 1562 err = json.Unmarshal(*v, &name) 1563 if err != nil { 1564 return err 1565 } 1566 grd.Name = &name 1567 } 1568 case "type": 1569 if v != nil { 1570 var typeVar string 1571 err = json.Unmarshal(*v, &typeVar) 1572 if err != nil { 1573 return err 1574 } 1575 grd.Type = &typeVar 1576 } 1577 } 1578 } 1579 1580 return nil 1581} 1582 1583// GatewayResourceDescriptionList a pageable list of gateway resources. 1584type GatewayResourceDescriptionList struct { 1585 autorest.Response `json:"-"` 1586 // Value - One page of the list. 1587 Value *[]GatewayResourceDescription `json:"value,omitempty"` 1588 // NextLink - URI to fetch the next page of the list. 1589 NextLink *string `json:"nextLink,omitempty"` 1590} 1591 1592// GatewayResourceDescriptionListIterator provides access to a complete listing of 1593// GatewayResourceDescription values. 1594type GatewayResourceDescriptionListIterator struct { 1595 i int 1596 page GatewayResourceDescriptionListPage 1597} 1598 1599// NextWithContext advances to the next value. If there was an error making 1600// the request the iterator does not advance and the error is returned. 1601func (iter *GatewayResourceDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 1602 if tracing.IsEnabled() { 1603 ctx = tracing.StartSpan(ctx, fqdn+"/GatewayResourceDescriptionListIterator.NextWithContext") 1604 defer func() { 1605 sc := -1 1606 if iter.Response().Response.Response != nil { 1607 sc = iter.Response().Response.Response.StatusCode 1608 } 1609 tracing.EndSpan(ctx, sc, err) 1610 }() 1611 } 1612 iter.i++ 1613 if iter.i < len(iter.page.Values()) { 1614 return nil 1615 } 1616 err = iter.page.NextWithContext(ctx) 1617 if err != nil { 1618 iter.i-- 1619 return err 1620 } 1621 iter.i = 0 1622 return nil 1623} 1624 1625// Next advances to the next value. If there was an error making 1626// the request the iterator does not advance and the error is returned. 1627// Deprecated: Use NextWithContext() instead. 1628func (iter *GatewayResourceDescriptionListIterator) Next() error { 1629 return iter.NextWithContext(context.Background()) 1630} 1631 1632// NotDone returns true if the enumeration should be started or is not yet complete. 1633func (iter GatewayResourceDescriptionListIterator) NotDone() bool { 1634 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1635} 1636 1637// Response returns the raw server response from the last page request. 1638func (iter GatewayResourceDescriptionListIterator) Response() GatewayResourceDescriptionList { 1639 return iter.page.Response() 1640} 1641 1642// Value returns the current value or a zero-initialized value if the 1643// iterator has advanced beyond the end of the collection. 1644func (iter GatewayResourceDescriptionListIterator) Value() GatewayResourceDescription { 1645 if !iter.page.NotDone() { 1646 return GatewayResourceDescription{} 1647 } 1648 return iter.page.Values()[iter.i] 1649} 1650 1651// Creates a new instance of the GatewayResourceDescriptionListIterator type. 1652func NewGatewayResourceDescriptionListIterator(page GatewayResourceDescriptionListPage) GatewayResourceDescriptionListIterator { 1653 return GatewayResourceDescriptionListIterator{page: page} 1654} 1655 1656// IsEmpty returns true if the ListResult contains no values. 1657func (grdl GatewayResourceDescriptionList) IsEmpty() bool { 1658 return grdl.Value == nil || len(*grdl.Value) == 0 1659} 1660 1661// hasNextLink returns true if the NextLink is not empty. 1662func (grdl GatewayResourceDescriptionList) hasNextLink() bool { 1663 return grdl.NextLink != nil && len(*grdl.NextLink) != 0 1664} 1665 1666// gatewayResourceDescriptionListPreparer prepares a request to retrieve the next set of results. 1667// It returns nil if no more results exist. 1668func (grdl GatewayResourceDescriptionList) gatewayResourceDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 1669 if !grdl.hasNextLink() { 1670 return nil, nil 1671 } 1672 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1673 autorest.AsJSON(), 1674 autorest.AsGet(), 1675 autorest.WithBaseURL(to.String(grdl.NextLink))) 1676} 1677 1678// GatewayResourceDescriptionListPage contains a page of GatewayResourceDescription values. 1679type GatewayResourceDescriptionListPage struct { 1680 fn func(context.Context, GatewayResourceDescriptionList) (GatewayResourceDescriptionList, error) 1681 grdl GatewayResourceDescriptionList 1682} 1683 1684// NextWithContext advances to the next page of values. If there was an error making 1685// the request the page does not advance and the error is returned. 1686func (page *GatewayResourceDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 1687 if tracing.IsEnabled() { 1688 ctx = tracing.StartSpan(ctx, fqdn+"/GatewayResourceDescriptionListPage.NextWithContext") 1689 defer func() { 1690 sc := -1 1691 if page.Response().Response.Response != nil { 1692 sc = page.Response().Response.Response.StatusCode 1693 } 1694 tracing.EndSpan(ctx, sc, err) 1695 }() 1696 } 1697 for { 1698 next, err := page.fn(ctx, page.grdl) 1699 if err != nil { 1700 return err 1701 } 1702 page.grdl = next 1703 if !next.hasNextLink() || !next.IsEmpty() { 1704 break 1705 } 1706 } 1707 return nil 1708} 1709 1710// Next advances to the next page of values. If there was an error making 1711// the request the page does not advance and the error is returned. 1712// Deprecated: Use NextWithContext() instead. 1713func (page *GatewayResourceDescriptionListPage) Next() error { 1714 return page.NextWithContext(context.Background()) 1715} 1716 1717// NotDone returns true if the page enumeration should be started or is not yet complete. 1718func (page GatewayResourceDescriptionListPage) NotDone() bool { 1719 return !page.grdl.IsEmpty() 1720} 1721 1722// Response returns the raw server response from the last page request. 1723func (page GatewayResourceDescriptionListPage) Response() GatewayResourceDescriptionList { 1724 return page.grdl 1725} 1726 1727// Values returns the slice of values for the current page or nil if there are no values. 1728func (page GatewayResourceDescriptionListPage) Values() []GatewayResourceDescription { 1729 if page.grdl.IsEmpty() { 1730 return nil 1731 } 1732 return *page.grdl.Value 1733} 1734 1735// Creates a new instance of the GatewayResourceDescriptionListPage type. 1736func NewGatewayResourceDescriptionListPage(cur GatewayResourceDescriptionList, getNextPage func(context.Context, GatewayResourceDescriptionList) (GatewayResourceDescriptionList, error)) GatewayResourceDescriptionListPage { 1737 return GatewayResourceDescriptionListPage{ 1738 fn: getNextPage, 1739 grdl: cur, 1740 } 1741} 1742 1743// GatewayResourceProperties this type describes properties of a gateway resource. 1744type GatewayResourceProperties struct { 1745 // ProvisioningState - READ-ONLY; State of the resource. 1746 ProvisioningState *string `json:"provisioningState,omitempty"` 1747 // Description - User readable description of the gateway. 1748 Description *string `json:"description,omitempty"` 1749 // SourceNetwork - Network the gateway should listen on for requests. 1750 SourceNetwork *NetworkRef `json:"sourceNetwork,omitempty"` 1751 // DestinationNetwork - Network that the Application is using. 1752 DestinationNetwork *NetworkRef `json:"destinationNetwork,omitempty"` 1753 // TCP - Configuration for tcp connectivity for this gateway. 1754 TCP *[]TCPConfig `json:"tcp,omitempty"` 1755 // HTTP - Configuration for http connectivity for this gateway. 1756 HTTP *[]HTTPConfig `json:"http,omitempty"` 1757 // Status - READ-ONLY; Status of the resource. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 1758 Status ResourceStatus `json:"status,omitempty"` 1759 // StatusDetails - READ-ONLY; Gives additional information about the current status of the gateway. 1760 StatusDetails *string `json:"statusDetails,omitempty"` 1761 // IPAddress - READ-ONLY; IP address of the gateway. This is populated in the response and is ignored for incoming requests. 1762 IPAddress *string `json:"ipAddress,omitempty"` 1763} 1764 1765// MarshalJSON is the custom marshaler for GatewayResourceProperties. 1766func (grp GatewayResourceProperties) MarshalJSON() ([]byte, error) { 1767 objectMap := make(map[string]interface{}) 1768 if grp.Description != nil { 1769 objectMap["description"] = grp.Description 1770 } 1771 if grp.SourceNetwork != nil { 1772 objectMap["sourceNetwork"] = grp.SourceNetwork 1773 } 1774 if grp.DestinationNetwork != nil { 1775 objectMap["destinationNetwork"] = grp.DestinationNetwork 1776 } 1777 if grp.TCP != nil { 1778 objectMap["tcp"] = grp.TCP 1779 } 1780 if grp.HTTP != nil { 1781 objectMap["http"] = grp.HTTP 1782 } 1783 return json.Marshal(objectMap) 1784} 1785 1786// HTTPConfig describes the http configuration for external connectivity for this network. 1787type HTTPConfig struct { 1788 // Name - http gateway config name. 1789 Name *string `json:"name,omitempty"` 1790 // Port - Specifies the port at which the service endpoint below needs to be exposed. 1791 Port *int32 `json:"port,omitempty"` 1792 // Hosts - description for routing. 1793 Hosts *[]HTTPHostConfig `json:"hosts,omitempty"` 1794} 1795 1796// HTTPHostConfig describes the hostname properties for http routing. 1797type HTTPHostConfig struct { 1798 // Name - http hostname config name. 1799 Name *string `json:"name,omitempty"` 1800 // Routes - Route information to use for routing. Routes are processed in the order they are specified. Specify routes that are more specific before routes that can handle general cases. 1801 Routes *[]HTTPRouteConfig `json:"routes,omitempty"` 1802} 1803 1804// HTTPRouteConfig describes the hostname properties for http routing. 1805type HTTPRouteConfig struct { 1806 // Name - http route name. 1807 Name *string `json:"name,omitempty"` 1808 // Match - Describes a rule for http route matching. 1809 Match *HTTPRouteMatchRule `json:"match,omitempty"` 1810 // Destination - Describes destination endpoint for routing traffic. 1811 Destination *GatewayDestination `json:"destination,omitempty"` 1812} 1813 1814// HTTPRouteMatchHeader describes header information for http route matching. 1815type HTTPRouteMatchHeader struct { 1816 // Name - Name of header to match in request. 1817 Name *string `json:"name,omitempty"` 1818 // Value - Value of header to match in request. 1819 Value *string `json:"value,omitempty"` 1820 // Type - how to match header value. Possible values include: 'Exact' 1821 Type HeaderMatchType `json:"type,omitempty"` 1822} 1823 1824// HTTPRouteMatchPath path to match for routing. 1825type HTTPRouteMatchPath struct { 1826 // Value - Uri path to match for request. 1827 Value *string `json:"value,omitempty"` 1828 // Rewrite - replacement string for matched part of the Uri. 1829 Rewrite *string `json:"rewrite,omitempty"` 1830 // Type - how to match value in the Uri 1831 Type *string `json:"type,omitempty"` 1832} 1833 1834// HTTPRouteMatchRule describes a rule for http route matching. 1835type HTTPRouteMatchRule struct { 1836 // Path - Path to match for routing. 1837 Path *HTTPRouteMatchPath `json:"path,omitempty"` 1838 // Headers - headers and their values to match in request. 1839 Headers *[]HTTPRouteMatchHeader `json:"headers,omitempty"` 1840} 1841 1842// ImageRegistryCredential image registry credential. 1843type ImageRegistryCredential struct { 1844 // Server - Docker image registry server, without protocol such as `http` and `https`. 1845 Server *string `json:"server,omitempty"` 1846 // Username - The username for the private registry. 1847 Username *string `json:"username,omitempty"` 1848 // Password - The password for the private registry. The password is required for create or update operations, however it is not returned in the get or list operations. 1849 Password *string `json:"password,omitempty"` 1850} 1851 1852// InlinedValueSecretResourceProperties describes the properties of a secret resource whose value is 1853// provided explicitly as plaintext. The secret resource may have multiple values, each being uniquely 1854// versioned. The secret value of each version is stored encrypted, and delivered as plaintext into the 1855// context of applications referencing it. 1856type InlinedValueSecretResourceProperties struct { 1857 // Description - User readable description of the secret. 1858 Description *string `json:"description,omitempty"` 1859 // Status - READ-ONLY; Status of the resource. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 1860 Status ResourceStatus `json:"status,omitempty"` 1861 // StatusDetails - READ-ONLY; Gives additional information about the current status of the secret. 1862 StatusDetails *string `json:"statusDetails,omitempty"` 1863 // ContentType - The type of the content stored in the secret value. The value of this property is opaque to Service Fabric. Once set, the value of this property cannot be changed. 1864 ContentType *string `json:"contentType,omitempty"` 1865 // ProvisioningState - READ-ONLY; State of the resource. 1866 ProvisioningState *string `json:"provisioningState,omitempty"` 1867 // Kind - Possible values include: 'KindSecretResourcePropertiesBase', 'KindSecretResourceProperties', 'KindInlinedValue' 1868 Kind Kind `json:"kind,omitempty"` 1869} 1870 1871// MarshalJSON is the custom marshaler for InlinedValueSecretResourceProperties. 1872func (ivsrp InlinedValueSecretResourceProperties) MarshalJSON() ([]byte, error) { 1873 ivsrp.Kind = KindInlinedValue 1874 objectMap := make(map[string]interface{}) 1875 if ivsrp.Description != nil { 1876 objectMap["description"] = ivsrp.Description 1877 } 1878 if ivsrp.ContentType != nil { 1879 objectMap["contentType"] = ivsrp.ContentType 1880 } 1881 if ivsrp.Kind != "" { 1882 objectMap["kind"] = ivsrp.Kind 1883 } 1884 return json.Marshal(objectMap) 1885} 1886 1887// AsSecretResourceProperties is the BasicSecretResourcePropertiesBase implementation for InlinedValueSecretResourceProperties. 1888func (ivsrp InlinedValueSecretResourceProperties) AsSecretResourceProperties() (*SecretResourceProperties, bool) { 1889 return nil, false 1890} 1891 1892// AsBasicSecretResourceProperties is the BasicSecretResourcePropertiesBase implementation for InlinedValueSecretResourceProperties. 1893func (ivsrp InlinedValueSecretResourceProperties) AsBasicSecretResourceProperties() (BasicSecretResourceProperties, bool) { 1894 return &ivsrp, true 1895} 1896 1897// AsInlinedValueSecretResourceProperties is the BasicSecretResourcePropertiesBase implementation for InlinedValueSecretResourceProperties. 1898func (ivsrp InlinedValueSecretResourceProperties) AsInlinedValueSecretResourceProperties() (*InlinedValueSecretResourceProperties, bool) { 1899 return &ivsrp, true 1900} 1901 1902// AsSecretResourcePropertiesBase is the BasicSecretResourcePropertiesBase implementation for InlinedValueSecretResourceProperties. 1903func (ivsrp InlinedValueSecretResourceProperties) AsSecretResourcePropertiesBase() (*SecretResourcePropertiesBase, bool) { 1904 return nil, false 1905} 1906 1907// AsBasicSecretResourcePropertiesBase is the BasicSecretResourcePropertiesBase implementation for InlinedValueSecretResourceProperties. 1908func (ivsrp InlinedValueSecretResourceProperties) AsBasicSecretResourcePropertiesBase() (BasicSecretResourcePropertiesBase, bool) { 1909 return &ivsrp, true 1910} 1911 1912// LocalNetworkResourceProperties information about a Service Fabric container network local to a single 1913// Service Fabric cluster. 1914type LocalNetworkResourceProperties struct { 1915 // NetworkAddressPrefix - Address space for the local container network. 1916 NetworkAddressPrefix *string `json:"networkAddressPrefix,omitempty"` 1917 // Description - User readable description of the network. 1918 Description *string `json:"description,omitempty"` 1919 // Status - READ-ONLY; Status of the network. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 1920 Status ResourceStatus `json:"status,omitempty"` 1921 // StatusDetails - READ-ONLY; Gives additional information about the current status of the network. 1922 StatusDetails *string `json:"statusDetails,omitempty"` 1923 // ProvisioningState - READ-ONLY; State of the resource. 1924 ProvisioningState *string `json:"provisioningState,omitempty"` 1925 // Kind - Possible values include: 'KindNetworkResourcePropertiesBase', 'KindNetworkResourceProperties', 'KindLocal' 1926 Kind KindBasicNetworkResourcePropertiesBase `json:"kind,omitempty"` 1927} 1928 1929// MarshalJSON is the custom marshaler for LocalNetworkResourceProperties. 1930func (lnrp LocalNetworkResourceProperties) MarshalJSON() ([]byte, error) { 1931 lnrp.Kind = KindLocal 1932 objectMap := make(map[string]interface{}) 1933 if lnrp.NetworkAddressPrefix != nil { 1934 objectMap["networkAddressPrefix"] = lnrp.NetworkAddressPrefix 1935 } 1936 if lnrp.Description != nil { 1937 objectMap["description"] = lnrp.Description 1938 } 1939 if lnrp.Kind != "" { 1940 objectMap["kind"] = lnrp.Kind 1941 } 1942 return json.Marshal(objectMap) 1943} 1944 1945// AsNetworkResourceProperties is the BasicNetworkResourcePropertiesBase implementation for LocalNetworkResourceProperties. 1946func (lnrp LocalNetworkResourceProperties) AsNetworkResourceProperties() (*NetworkResourceProperties, bool) { 1947 return nil, false 1948} 1949 1950// AsBasicNetworkResourceProperties is the BasicNetworkResourcePropertiesBase implementation for LocalNetworkResourceProperties. 1951func (lnrp LocalNetworkResourceProperties) AsBasicNetworkResourceProperties() (BasicNetworkResourceProperties, bool) { 1952 return &lnrp, true 1953} 1954 1955// AsLocalNetworkResourceProperties is the BasicNetworkResourcePropertiesBase implementation for LocalNetworkResourceProperties. 1956func (lnrp LocalNetworkResourceProperties) AsLocalNetworkResourceProperties() (*LocalNetworkResourceProperties, bool) { 1957 return &lnrp, true 1958} 1959 1960// AsNetworkResourcePropertiesBase is the BasicNetworkResourcePropertiesBase implementation for LocalNetworkResourceProperties. 1961func (lnrp LocalNetworkResourceProperties) AsNetworkResourcePropertiesBase() (*NetworkResourcePropertiesBase, bool) { 1962 return nil, false 1963} 1964 1965// AsBasicNetworkResourcePropertiesBase is the BasicNetworkResourcePropertiesBase implementation for LocalNetworkResourceProperties. 1966func (lnrp LocalNetworkResourceProperties) AsBasicNetworkResourcePropertiesBase() (BasicNetworkResourcePropertiesBase, bool) { 1967 return &lnrp, true 1968} 1969 1970// ManagedProxyResource the resource model definition for Azure Resource Manager proxy resource. It will 1971// have everything other than required location and tags. This proxy resource is explicitly created or 1972// updated by including it in the parent resource. 1973type ManagedProxyResource struct { 1974 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1975 ID *string `json:"id,omitempty"` 1976 // Name - The name of the resource 1977 Name *string `json:"name,omitempty"` 1978 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1979 Type *string `json:"type,omitempty"` 1980} 1981 1982// MarshalJSON is the custom marshaler for ManagedProxyResource. 1983func (mpr ManagedProxyResource) MarshalJSON() ([]byte, error) { 1984 objectMap := make(map[string]interface{}) 1985 if mpr.Name != nil { 1986 objectMap["name"] = mpr.Name 1987 } 1988 return json.Marshal(objectMap) 1989} 1990 1991// NetworkRef describes a network reference in a service. 1992type NetworkRef struct { 1993 // Name - Name of the network 1994 Name *string `json:"name,omitempty"` 1995 // EndpointRefs - A list of endpoints that are exposed on this network. 1996 EndpointRefs *[]EndpointRef `json:"endpointRefs,omitempty"` 1997} 1998 1999// NetworkResourceDescription this type describes a network resource. 2000type NetworkResourceDescription struct { 2001 autorest.Response `json:"-"` 2002 // Properties - Describes properties of a network resource. 2003 Properties BasicNetworkResourceProperties `json:"properties,omitempty"` 2004 // Tags - Resource tags. 2005 Tags map[string]*string `json:"tags"` 2006 // Location - The geo-location where the resource lives 2007 Location *string `json:"location,omitempty"` 2008 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2009 ID *string `json:"id,omitempty"` 2010 // Name - READ-ONLY; The name of the resource 2011 Name *string `json:"name,omitempty"` 2012 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 2013 Type *string `json:"type,omitempty"` 2014} 2015 2016// MarshalJSON is the custom marshaler for NetworkResourceDescription. 2017func (nrd NetworkResourceDescription) MarshalJSON() ([]byte, error) { 2018 objectMap := make(map[string]interface{}) 2019 objectMap["properties"] = nrd.Properties 2020 if nrd.Tags != nil { 2021 objectMap["tags"] = nrd.Tags 2022 } 2023 if nrd.Location != nil { 2024 objectMap["location"] = nrd.Location 2025 } 2026 return json.Marshal(objectMap) 2027} 2028 2029// UnmarshalJSON is the custom unmarshaler for NetworkResourceDescription struct. 2030func (nrd *NetworkResourceDescription) UnmarshalJSON(body []byte) error { 2031 var m map[string]*json.RawMessage 2032 err := json.Unmarshal(body, &m) 2033 if err != nil { 2034 return err 2035 } 2036 for k, v := range m { 2037 switch k { 2038 case "properties": 2039 if v != nil { 2040 properties, err := unmarshalBasicNetworkResourceProperties(*v) 2041 if err != nil { 2042 return err 2043 } 2044 nrd.Properties = properties 2045 } 2046 case "tags": 2047 if v != nil { 2048 var tags map[string]*string 2049 err = json.Unmarshal(*v, &tags) 2050 if err != nil { 2051 return err 2052 } 2053 nrd.Tags = tags 2054 } 2055 case "location": 2056 if v != nil { 2057 var location string 2058 err = json.Unmarshal(*v, &location) 2059 if err != nil { 2060 return err 2061 } 2062 nrd.Location = &location 2063 } 2064 case "id": 2065 if v != nil { 2066 var ID string 2067 err = json.Unmarshal(*v, &ID) 2068 if err != nil { 2069 return err 2070 } 2071 nrd.ID = &ID 2072 } 2073 case "name": 2074 if v != nil { 2075 var name string 2076 err = json.Unmarshal(*v, &name) 2077 if err != nil { 2078 return err 2079 } 2080 nrd.Name = &name 2081 } 2082 case "type": 2083 if v != nil { 2084 var typeVar string 2085 err = json.Unmarshal(*v, &typeVar) 2086 if err != nil { 2087 return err 2088 } 2089 nrd.Type = &typeVar 2090 } 2091 } 2092 } 2093 2094 return nil 2095} 2096 2097// NetworkResourceDescriptionList a pageable list of network resources. 2098type NetworkResourceDescriptionList struct { 2099 autorest.Response `json:"-"` 2100 // Value - One page of the list. 2101 Value *[]NetworkResourceDescription `json:"value,omitempty"` 2102 // NextLink - URI to fetch the next page of the list. 2103 NextLink *string `json:"nextLink,omitempty"` 2104} 2105 2106// NetworkResourceDescriptionListIterator provides access to a complete listing of 2107// NetworkResourceDescription values. 2108type NetworkResourceDescriptionListIterator struct { 2109 i int 2110 page NetworkResourceDescriptionListPage 2111} 2112 2113// NextWithContext advances to the next value. If there was an error making 2114// the request the iterator does not advance and the error is returned. 2115func (iter *NetworkResourceDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 2116 if tracing.IsEnabled() { 2117 ctx = tracing.StartSpan(ctx, fqdn+"/NetworkResourceDescriptionListIterator.NextWithContext") 2118 defer func() { 2119 sc := -1 2120 if iter.Response().Response.Response != nil { 2121 sc = iter.Response().Response.Response.StatusCode 2122 } 2123 tracing.EndSpan(ctx, sc, err) 2124 }() 2125 } 2126 iter.i++ 2127 if iter.i < len(iter.page.Values()) { 2128 return nil 2129 } 2130 err = iter.page.NextWithContext(ctx) 2131 if err != nil { 2132 iter.i-- 2133 return err 2134 } 2135 iter.i = 0 2136 return nil 2137} 2138 2139// Next advances to the next value. If there was an error making 2140// the request the iterator does not advance and the error is returned. 2141// Deprecated: Use NextWithContext() instead. 2142func (iter *NetworkResourceDescriptionListIterator) Next() error { 2143 return iter.NextWithContext(context.Background()) 2144} 2145 2146// NotDone returns true if the enumeration should be started or is not yet complete. 2147func (iter NetworkResourceDescriptionListIterator) NotDone() bool { 2148 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2149} 2150 2151// Response returns the raw server response from the last page request. 2152func (iter NetworkResourceDescriptionListIterator) Response() NetworkResourceDescriptionList { 2153 return iter.page.Response() 2154} 2155 2156// Value returns the current value or a zero-initialized value if the 2157// iterator has advanced beyond the end of the collection. 2158func (iter NetworkResourceDescriptionListIterator) Value() NetworkResourceDescription { 2159 if !iter.page.NotDone() { 2160 return NetworkResourceDescription{} 2161 } 2162 return iter.page.Values()[iter.i] 2163} 2164 2165// Creates a new instance of the NetworkResourceDescriptionListIterator type. 2166func NewNetworkResourceDescriptionListIterator(page NetworkResourceDescriptionListPage) NetworkResourceDescriptionListIterator { 2167 return NetworkResourceDescriptionListIterator{page: page} 2168} 2169 2170// IsEmpty returns true if the ListResult contains no values. 2171func (nrdl NetworkResourceDescriptionList) IsEmpty() bool { 2172 return nrdl.Value == nil || len(*nrdl.Value) == 0 2173} 2174 2175// hasNextLink returns true if the NextLink is not empty. 2176func (nrdl NetworkResourceDescriptionList) hasNextLink() bool { 2177 return nrdl.NextLink != nil && len(*nrdl.NextLink) != 0 2178} 2179 2180// networkResourceDescriptionListPreparer prepares a request to retrieve the next set of results. 2181// It returns nil if no more results exist. 2182func (nrdl NetworkResourceDescriptionList) networkResourceDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 2183 if !nrdl.hasNextLink() { 2184 return nil, nil 2185 } 2186 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2187 autorest.AsJSON(), 2188 autorest.AsGet(), 2189 autorest.WithBaseURL(to.String(nrdl.NextLink))) 2190} 2191 2192// NetworkResourceDescriptionListPage contains a page of NetworkResourceDescription values. 2193type NetworkResourceDescriptionListPage struct { 2194 fn func(context.Context, NetworkResourceDescriptionList) (NetworkResourceDescriptionList, error) 2195 nrdl NetworkResourceDescriptionList 2196} 2197 2198// NextWithContext advances to the next page of values. If there was an error making 2199// the request the page does not advance and the error is returned. 2200func (page *NetworkResourceDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 2201 if tracing.IsEnabled() { 2202 ctx = tracing.StartSpan(ctx, fqdn+"/NetworkResourceDescriptionListPage.NextWithContext") 2203 defer func() { 2204 sc := -1 2205 if page.Response().Response.Response != nil { 2206 sc = page.Response().Response.Response.StatusCode 2207 } 2208 tracing.EndSpan(ctx, sc, err) 2209 }() 2210 } 2211 for { 2212 next, err := page.fn(ctx, page.nrdl) 2213 if err != nil { 2214 return err 2215 } 2216 page.nrdl = next 2217 if !next.hasNextLink() || !next.IsEmpty() { 2218 break 2219 } 2220 } 2221 return nil 2222} 2223 2224// Next advances to the next page of values. If there was an error making 2225// the request the page does not advance and the error is returned. 2226// Deprecated: Use NextWithContext() instead. 2227func (page *NetworkResourceDescriptionListPage) Next() error { 2228 return page.NextWithContext(context.Background()) 2229} 2230 2231// NotDone returns true if the page enumeration should be started or is not yet complete. 2232func (page NetworkResourceDescriptionListPage) NotDone() bool { 2233 return !page.nrdl.IsEmpty() 2234} 2235 2236// Response returns the raw server response from the last page request. 2237func (page NetworkResourceDescriptionListPage) Response() NetworkResourceDescriptionList { 2238 return page.nrdl 2239} 2240 2241// Values returns the slice of values for the current page or nil if there are no values. 2242func (page NetworkResourceDescriptionListPage) Values() []NetworkResourceDescription { 2243 if page.nrdl.IsEmpty() { 2244 return nil 2245 } 2246 return *page.nrdl.Value 2247} 2248 2249// Creates a new instance of the NetworkResourceDescriptionListPage type. 2250func NewNetworkResourceDescriptionListPage(cur NetworkResourceDescriptionList, getNextPage func(context.Context, NetworkResourceDescriptionList) (NetworkResourceDescriptionList, error)) NetworkResourceDescriptionListPage { 2251 return NetworkResourceDescriptionListPage{ 2252 fn: getNextPage, 2253 nrdl: cur, 2254 } 2255} 2256 2257// BasicNetworkResourceProperties describes properties of a network resource. 2258type BasicNetworkResourceProperties interface { 2259 AsLocalNetworkResourceProperties() (*LocalNetworkResourceProperties, bool) 2260 AsNetworkResourceProperties() (*NetworkResourceProperties, bool) 2261} 2262 2263// NetworkResourceProperties describes properties of a network resource. 2264type NetworkResourceProperties struct { 2265 // Description - User readable description of the network. 2266 Description *string `json:"description,omitempty"` 2267 // Status - READ-ONLY; Status of the network. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 2268 Status ResourceStatus `json:"status,omitempty"` 2269 // StatusDetails - READ-ONLY; Gives additional information about the current status of the network. 2270 StatusDetails *string `json:"statusDetails,omitempty"` 2271 // Kind - Possible values include: 'KindNetworkResourcePropertiesBase', 'KindNetworkResourceProperties', 'KindLocal' 2272 Kind KindBasicNetworkResourcePropertiesBase `json:"kind,omitempty"` 2273 // ProvisioningState - READ-ONLY; State of the resource. 2274 ProvisioningState *string `json:"provisioningState,omitempty"` 2275} 2276 2277func unmarshalBasicNetworkResourceProperties(body []byte) (BasicNetworkResourceProperties, error) { 2278 var m map[string]interface{} 2279 err := json.Unmarshal(body, &m) 2280 if err != nil { 2281 return nil, err 2282 } 2283 2284 switch m["kind"] { 2285 case string(KindLocal): 2286 var lnrp LocalNetworkResourceProperties 2287 err := json.Unmarshal(body, &lnrp) 2288 return lnrp, err 2289 default: 2290 var nrp NetworkResourceProperties 2291 err := json.Unmarshal(body, &nrp) 2292 return nrp, err 2293 } 2294} 2295func unmarshalBasicNetworkResourcePropertiesArray(body []byte) ([]BasicNetworkResourceProperties, error) { 2296 var rawMessages []*json.RawMessage 2297 err := json.Unmarshal(body, &rawMessages) 2298 if err != nil { 2299 return nil, err 2300 } 2301 2302 nrpArray := make([]BasicNetworkResourceProperties, len(rawMessages)) 2303 2304 for index, rawMessage := range rawMessages { 2305 nrp, err := unmarshalBasicNetworkResourceProperties(*rawMessage) 2306 if err != nil { 2307 return nil, err 2308 } 2309 nrpArray[index] = nrp 2310 } 2311 return nrpArray, nil 2312} 2313 2314// MarshalJSON is the custom marshaler for NetworkResourceProperties. 2315func (nrp NetworkResourceProperties) MarshalJSON() ([]byte, error) { 2316 nrp.Kind = KindNetworkResourceProperties 2317 objectMap := make(map[string]interface{}) 2318 if nrp.Description != nil { 2319 objectMap["description"] = nrp.Description 2320 } 2321 if nrp.Kind != "" { 2322 objectMap["kind"] = nrp.Kind 2323 } 2324 return json.Marshal(objectMap) 2325} 2326 2327// AsNetworkResourceProperties is the BasicNetworkResourcePropertiesBase implementation for NetworkResourceProperties. 2328func (nrp NetworkResourceProperties) AsNetworkResourceProperties() (*NetworkResourceProperties, bool) { 2329 return &nrp, true 2330} 2331 2332// AsBasicNetworkResourceProperties is the BasicNetworkResourcePropertiesBase implementation for NetworkResourceProperties. 2333func (nrp NetworkResourceProperties) AsBasicNetworkResourceProperties() (BasicNetworkResourceProperties, bool) { 2334 return &nrp, true 2335} 2336 2337// AsLocalNetworkResourceProperties is the BasicNetworkResourcePropertiesBase implementation for NetworkResourceProperties. 2338func (nrp NetworkResourceProperties) AsLocalNetworkResourceProperties() (*LocalNetworkResourceProperties, bool) { 2339 return nil, false 2340} 2341 2342// AsNetworkResourcePropertiesBase is the BasicNetworkResourcePropertiesBase implementation for NetworkResourceProperties. 2343func (nrp NetworkResourceProperties) AsNetworkResourcePropertiesBase() (*NetworkResourcePropertiesBase, bool) { 2344 return nil, false 2345} 2346 2347// AsBasicNetworkResourcePropertiesBase is the BasicNetworkResourcePropertiesBase implementation for NetworkResourceProperties. 2348func (nrp NetworkResourceProperties) AsBasicNetworkResourcePropertiesBase() (BasicNetworkResourcePropertiesBase, bool) { 2349 return &nrp, true 2350} 2351 2352// BasicNetworkResourcePropertiesBase this type describes the properties of a network resource, including its kind. 2353type BasicNetworkResourcePropertiesBase interface { 2354 AsNetworkResourceProperties() (*NetworkResourceProperties, bool) 2355 AsBasicNetworkResourceProperties() (BasicNetworkResourceProperties, bool) 2356 AsLocalNetworkResourceProperties() (*LocalNetworkResourceProperties, bool) 2357 AsNetworkResourcePropertiesBase() (*NetworkResourcePropertiesBase, bool) 2358} 2359 2360// NetworkResourcePropertiesBase this type describes the properties of a network resource, including its kind. 2361type NetworkResourcePropertiesBase struct { 2362 // Kind - Possible values include: 'KindNetworkResourcePropertiesBase', 'KindNetworkResourceProperties', 'KindLocal' 2363 Kind KindBasicNetworkResourcePropertiesBase `json:"kind,omitempty"` 2364 // ProvisioningState - READ-ONLY; State of the resource. 2365 ProvisioningState *string `json:"provisioningState,omitempty"` 2366} 2367 2368func unmarshalBasicNetworkResourcePropertiesBase(body []byte) (BasicNetworkResourcePropertiesBase, error) { 2369 var m map[string]interface{} 2370 err := json.Unmarshal(body, &m) 2371 if err != nil { 2372 return nil, err 2373 } 2374 2375 switch m["kind"] { 2376 case string(KindNetworkResourceProperties): 2377 var nrp NetworkResourceProperties 2378 err := json.Unmarshal(body, &nrp) 2379 return nrp, err 2380 case string(KindLocal): 2381 var lnrp LocalNetworkResourceProperties 2382 err := json.Unmarshal(body, &lnrp) 2383 return lnrp, err 2384 default: 2385 var nrpb NetworkResourcePropertiesBase 2386 err := json.Unmarshal(body, &nrpb) 2387 return nrpb, err 2388 } 2389} 2390func unmarshalBasicNetworkResourcePropertiesBaseArray(body []byte) ([]BasicNetworkResourcePropertiesBase, error) { 2391 var rawMessages []*json.RawMessage 2392 err := json.Unmarshal(body, &rawMessages) 2393 if err != nil { 2394 return nil, err 2395 } 2396 2397 nrpbArray := make([]BasicNetworkResourcePropertiesBase, len(rawMessages)) 2398 2399 for index, rawMessage := range rawMessages { 2400 nrpb, err := unmarshalBasicNetworkResourcePropertiesBase(*rawMessage) 2401 if err != nil { 2402 return nil, err 2403 } 2404 nrpbArray[index] = nrpb 2405 } 2406 return nrpbArray, nil 2407} 2408 2409// MarshalJSON is the custom marshaler for NetworkResourcePropertiesBase. 2410func (nrpb NetworkResourcePropertiesBase) MarshalJSON() ([]byte, error) { 2411 nrpb.Kind = KindNetworkResourcePropertiesBase 2412 objectMap := make(map[string]interface{}) 2413 if nrpb.Kind != "" { 2414 objectMap["kind"] = nrpb.Kind 2415 } 2416 return json.Marshal(objectMap) 2417} 2418 2419// AsNetworkResourceProperties is the BasicNetworkResourcePropertiesBase implementation for NetworkResourcePropertiesBase. 2420func (nrpb NetworkResourcePropertiesBase) AsNetworkResourceProperties() (*NetworkResourceProperties, bool) { 2421 return nil, false 2422} 2423 2424// AsBasicNetworkResourceProperties is the BasicNetworkResourcePropertiesBase implementation for NetworkResourcePropertiesBase. 2425func (nrpb NetworkResourcePropertiesBase) AsBasicNetworkResourceProperties() (BasicNetworkResourceProperties, bool) { 2426 return nil, false 2427} 2428 2429// AsLocalNetworkResourceProperties is the BasicNetworkResourcePropertiesBase implementation for NetworkResourcePropertiesBase. 2430func (nrpb NetworkResourcePropertiesBase) AsLocalNetworkResourceProperties() (*LocalNetworkResourceProperties, bool) { 2431 return nil, false 2432} 2433 2434// AsNetworkResourcePropertiesBase is the BasicNetworkResourcePropertiesBase implementation for NetworkResourcePropertiesBase. 2435func (nrpb NetworkResourcePropertiesBase) AsNetworkResourcePropertiesBase() (*NetworkResourcePropertiesBase, bool) { 2436 return &nrpb, true 2437} 2438 2439// AsBasicNetworkResourcePropertiesBase is the BasicNetworkResourcePropertiesBase implementation for NetworkResourcePropertiesBase. 2440func (nrpb NetworkResourcePropertiesBase) AsBasicNetworkResourcePropertiesBase() (BasicNetworkResourcePropertiesBase, bool) { 2441 return &nrpb, true 2442} 2443 2444// OperationListResult describes the result of the request to list Service Fabric operations. 2445type OperationListResult struct { 2446 autorest.Response `json:"-"` 2447 // Value - List of Service Fabric operations supported by the Microsoft.ServiceFabric resource provider. 2448 Value *[]OperationResult `json:"value,omitempty"` 2449 // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. 2450 NextLink *string `json:"nextLink,omitempty"` 2451} 2452 2453// MarshalJSON is the custom marshaler for OperationListResult. 2454func (olr OperationListResult) MarshalJSON() ([]byte, error) { 2455 objectMap := make(map[string]interface{}) 2456 if olr.Value != nil { 2457 objectMap["value"] = olr.Value 2458 } 2459 return json.Marshal(objectMap) 2460} 2461 2462// OperationListResultIterator provides access to a complete listing of OperationResult values. 2463type OperationListResultIterator struct { 2464 i int 2465 page OperationListResultPage 2466} 2467 2468// NextWithContext advances to the next value. If there was an error making 2469// the request the iterator does not advance and the error is returned. 2470func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2471 if tracing.IsEnabled() { 2472 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 2473 defer func() { 2474 sc := -1 2475 if iter.Response().Response.Response != nil { 2476 sc = iter.Response().Response.Response.StatusCode 2477 } 2478 tracing.EndSpan(ctx, sc, err) 2479 }() 2480 } 2481 iter.i++ 2482 if iter.i < len(iter.page.Values()) { 2483 return nil 2484 } 2485 err = iter.page.NextWithContext(ctx) 2486 if err != nil { 2487 iter.i-- 2488 return err 2489 } 2490 iter.i = 0 2491 return nil 2492} 2493 2494// Next advances to the next value. If there was an error making 2495// the request the iterator does not advance and the error is returned. 2496// Deprecated: Use NextWithContext() instead. 2497func (iter *OperationListResultIterator) Next() error { 2498 return iter.NextWithContext(context.Background()) 2499} 2500 2501// NotDone returns true if the enumeration should be started or is not yet complete. 2502func (iter OperationListResultIterator) NotDone() bool { 2503 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2504} 2505 2506// Response returns the raw server response from the last page request. 2507func (iter OperationListResultIterator) Response() OperationListResult { 2508 return iter.page.Response() 2509} 2510 2511// Value returns the current value or a zero-initialized value if the 2512// iterator has advanced beyond the end of the collection. 2513func (iter OperationListResultIterator) Value() OperationResult { 2514 if !iter.page.NotDone() { 2515 return OperationResult{} 2516 } 2517 return iter.page.Values()[iter.i] 2518} 2519 2520// Creates a new instance of the OperationListResultIterator type. 2521func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 2522 return OperationListResultIterator{page: page} 2523} 2524 2525// IsEmpty returns true if the ListResult contains no values. 2526func (olr OperationListResult) IsEmpty() bool { 2527 return olr.Value == nil || len(*olr.Value) == 0 2528} 2529 2530// hasNextLink returns true if the NextLink is not empty. 2531func (olr OperationListResult) hasNextLink() bool { 2532 return olr.NextLink != nil && len(*olr.NextLink) != 0 2533} 2534 2535// operationListResultPreparer prepares a request to retrieve the next set of results. 2536// It returns nil if no more results exist. 2537func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 2538 if !olr.hasNextLink() { 2539 return nil, nil 2540 } 2541 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2542 autorest.AsJSON(), 2543 autorest.AsGet(), 2544 autorest.WithBaseURL(to.String(olr.NextLink))) 2545} 2546 2547// OperationListResultPage contains a page of OperationResult values. 2548type OperationListResultPage struct { 2549 fn func(context.Context, OperationListResult) (OperationListResult, error) 2550 olr OperationListResult 2551} 2552 2553// NextWithContext advances to the next page of values. If there was an error making 2554// the request the page does not advance and the error is returned. 2555func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 2556 if tracing.IsEnabled() { 2557 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 2558 defer func() { 2559 sc := -1 2560 if page.Response().Response.Response != nil { 2561 sc = page.Response().Response.Response.StatusCode 2562 } 2563 tracing.EndSpan(ctx, sc, err) 2564 }() 2565 } 2566 for { 2567 next, err := page.fn(ctx, page.olr) 2568 if err != nil { 2569 return err 2570 } 2571 page.olr = next 2572 if !next.hasNextLink() || !next.IsEmpty() { 2573 break 2574 } 2575 } 2576 return nil 2577} 2578 2579// Next advances to the next page of values. If there was an error making 2580// the request the page does not advance and the error is returned. 2581// Deprecated: Use NextWithContext() instead. 2582func (page *OperationListResultPage) Next() error { 2583 return page.NextWithContext(context.Background()) 2584} 2585 2586// NotDone returns true if the page enumeration should be started or is not yet complete. 2587func (page OperationListResultPage) NotDone() bool { 2588 return !page.olr.IsEmpty() 2589} 2590 2591// Response returns the raw server response from the last page request. 2592func (page OperationListResultPage) Response() OperationListResult { 2593 return page.olr 2594} 2595 2596// Values returns the slice of values for the current page or nil if there are no values. 2597func (page OperationListResultPage) Values() []OperationResult { 2598 if page.olr.IsEmpty() { 2599 return nil 2600 } 2601 return *page.olr.Value 2602} 2603 2604// Creates a new instance of the OperationListResultPage type. 2605func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 2606 return OperationListResultPage{ 2607 fn: getNextPage, 2608 olr: cur, 2609 } 2610} 2611 2612// OperationResult list of operations available at the listed Azure resource provider. 2613type OperationResult struct { 2614 // Name - The name of the operation. 2615 Name *string `json:"name,omitempty"` 2616 // Display - The object that represents the operation. 2617 Display *AvailableOperationDisplay `json:"display,omitempty"` 2618 // Origin - Origin result 2619 Origin *string `json:"origin,omitempty"` 2620 // NextLink - The URL to use for getting the next set of results. 2621 NextLink *string `json:"nextLink,omitempty"` 2622} 2623 2624// ProvisionedResourceProperties describes common properties of a provisioned resource. 2625type ProvisionedResourceProperties struct { 2626 // ProvisioningState - READ-ONLY; State of the resource. 2627 ProvisioningState *string `json:"provisioningState,omitempty"` 2628} 2629 2630// ProxyResource the resource model definition for Azure Resource Manager proxy resource. It will have 2631// everything other than required location and tags. 2632type ProxyResource struct { 2633 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2634 ID *string `json:"id,omitempty"` 2635 // Name - READ-ONLY; The name of the resource 2636 Name *string `json:"name,omitempty"` 2637 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 2638 Type *string `json:"type,omitempty"` 2639} 2640 2641// ReliableCollectionsRef specifying this parameter adds support for reliable collections 2642type ReliableCollectionsRef struct { 2643 // Name - Name of ReliableCollection resource. Right now it's not used and you can use any string. 2644 Name *string `json:"name,omitempty"` 2645 // DoNotPersistState - False (the default) if ReliableCollections state is persisted to disk as usual. True if you do not want to persist state, in which case replication is still enabled and you can use ReliableCollections as distributed cache. 2646 DoNotPersistState *bool `json:"doNotPersistState,omitempty"` 2647} 2648 2649// Resource the resource model definition for Azure Resource Manager resource. 2650type Resource struct { 2651 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2652 ID *string `json:"id,omitempty"` 2653 // Name - READ-ONLY; The name of the resource 2654 Name *string `json:"name,omitempty"` 2655 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 2656 Type *string `json:"type,omitempty"` 2657} 2658 2659// ResourceLimits this type describes the resource limits for a given container. It describes the most 2660// amount of resources a container is allowed to use before being restarted. 2661type ResourceLimits struct { 2662 // MemoryInGB - The memory limit in GB. 2663 MemoryInGB *float64 `json:"memoryInGB,omitempty"` 2664 // CPU - CPU limits in cores. At present, only full cores are supported. 2665 CPU *float64 `json:"cpu,omitempty"` 2666} 2667 2668// ResourceRequests this type describes the requested resources for a given container. It describes the 2669// least amount of resources required for the container. A container can consume more than requested 2670// resources up to the specified limits before being restarted. Currently, the requested resources are 2671// treated as limits. 2672type ResourceRequests struct { 2673 // MemoryInGB - The memory request in GB for this container. 2674 MemoryInGB *float64 `json:"memoryInGB,omitempty"` 2675 // CPU - Requested number of CPU cores. At present, only full cores are supported. 2676 CPU *float64 `json:"cpu,omitempty"` 2677} 2678 2679// ResourceRequirements this type describes the resource requirements for a container or a service. 2680type ResourceRequirements struct { 2681 // Requests - Describes the requested resources for a given container. 2682 Requests *ResourceRequests `json:"requests,omitempty"` 2683 // Limits - Describes the maximum limits on the resources for a given container. 2684 Limits *ResourceLimits `json:"limits,omitempty"` 2685} 2686 2687// SecretResourceDescription this type describes a secret resource. 2688type SecretResourceDescription struct { 2689 autorest.Response `json:"-"` 2690 // Properties - Describes the properties of a secret resource. 2691 Properties BasicSecretResourceProperties `json:"properties,omitempty"` 2692 // Tags - Resource tags. 2693 Tags map[string]*string `json:"tags"` 2694 // Location - The geo-location where the resource lives 2695 Location *string `json:"location,omitempty"` 2696 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2697 ID *string `json:"id,omitempty"` 2698 // Name - READ-ONLY; The name of the resource 2699 Name *string `json:"name,omitempty"` 2700 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 2701 Type *string `json:"type,omitempty"` 2702} 2703 2704// MarshalJSON is the custom marshaler for SecretResourceDescription. 2705func (srd SecretResourceDescription) MarshalJSON() ([]byte, error) { 2706 objectMap := make(map[string]interface{}) 2707 objectMap["properties"] = srd.Properties 2708 if srd.Tags != nil { 2709 objectMap["tags"] = srd.Tags 2710 } 2711 if srd.Location != nil { 2712 objectMap["location"] = srd.Location 2713 } 2714 return json.Marshal(objectMap) 2715} 2716 2717// UnmarshalJSON is the custom unmarshaler for SecretResourceDescription struct. 2718func (srd *SecretResourceDescription) UnmarshalJSON(body []byte) error { 2719 var m map[string]*json.RawMessage 2720 err := json.Unmarshal(body, &m) 2721 if err != nil { 2722 return err 2723 } 2724 for k, v := range m { 2725 switch k { 2726 case "properties": 2727 if v != nil { 2728 properties, err := unmarshalBasicSecretResourceProperties(*v) 2729 if err != nil { 2730 return err 2731 } 2732 srd.Properties = properties 2733 } 2734 case "tags": 2735 if v != nil { 2736 var tags map[string]*string 2737 err = json.Unmarshal(*v, &tags) 2738 if err != nil { 2739 return err 2740 } 2741 srd.Tags = tags 2742 } 2743 case "location": 2744 if v != nil { 2745 var location string 2746 err = json.Unmarshal(*v, &location) 2747 if err != nil { 2748 return err 2749 } 2750 srd.Location = &location 2751 } 2752 case "id": 2753 if v != nil { 2754 var ID string 2755 err = json.Unmarshal(*v, &ID) 2756 if err != nil { 2757 return err 2758 } 2759 srd.ID = &ID 2760 } 2761 case "name": 2762 if v != nil { 2763 var name string 2764 err = json.Unmarshal(*v, &name) 2765 if err != nil { 2766 return err 2767 } 2768 srd.Name = &name 2769 } 2770 case "type": 2771 if v != nil { 2772 var typeVar string 2773 err = json.Unmarshal(*v, &typeVar) 2774 if err != nil { 2775 return err 2776 } 2777 srd.Type = &typeVar 2778 } 2779 } 2780 } 2781 2782 return nil 2783} 2784 2785// SecretResourceDescriptionList a pageable list of secret resources. 2786type SecretResourceDescriptionList struct { 2787 autorest.Response `json:"-"` 2788 // Value - One page of the list. 2789 Value *[]SecretResourceDescription `json:"value,omitempty"` 2790 // NextLink - URI to fetch the next page of the list. 2791 NextLink *string `json:"nextLink,omitempty"` 2792} 2793 2794// SecretResourceDescriptionListIterator provides access to a complete listing of SecretResourceDescription 2795// values. 2796type SecretResourceDescriptionListIterator struct { 2797 i int 2798 page SecretResourceDescriptionListPage 2799} 2800 2801// NextWithContext advances to the next value. If there was an error making 2802// the request the iterator does not advance and the error is returned. 2803func (iter *SecretResourceDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 2804 if tracing.IsEnabled() { 2805 ctx = tracing.StartSpan(ctx, fqdn+"/SecretResourceDescriptionListIterator.NextWithContext") 2806 defer func() { 2807 sc := -1 2808 if iter.Response().Response.Response != nil { 2809 sc = iter.Response().Response.Response.StatusCode 2810 } 2811 tracing.EndSpan(ctx, sc, err) 2812 }() 2813 } 2814 iter.i++ 2815 if iter.i < len(iter.page.Values()) { 2816 return nil 2817 } 2818 err = iter.page.NextWithContext(ctx) 2819 if err != nil { 2820 iter.i-- 2821 return err 2822 } 2823 iter.i = 0 2824 return nil 2825} 2826 2827// Next advances to the next value. If there was an error making 2828// the request the iterator does not advance and the error is returned. 2829// Deprecated: Use NextWithContext() instead. 2830func (iter *SecretResourceDescriptionListIterator) Next() error { 2831 return iter.NextWithContext(context.Background()) 2832} 2833 2834// NotDone returns true if the enumeration should be started or is not yet complete. 2835func (iter SecretResourceDescriptionListIterator) NotDone() bool { 2836 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2837} 2838 2839// Response returns the raw server response from the last page request. 2840func (iter SecretResourceDescriptionListIterator) Response() SecretResourceDescriptionList { 2841 return iter.page.Response() 2842} 2843 2844// Value returns the current value or a zero-initialized value if the 2845// iterator has advanced beyond the end of the collection. 2846func (iter SecretResourceDescriptionListIterator) Value() SecretResourceDescription { 2847 if !iter.page.NotDone() { 2848 return SecretResourceDescription{} 2849 } 2850 return iter.page.Values()[iter.i] 2851} 2852 2853// Creates a new instance of the SecretResourceDescriptionListIterator type. 2854func NewSecretResourceDescriptionListIterator(page SecretResourceDescriptionListPage) SecretResourceDescriptionListIterator { 2855 return SecretResourceDescriptionListIterator{page: page} 2856} 2857 2858// IsEmpty returns true if the ListResult contains no values. 2859func (srdl SecretResourceDescriptionList) IsEmpty() bool { 2860 return srdl.Value == nil || len(*srdl.Value) == 0 2861} 2862 2863// hasNextLink returns true if the NextLink is not empty. 2864func (srdl SecretResourceDescriptionList) hasNextLink() bool { 2865 return srdl.NextLink != nil && len(*srdl.NextLink) != 0 2866} 2867 2868// secretResourceDescriptionListPreparer prepares a request to retrieve the next set of results. 2869// It returns nil if no more results exist. 2870func (srdl SecretResourceDescriptionList) secretResourceDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 2871 if !srdl.hasNextLink() { 2872 return nil, nil 2873 } 2874 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2875 autorest.AsJSON(), 2876 autorest.AsGet(), 2877 autorest.WithBaseURL(to.String(srdl.NextLink))) 2878} 2879 2880// SecretResourceDescriptionListPage contains a page of SecretResourceDescription values. 2881type SecretResourceDescriptionListPage struct { 2882 fn func(context.Context, SecretResourceDescriptionList) (SecretResourceDescriptionList, error) 2883 srdl SecretResourceDescriptionList 2884} 2885 2886// NextWithContext advances to the next page of values. If there was an error making 2887// the request the page does not advance and the error is returned. 2888func (page *SecretResourceDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 2889 if tracing.IsEnabled() { 2890 ctx = tracing.StartSpan(ctx, fqdn+"/SecretResourceDescriptionListPage.NextWithContext") 2891 defer func() { 2892 sc := -1 2893 if page.Response().Response.Response != nil { 2894 sc = page.Response().Response.Response.StatusCode 2895 } 2896 tracing.EndSpan(ctx, sc, err) 2897 }() 2898 } 2899 for { 2900 next, err := page.fn(ctx, page.srdl) 2901 if err != nil { 2902 return err 2903 } 2904 page.srdl = next 2905 if !next.hasNextLink() || !next.IsEmpty() { 2906 break 2907 } 2908 } 2909 return nil 2910} 2911 2912// Next advances to the next page of values. If there was an error making 2913// the request the page does not advance and the error is returned. 2914// Deprecated: Use NextWithContext() instead. 2915func (page *SecretResourceDescriptionListPage) Next() error { 2916 return page.NextWithContext(context.Background()) 2917} 2918 2919// NotDone returns true if the page enumeration should be started or is not yet complete. 2920func (page SecretResourceDescriptionListPage) NotDone() bool { 2921 return !page.srdl.IsEmpty() 2922} 2923 2924// Response returns the raw server response from the last page request. 2925func (page SecretResourceDescriptionListPage) Response() SecretResourceDescriptionList { 2926 return page.srdl 2927} 2928 2929// Values returns the slice of values for the current page or nil if there are no values. 2930func (page SecretResourceDescriptionListPage) Values() []SecretResourceDescription { 2931 if page.srdl.IsEmpty() { 2932 return nil 2933 } 2934 return *page.srdl.Value 2935} 2936 2937// Creates a new instance of the SecretResourceDescriptionListPage type. 2938func NewSecretResourceDescriptionListPage(cur SecretResourceDescriptionList, getNextPage func(context.Context, SecretResourceDescriptionList) (SecretResourceDescriptionList, error)) SecretResourceDescriptionListPage { 2939 return SecretResourceDescriptionListPage{ 2940 fn: getNextPage, 2941 srdl: cur, 2942 } 2943} 2944 2945// BasicSecretResourceProperties describes the properties of a secret resource. 2946type BasicSecretResourceProperties interface { 2947 AsInlinedValueSecretResourceProperties() (*InlinedValueSecretResourceProperties, bool) 2948 AsSecretResourceProperties() (*SecretResourceProperties, bool) 2949} 2950 2951// SecretResourceProperties describes the properties of a secret resource. 2952type SecretResourceProperties struct { 2953 // Description - User readable description of the secret. 2954 Description *string `json:"description,omitempty"` 2955 // Status - READ-ONLY; Status of the resource. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 2956 Status ResourceStatus `json:"status,omitempty"` 2957 // StatusDetails - READ-ONLY; Gives additional information about the current status of the secret. 2958 StatusDetails *string `json:"statusDetails,omitempty"` 2959 // ContentType - The type of the content stored in the secret value. The value of this property is opaque to Service Fabric. Once set, the value of this property cannot be changed. 2960 ContentType *string `json:"contentType,omitempty"` 2961 // Kind - Possible values include: 'KindSecretResourcePropertiesBase', 'KindSecretResourceProperties', 'KindInlinedValue' 2962 Kind Kind `json:"kind,omitempty"` 2963 // ProvisioningState - READ-ONLY; State of the resource. 2964 ProvisioningState *string `json:"provisioningState,omitempty"` 2965} 2966 2967func unmarshalBasicSecretResourceProperties(body []byte) (BasicSecretResourceProperties, error) { 2968 var m map[string]interface{} 2969 err := json.Unmarshal(body, &m) 2970 if err != nil { 2971 return nil, err 2972 } 2973 2974 switch m["kind"] { 2975 case string(KindInlinedValue): 2976 var ivsrp InlinedValueSecretResourceProperties 2977 err := json.Unmarshal(body, &ivsrp) 2978 return ivsrp, err 2979 default: 2980 var srp SecretResourceProperties 2981 err := json.Unmarshal(body, &srp) 2982 return srp, err 2983 } 2984} 2985func unmarshalBasicSecretResourcePropertiesArray(body []byte) ([]BasicSecretResourceProperties, error) { 2986 var rawMessages []*json.RawMessage 2987 err := json.Unmarshal(body, &rawMessages) 2988 if err != nil { 2989 return nil, err 2990 } 2991 2992 srpArray := make([]BasicSecretResourceProperties, len(rawMessages)) 2993 2994 for index, rawMessage := range rawMessages { 2995 srp, err := unmarshalBasicSecretResourceProperties(*rawMessage) 2996 if err != nil { 2997 return nil, err 2998 } 2999 srpArray[index] = srp 3000 } 3001 return srpArray, nil 3002} 3003 3004// MarshalJSON is the custom marshaler for SecretResourceProperties. 3005func (srp SecretResourceProperties) MarshalJSON() ([]byte, error) { 3006 srp.Kind = KindSecretResourceProperties 3007 objectMap := make(map[string]interface{}) 3008 if srp.Description != nil { 3009 objectMap["description"] = srp.Description 3010 } 3011 if srp.ContentType != nil { 3012 objectMap["contentType"] = srp.ContentType 3013 } 3014 if srp.Kind != "" { 3015 objectMap["kind"] = srp.Kind 3016 } 3017 return json.Marshal(objectMap) 3018} 3019 3020// AsSecretResourceProperties is the BasicSecretResourcePropertiesBase implementation for SecretResourceProperties. 3021func (srp SecretResourceProperties) AsSecretResourceProperties() (*SecretResourceProperties, bool) { 3022 return &srp, true 3023} 3024 3025// AsBasicSecretResourceProperties is the BasicSecretResourcePropertiesBase implementation for SecretResourceProperties. 3026func (srp SecretResourceProperties) AsBasicSecretResourceProperties() (BasicSecretResourceProperties, bool) { 3027 return &srp, true 3028} 3029 3030// AsInlinedValueSecretResourceProperties is the BasicSecretResourcePropertiesBase implementation for SecretResourceProperties. 3031func (srp SecretResourceProperties) AsInlinedValueSecretResourceProperties() (*InlinedValueSecretResourceProperties, bool) { 3032 return nil, false 3033} 3034 3035// AsSecretResourcePropertiesBase is the BasicSecretResourcePropertiesBase implementation for SecretResourceProperties. 3036func (srp SecretResourceProperties) AsSecretResourcePropertiesBase() (*SecretResourcePropertiesBase, bool) { 3037 return nil, false 3038} 3039 3040// AsBasicSecretResourcePropertiesBase is the BasicSecretResourcePropertiesBase implementation for SecretResourceProperties. 3041func (srp SecretResourceProperties) AsBasicSecretResourcePropertiesBase() (BasicSecretResourcePropertiesBase, bool) { 3042 return &srp, true 3043} 3044 3045// BasicSecretResourcePropertiesBase this type describes the properties of a secret resource, including its kind. 3046type BasicSecretResourcePropertiesBase interface { 3047 AsSecretResourceProperties() (*SecretResourceProperties, bool) 3048 AsBasicSecretResourceProperties() (BasicSecretResourceProperties, bool) 3049 AsInlinedValueSecretResourceProperties() (*InlinedValueSecretResourceProperties, bool) 3050 AsSecretResourcePropertiesBase() (*SecretResourcePropertiesBase, bool) 3051} 3052 3053// SecretResourcePropertiesBase this type describes the properties of a secret resource, including its kind. 3054type SecretResourcePropertiesBase struct { 3055 // Kind - Possible values include: 'KindSecretResourcePropertiesBase', 'KindSecretResourceProperties', 'KindInlinedValue' 3056 Kind Kind `json:"kind,omitempty"` 3057 // ProvisioningState - READ-ONLY; State of the resource. 3058 ProvisioningState *string `json:"provisioningState,omitempty"` 3059} 3060 3061func unmarshalBasicSecretResourcePropertiesBase(body []byte) (BasicSecretResourcePropertiesBase, error) { 3062 var m map[string]interface{} 3063 err := json.Unmarshal(body, &m) 3064 if err != nil { 3065 return nil, err 3066 } 3067 3068 switch m["kind"] { 3069 case string(KindSecretResourceProperties): 3070 var srp SecretResourceProperties 3071 err := json.Unmarshal(body, &srp) 3072 return srp, err 3073 case string(KindInlinedValue): 3074 var ivsrp InlinedValueSecretResourceProperties 3075 err := json.Unmarshal(body, &ivsrp) 3076 return ivsrp, err 3077 default: 3078 var srpb SecretResourcePropertiesBase 3079 err := json.Unmarshal(body, &srpb) 3080 return srpb, err 3081 } 3082} 3083func unmarshalBasicSecretResourcePropertiesBaseArray(body []byte) ([]BasicSecretResourcePropertiesBase, error) { 3084 var rawMessages []*json.RawMessage 3085 err := json.Unmarshal(body, &rawMessages) 3086 if err != nil { 3087 return nil, err 3088 } 3089 3090 srpbArray := make([]BasicSecretResourcePropertiesBase, len(rawMessages)) 3091 3092 for index, rawMessage := range rawMessages { 3093 srpb, err := unmarshalBasicSecretResourcePropertiesBase(*rawMessage) 3094 if err != nil { 3095 return nil, err 3096 } 3097 srpbArray[index] = srpb 3098 } 3099 return srpbArray, nil 3100} 3101 3102// MarshalJSON is the custom marshaler for SecretResourcePropertiesBase. 3103func (srpb SecretResourcePropertiesBase) MarshalJSON() ([]byte, error) { 3104 srpb.Kind = KindSecretResourcePropertiesBase 3105 objectMap := make(map[string]interface{}) 3106 if srpb.Kind != "" { 3107 objectMap["kind"] = srpb.Kind 3108 } 3109 return json.Marshal(objectMap) 3110} 3111 3112// AsSecretResourceProperties is the BasicSecretResourcePropertiesBase implementation for SecretResourcePropertiesBase. 3113func (srpb SecretResourcePropertiesBase) AsSecretResourceProperties() (*SecretResourceProperties, bool) { 3114 return nil, false 3115} 3116 3117// AsBasicSecretResourceProperties is the BasicSecretResourcePropertiesBase implementation for SecretResourcePropertiesBase. 3118func (srpb SecretResourcePropertiesBase) AsBasicSecretResourceProperties() (BasicSecretResourceProperties, bool) { 3119 return nil, false 3120} 3121 3122// AsInlinedValueSecretResourceProperties is the BasicSecretResourcePropertiesBase implementation for SecretResourcePropertiesBase. 3123func (srpb SecretResourcePropertiesBase) AsInlinedValueSecretResourceProperties() (*InlinedValueSecretResourceProperties, bool) { 3124 return nil, false 3125} 3126 3127// AsSecretResourcePropertiesBase is the BasicSecretResourcePropertiesBase implementation for SecretResourcePropertiesBase. 3128func (srpb SecretResourcePropertiesBase) AsSecretResourcePropertiesBase() (*SecretResourcePropertiesBase, bool) { 3129 return &srpb, true 3130} 3131 3132// AsBasicSecretResourcePropertiesBase is the BasicSecretResourcePropertiesBase implementation for SecretResourcePropertiesBase. 3133func (srpb SecretResourcePropertiesBase) AsBasicSecretResourcePropertiesBase() (BasicSecretResourcePropertiesBase, bool) { 3134 return &srpb, true 3135} 3136 3137// SecretValue this type represents the unencrypted value of the secret. 3138type SecretValue struct { 3139 autorest.Response `json:"-"` 3140 // Value - The actual value of the secret. 3141 Value *string `json:"value,omitempty"` 3142} 3143 3144// SecretValueProperties this type describes properties of secret value resource. 3145type SecretValueProperties struct { 3146 // Value - The actual value of the secret. 3147 Value *string `json:"value,omitempty"` 3148} 3149 3150// SecretValueResourceDescription this type describes a value of a secret resource. The name of this 3151// resource is the version identifier corresponding to this secret value. 3152type SecretValueResourceDescription struct { 3153 autorest.Response `json:"-"` 3154 // SecretValueResourceProperties - This type describes properties of a secret value resource. 3155 *SecretValueResourceProperties `json:"properties,omitempty"` 3156 // Tags - Resource tags. 3157 Tags map[string]*string `json:"tags"` 3158 // Location - The geo-location where the resource lives 3159 Location *string `json:"location,omitempty"` 3160 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 3161 ID *string `json:"id,omitempty"` 3162 // Name - READ-ONLY; The name of the resource 3163 Name *string `json:"name,omitempty"` 3164 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 3165 Type *string `json:"type,omitempty"` 3166} 3167 3168// MarshalJSON is the custom marshaler for SecretValueResourceDescription. 3169func (svrd SecretValueResourceDescription) MarshalJSON() ([]byte, error) { 3170 objectMap := make(map[string]interface{}) 3171 if svrd.SecretValueResourceProperties != nil { 3172 objectMap["properties"] = svrd.SecretValueResourceProperties 3173 } 3174 if svrd.Tags != nil { 3175 objectMap["tags"] = svrd.Tags 3176 } 3177 if svrd.Location != nil { 3178 objectMap["location"] = svrd.Location 3179 } 3180 return json.Marshal(objectMap) 3181} 3182 3183// UnmarshalJSON is the custom unmarshaler for SecretValueResourceDescription struct. 3184func (svrd *SecretValueResourceDescription) UnmarshalJSON(body []byte) error { 3185 var m map[string]*json.RawMessage 3186 err := json.Unmarshal(body, &m) 3187 if err != nil { 3188 return err 3189 } 3190 for k, v := range m { 3191 switch k { 3192 case "properties": 3193 if v != nil { 3194 var secretValueResourceProperties SecretValueResourceProperties 3195 err = json.Unmarshal(*v, &secretValueResourceProperties) 3196 if err != nil { 3197 return err 3198 } 3199 svrd.SecretValueResourceProperties = &secretValueResourceProperties 3200 } 3201 case "tags": 3202 if v != nil { 3203 var tags map[string]*string 3204 err = json.Unmarshal(*v, &tags) 3205 if err != nil { 3206 return err 3207 } 3208 svrd.Tags = tags 3209 } 3210 case "location": 3211 if v != nil { 3212 var location string 3213 err = json.Unmarshal(*v, &location) 3214 if err != nil { 3215 return err 3216 } 3217 svrd.Location = &location 3218 } 3219 case "id": 3220 if v != nil { 3221 var ID string 3222 err = json.Unmarshal(*v, &ID) 3223 if err != nil { 3224 return err 3225 } 3226 svrd.ID = &ID 3227 } 3228 case "name": 3229 if v != nil { 3230 var name string 3231 err = json.Unmarshal(*v, &name) 3232 if err != nil { 3233 return err 3234 } 3235 svrd.Name = &name 3236 } 3237 case "type": 3238 if v != nil { 3239 var typeVar string 3240 err = json.Unmarshal(*v, &typeVar) 3241 if err != nil { 3242 return err 3243 } 3244 svrd.Type = &typeVar 3245 } 3246 } 3247 } 3248 3249 return nil 3250} 3251 3252// SecretValueResourceDescriptionList a pageable list of values of a secret resource. The information does 3253// not include only the name of the value and not the actual unencrypted value. 3254type SecretValueResourceDescriptionList struct { 3255 autorest.Response `json:"-"` 3256 // Value - One page of the list. 3257 Value *[]SecretValueResourceDescription `json:"value,omitempty"` 3258 // NextLink - URI to fetch the next page of the list. 3259 NextLink *string `json:"nextLink,omitempty"` 3260} 3261 3262// SecretValueResourceDescriptionListIterator provides access to a complete listing of 3263// SecretValueResourceDescription values. 3264type SecretValueResourceDescriptionListIterator struct { 3265 i int 3266 page SecretValueResourceDescriptionListPage 3267} 3268 3269// NextWithContext advances to the next value. If there was an error making 3270// the request the iterator does not advance and the error is returned. 3271func (iter *SecretValueResourceDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 3272 if tracing.IsEnabled() { 3273 ctx = tracing.StartSpan(ctx, fqdn+"/SecretValueResourceDescriptionListIterator.NextWithContext") 3274 defer func() { 3275 sc := -1 3276 if iter.Response().Response.Response != nil { 3277 sc = iter.Response().Response.Response.StatusCode 3278 } 3279 tracing.EndSpan(ctx, sc, err) 3280 }() 3281 } 3282 iter.i++ 3283 if iter.i < len(iter.page.Values()) { 3284 return nil 3285 } 3286 err = iter.page.NextWithContext(ctx) 3287 if err != nil { 3288 iter.i-- 3289 return err 3290 } 3291 iter.i = 0 3292 return nil 3293} 3294 3295// Next advances to the next value. If there was an error making 3296// the request the iterator does not advance and the error is returned. 3297// Deprecated: Use NextWithContext() instead. 3298func (iter *SecretValueResourceDescriptionListIterator) Next() error { 3299 return iter.NextWithContext(context.Background()) 3300} 3301 3302// NotDone returns true if the enumeration should be started or is not yet complete. 3303func (iter SecretValueResourceDescriptionListIterator) NotDone() bool { 3304 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3305} 3306 3307// Response returns the raw server response from the last page request. 3308func (iter SecretValueResourceDescriptionListIterator) Response() SecretValueResourceDescriptionList { 3309 return iter.page.Response() 3310} 3311 3312// Value returns the current value or a zero-initialized value if the 3313// iterator has advanced beyond the end of the collection. 3314func (iter SecretValueResourceDescriptionListIterator) Value() SecretValueResourceDescription { 3315 if !iter.page.NotDone() { 3316 return SecretValueResourceDescription{} 3317 } 3318 return iter.page.Values()[iter.i] 3319} 3320 3321// Creates a new instance of the SecretValueResourceDescriptionListIterator type. 3322func NewSecretValueResourceDescriptionListIterator(page SecretValueResourceDescriptionListPage) SecretValueResourceDescriptionListIterator { 3323 return SecretValueResourceDescriptionListIterator{page: page} 3324} 3325 3326// IsEmpty returns true if the ListResult contains no values. 3327func (svrdl SecretValueResourceDescriptionList) IsEmpty() bool { 3328 return svrdl.Value == nil || len(*svrdl.Value) == 0 3329} 3330 3331// hasNextLink returns true if the NextLink is not empty. 3332func (svrdl SecretValueResourceDescriptionList) hasNextLink() bool { 3333 return svrdl.NextLink != nil && len(*svrdl.NextLink) != 0 3334} 3335 3336// secretValueResourceDescriptionListPreparer prepares a request to retrieve the next set of results. 3337// It returns nil if no more results exist. 3338func (svrdl SecretValueResourceDescriptionList) secretValueResourceDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 3339 if !svrdl.hasNextLink() { 3340 return nil, nil 3341 } 3342 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3343 autorest.AsJSON(), 3344 autorest.AsGet(), 3345 autorest.WithBaseURL(to.String(svrdl.NextLink))) 3346} 3347 3348// SecretValueResourceDescriptionListPage contains a page of SecretValueResourceDescription values. 3349type SecretValueResourceDescriptionListPage struct { 3350 fn func(context.Context, SecretValueResourceDescriptionList) (SecretValueResourceDescriptionList, error) 3351 svrdl SecretValueResourceDescriptionList 3352} 3353 3354// NextWithContext advances to the next page of values. If there was an error making 3355// the request the page does not advance and the error is returned. 3356func (page *SecretValueResourceDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 3357 if tracing.IsEnabled() { 3358 ctx = tracing.StartSpan(ctx, fqdn+"/SecretValueResourceDescriptionListPage.NextWithContext") 3359 defer func() { 3360 sc := -1 3361 if page.Response().Response.Response != nil { 3362 sc = page.Response().Response.Response.StatusCode 3363 } 3364 tracing.EndSpan(ctx, sc, err) 3365 }() 3366 } 3367 for { 3368 next, err := page.fn(ctx, page.svrdl) 3369 if err != nil { 3370 return err 3371 } 3372 page.svrdl = next 3373 if !next.hasNextLink() || !next.IsEmpty() { 3374 break 3375 } 3376 } 3377 return nil 3378} 3379 3380// Next advances to the next page of values. If there was an error making 3381// the request the page does not advance and the error is returned. 3382// Deprecated: Use NextWithContext() instead. 3383func (page *SecretValueResourceDescriptionListPage) Next() error { 3384 return page.NextWithContext(context.Background()) 3385} 3386 3387// NotDone returns true if the page enumeration should be started or is not yet complete. 3388func (page SecretValueResourceDescriptionListPage) NotDone() bool { 3389 return !page.svrdl.IsEmpty() 3390} 3391 3392// Response returns the raw server response from the last page request. 3393func (page SecretValueResourceDescriptionListPage) Response() SecretValueResourceDescriptionList { 3394 return page.svrdl 3395} 3396 3397// Values returns the slice of values for the current page or nil if there are no values. 3398func (page SecretValueResourceDescriptionListPage) Values() []SecretValueResourceDescription { 3399 if page.svrdl.IsEmpty() { 3400 return nil 3401 } 3402 return *page.svrdl.Value 3403} 3404 3405// Creates a new instance of the SecretValueResourceDescriptionListPage type. 3406func NewSecretValueResourceDescriptionListPage(cur SecretValueResourceDescriptionList, getNextPage func(context.Context, SecretValueResourceDescriptionList) (SecretValueResourceDescriptionList, error)) SecretValueResourceDescriptionListPage { 3407 return SecretValueResourceDescriptionListPage{ 3408 fn: getNextPage, 3409 svrdl: cur, 3410 } 3411} 3412 3413// SecretValueResourceProperties this type describes properties of a secret value resource. 3414type SecretValueResourceProperties struct { 3415 // ProvisioningState - READ-ONLY; State of the resource. 3416 ProvisioningState *string `json:"provisioningState,omitempty"` 3417 // Value - The actual value of the secret. 3418 Value *string `json:"value,omitempty"` 3419} 3420 3421// MarshalJSON is the custom marshaler for SecretValueResourceProperties. 3422func (svrp SecretValueResourceProperties) MarshalJSON() ([]byte, error) { 3423 objectMap := make(map[string]interface{}) 3424 if svrp.Value != nil { 3425 objectMap["value"] = svrp.Value 3426 } 3427 return json.Marshal(objectMap) 3428} 3429 3430// ServiceProperties describes properties of a service resource. 3431type ServiceProperties struct { 3432 // Description - User readable description of the service. 3433 Description *string `json:"description,omitempty"` 3434 // ReplicaCount - The number of replicas of the service to create. Defaults to 1 if not specified. 3435 ReplicaCount *int32 `json:"replicaCount,omitempty"` 3436 // AutoScalingPolicies - Auto scaling policies 3437 AutoScalingPolicies *[]AutoScalingPolicy `json:"autoScalingPolicies,omitempty"` 3438 // Status - READ-ONLY; Status of the service. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 3439 Status ResourceStatus `json:"status,omitempty"` 3440 // StatusDetails - READ-ONLY; Gives additional information about the current status of the service. 3441 StatusDetails *string `json:"statusDetails,omitempty"` 3442 // HealthState - READ-ONLY; Describes the health state of an application resource. Possible values include: 'HealthStateInvalid', 'HealthStateOk', 'HealthStateWarning', 'HealthStateError', 'HealthStateUnknown' 3443 HealthState HealthState `json:"healthState,omitempty"` 3444 // UnhealthyEvaluation - READ-ONLY; When the service's health state is not 'Ok', this additional details from service fabric Health Manager for the user to know why the service is marked unhealthy. 3445 UnhealthyEvaluation *string `json:"unhealthyEvaluation,omitempty"` 3446} 3447 3448// MarshalJSON is the custom marshaler for ServiceProperties. 3449func (sp ServiceProperties) MarshalJSON() ([]byte, error) { 3450 objectMap := make(map[string]interface{}) 3451 if sp.Description != nil { 3452 objectMap["description"] = sp.Description 3453 } 3454 if sp.ReplicaCount != nil { 3455 objectMap["replicaCount"] = sp.ReplicaCount 3456 } 3457 if sp.AutoScalingPolicies != nil { 3458 objectMap["autoScalingPolicies"] = sp.AutoScalingPolicies 3459 } 3460 return json.Marshal(objectMap) 3461} 3462 3463// ServiceReplicaDescription describes a replica of a service resource. 3464type ServiceReplicaDescription struct { 3465 autorest.Response `json:"-"` 3466 // ReplicaName - Name of the replica. 3467 ReplicaName *string `json:"replicaName,omitempty"` 3468 // OsType - The operation system required by the code in service. Possible values include: 'Linux', 'Windows' 3469 OsType OperatingSystemType `json:"osType,omitempty"` 3470 // CodePackages - Describes the set of code packages that forms the service. A code package describes the container and the properties for running it. All the code packages are started together on the same host and share the same context (network, process etc.). 3471 CodePackages *[]ContainerCodePackageProperties `json:"codePackages,omitempty"` 3472 // NetworkRefs - The names of the private networks that this service needs to be part of. 3473 NetworkRefs *[]NetworkRef `json:"networkRefs,omitempty"` 3474 // Diagnostics - Reference to sinks in DiagnosticsDescription. 3475 Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` 3476} 3477 3478// ServiceReplicaDescriptionList a pageable list of service replicas. 3479type ServiceReplicaDescriptionList struct { 3480 autorest.Response `json:"-"` 3481 // Value - One page of the list. 3482 Value *[]ServiceReplicaDescription `json:"value,omitempty"` 3483 // NextLink - URI to fetch the next page of the list. 3484 NextLink *string `json:"nextLink,omitempty"` 3485} 3486 3487// ServiceReplicaDescriptionListIterator provides access to a complete listing of ServiceReplicaDescription 3488// values. 3489type ServiceReplicaDescriptionListIterator struct { 3490 i int 3491 page ServiceReplicaDescriptionListPage 3492} 3493 3494// NextWithContext advances to the next value. If there was an error making 3495// the request the iterator does not advance and the error is returned. 3496func (iter *ServiceReplicaDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 3497 if tracing.IsEnabled() { 3498 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceReplicaDescriptionListIterator.NextWithContext") 3499 defer func() { 3500 sc := -1 3501 if iter.Response().Response.Response != nil { 3502 sc = iter.Response().Response.Response.StatusCode 3503 } 3504 tracing.EndSpan(ctx, sc, err) 3505 }() 3506 } 3507 iter.i++ 3508 if iter.i < len(iter.page.Values()) { 3509 return nil 3510 } 3511 err = iter.page.NextWithContext(ctx) 3512 if err != nil { 3513 iter.i-- 3514 return err 3515 } 3516 iter.i = 0 3517 return nil 3518} 3519 3520// Next advances to the next value. If there was an error making 3521// the request the iterator does not advance and the error is returned. 3522// Deprecated: Use NextWithContext() instead. 3523func (iter *ServiceReplicaDescriptionListIterator) Next() error { 3524 return iter.NextWithContext(context.Background()) 3525} 3526 3527// NotDone returns true if the enumeration should be started or is not yet complete. 3528func (iter ServiceReplicaDescriptionListIterator) NotDone() bool { 3529 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3530} 3531 3532// Response returns the raw server response from the last page request. 3533func (iter ServiceReplicaDescriptionListIterator) Response() ServiceReplicaDescriptionList { 3534 return iter.page.Response() 3535} 3536 3537// Value returns the current value or a zero-initialized value if the 3538// iterator has advanced beyond the end of the collection. 3539func (iter ServiceReplicaDescriptionListIterator) Value() ServiceReplicaDescription { 3540 if !iter.page.NotDone() { 3541 return ServiceReplicaDescription{} 3542 } 3543 return iter.page.Values()[iter.i] 3544} 3545 3546// Creates a new instance of the ServiceReplicaDescriptionListIterator type. 3547func NewServiceReplicaDescriptionListIterator(page ServiceReplicaDescriptionListPage) ServiceReplicaDescriptionListIterator { 3548 return ServiceReplicaDescriptionListIterator{page: page} 3549} 3550 3551// IsEmpty returns true if the ListResult contains no values. 3552func (srdl ServiceReplicaDescriptionList) IsEmpty() bool { 3553 return srdl.Value == nil || len(*srdl.Value) == 0 3554} 3555 3556// hasNextLink returns true if the NextLink is not empty. 3557func (srdl ServiceReplicaDescriptionList) hasNextLink() bool { 3558 return srdl.NextLink != nil && len(*srdl.NextLink) != 0 3559} 3560 3561// serviceReplicaDescriptionListPreparer prepares a request to retrieve the next set of results. 3562// It returns nil if no more results exist. 3563func (srdl ServiceReplicaDescriptionList) serviceReplicaDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 3564 if !srdl.hasNextLink() { 3565 return nil, nil 3566 } 3567 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3568 autorest.AsJSON(), 3569 autorest.AsGet(), 3570 autorest.WithBaseURL(to.String(srdl.NextLink))) 3571} 3572 3573// ServiceReplicaDescriptionListPage contains a page of ServiceReplicaDescription values. 3574type ServiceReplicaDescriptionListPage struct { 3575 fn func(context.Context, ServiceReplicaDescriptionList) (ServiceReplicaDescriptionList, error) 3576 srdl ServiceReplicaDescriptionList 3577} 3578 3579// NextWithContext advances to the next page of values. If there was an error making 3580// the request the page does not advance and the error is returned. 3581func (page *ServiceReplicaDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 3582 if tracing.IsEnabled() { 3583 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceReplicaDescriptionListPage.NextWithContext") 3584 defer func() { 3585 sc := -1 3586 if page.Response().Response.Response != nil { 3587 sc = page.Response().Response.Response.StatusCode 3588 } 3589 tracing.EndSpan(ctx, sc, err) 3590 }() 3591 } 3592 for { 3593 next, err := page.fn(ctx, page.srdl) 3594 if err != nil { 3595 return err 3596 } 3597 page.srdl = next 3598 if !next.hasNextLink() || !next.IsEmpty() { 3599 break 3600 } 3601 } 3602 return nil 3603} 3604 3605// Next advances to the next page of values. If there was an error making 3606// the request the page does not advance and the error is returned. 3607// Deprecated: Use NextWithContext() instead. 3608func (page *ServiceReplicaDescriptionListPage) Next() error { 3609 return page.NextWithContext(context.Background()) 3610} 3611 3612// NotDone returns true if the page enumeration should be started or is not yet complete. 3613func (page ServiceReplicaDescriptionListPage) NotDone() bool { 3614 return !page.srdl.IsEmpty() 3615} 3616 3617// Response returns the raw server response from the last page request. 3618func (page ServiceReplicaDescriptionListPage) Response() ServiceReplicaDescriptionList { 3619 return page.srdl 3620} 3621 3622// Values returns the slice of values for the current page or nil if there are no values. 3623func (page ServiceReplicaDescriptionListPage) Values() []ServiceReplicaDescription { 3624 if page.srdl.IsEmpty() { 3625 return nil 3626 } 3627 return *page.srdl.Value 3628} 3629 3630// Creates a new instance of the ServiceReplicaDescriptionListPage type. 3631func NewServiceReplicaDescriptionListPage(cur ServiceReplicaDescriptionList, getNextPage func(context.Context, ServiceReplicaDescriptionList) (ServiceReplicaDescriptionList, error)) ServiceReplicaDescriptionListPage { 3632 return ServiceReplicaDescriptionListPage{ 3633 fn: getNextPage, 3634 srdl: cur, 3635 } 3636} 3637 3638// ServiceReplicaProperties describes the properties of a service replica. 3639type ServiceReplicaProperties struct { 3640 // OsType - The operation system required by the code in service. Possible values include: 'Linux', 'Windows' 3641 OsType OperatingSystemType `json:"osType,omitempty"` 3642 // CodePackages - Describes the set of code packages that forms the service. A code package describes the container and the properties for running it. All the code packages are started together on the same host and share the same context (network, process etc.). 3643 CodePackages *[]ContainerCodePackageProperties `json:"codePackages,omitempty"` 3644 // NetworkRefs - The names of the private networks that this service needs to be part of. 3645 NetworkRefs *[]NetworkRef `json:"networkRefs,omitempty"` 3646 // Diagnostics - Reference to sinks in DiagnosticsDescription. 3647 Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` 3648} 3649 3650// ServiceResourceDescription this type describes a service resource. 3651type ServiceResourceDescription struct { 3652 autorest.Response `json:"-"` 3653 // ServiceResourceProperties - This type describes properties of a service resource. 3654 *ServiceResourceProperties `json:"properties,omitempty"` 3655 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 3656 ID *string `json:"id,omitempty"` 3657 // Name - The name of the resource 3658 Name *string `json:"name,omitempty"` 3659 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 3660 Type *string `json:"type,omitempty"` 3661} 3662 3663// MarshalJSON is the custom marshaler for ServiceResourceDescription. 3664func (srd ServiceResourceDescription) MarshalJSON() ([]byte, error) { 3665 objectMap := make(map[string]interface{}) 3666 if srd.ServiceResourceProperties != nil { 3667 objectMap["properties"] = srd.ServiceResourceProperties 3668 } 3669 if srd.Name != nil { 3670 objectMap["name"] = srd.Name 3671 } 3672 return json.Marshal(objectMap) 3673} 3674 3675// UnmarshalJSON is the custom unmarshaler for ServiceResourceDescription struct. 3676func (srd *ServiceResourceDescription) UnmarshalJSON(body []byte) error { 3677 var m map[string]*json.RawMessage 3678 err := json.Unmarshal(body, &m) 3679 if err != nil { 3680 return err 3681 } 3682 for k, v := range m { 3683 switch k { 3684 case "properties": 3685 if v != nil { 3686 var serviceResourceProperties ServiceResourceProperties 3687 err = json.Unmarshal(*v, &serviceResourceProperties) 3688 if err != nil { 3689 return err 3690 } 3691 srd.ServiceResourceProperties = &serviceResourceProperties 3692 } 3693 case "id": 3694 if v != nil { 3695 var ID string 3696 err = json.Unmarshal(*v, &ID) 3697 if err != nil { 3698 return err 3699 } 3700 srd.ID = &ID 3701 } 3702 case "name": 3703 if v != nil { 3704 var name string 3705 err = json.Unmarshal(*v, &name) 3706 if err != nil { 3707 return err 3708 } 3709 srd.Name = &name 3710 } 3711 case "type": 3712 if v != nil { 3713 var typeVar string 3714 err = json.Unmarshal(*v, &typeVar) 3715 if err != nil { 3716 return err 3717 } 3718 srd.Type = &typeVar 3719 } 3720 } 3721 } 3722 3723 return nil 3724} 3725 3726// ServiceResourceDescriptionList a pageable list of service resources. 3727type ServiceResourceDescriptionList struct { 3728 autorest.Response `json:"-"` 3729 // Value - One page of the list. 3730 Value *[]ServiceResourceDescription `json:"value,omitempty"` 3731 // NextLink - URI to fetch the next page of the list. 3732 NextLink *string `json:"nextLink,omitempty"` 3733} 3734 3735// ServiceResourceDescriptionListIterator provides access to a complete listing of 3736// ServiceResourceDescription values. 3737type ServiceResourceDescriptionListIterator struct { 3738 i int 3739 page ServiceResourceDescriptionListPage 3740} 3741 3742// NextWithContext advances to the next value. If there was an error making 3743// the request the iterator does not advance and the error is returned. 3744func (iter *ServiceResourceDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 3745 if tracing.IsEnabled() { 3746 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceDescriptionListIterator.NextWithContext") 3747 defer func() { 3748 sc := -1 3749 if iter.Response().Response.Response != nil { 3750 sc = iter.Response().Response.Response.StatusCode 3751 } 3752 tracing.EndSpan(ctx, sc, err) 3753 }() 3754 } 3755 iter.i++ 3756 if iter.i < len(iter.page.Values()) { 3757 return nil 3758 } 3759 err = iter.page.NextWithContext(ctx) 3760 if err != nil { 3761 iter.i-- 3762 return err 3763 } 3764 iter.i = 0 3765 return nil 3766} 3767 3768// Next advances to the next value. If there was an error making 3769// the request the iterator does not advance and the error is returned. 3770// Deprecated: Use NextWithContext() instead. 3771func (iter *ServiceResourceDescriptionListIterator) Next() error { 3772 return iter.NextWithContext(context.Background()) 3773} 3774 3775// NotDone returns true if the enumeration should be started or is not yet complete. 3776func (iter ServiceResourceDescriptionListIterator) NotDone() bool { 3777 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3778} 3779 3780// Response returns the raw server response from the last page request. 3781func (iter ServiceResourceDescriptionListIterator) Response() ServiceResourceDescriptionList { 3782 return iter.page.Response() 3783} 3784 3785// Value returns the current value or a zero-initialized value if the 3786// iterator has advanced beyond the end of the collection. 3787func (iter ServiceResourceDescriptionListIterator) Value() ServiceResourceDescription { 3788 if !iter.page.NotDone() { 3789 return ServiceResourceDescription{} 3790 } 3791 return iter.page.Values()[iter.i] 3792} 3793 3794// Creates a new instance of the ServiceResourceDescriptionListIterator type. 3795func NewServiceResourceDescriptionListIterator(page ServiceResourceDescriptionListPage) ServiceResourceDescriptionListIterator { 3796 return ServiceResourceDescriptionListIterator{page: page} 3797} 3798 3799// IsEmpty returns true if the ListResult contains no values. 3800func (srdl ServiceResourceDescriptionList) IsEmpty() bool { 3801 return srdl.Value == nil || len(*srdl.Value) == 0 3802} 3803 3804// hasNextLink returns true if the NextLink is not empty. 3805func (srdl ServiceResourceDescriptionList) hasNextLink() bool { 3806 return srdl.NextLink != nil && len(*srdl.NextLink) != 0 3807} 3808 3809// serviceResourceDescriptionListPreparer prepares a request to retrieve the next set of results. 3810// It returns nil if no more results exist. 3811func (srdl ServiceResourceDescriptionList) serviceResourceDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 3812 if !srdl.hasNextLink() { 3813 return nil, nil 3814 } 3815 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3816 autorest.AsJSON(), 3817 autorest.AsGet(), 3818 autorest.WithBaseURL(to.String(srdl.NextLink))) 3819} 3820 3821// ServiceResourceDescriptionListPage contains a page of ServiceResourceDescription values. 3822type ServiceResourceDescriptionListPage struct { 3823 fn func(context.Context, ServiceResourceDescriptionList) (ServiceResourceDescriptionList, error) 3824 srdl ServiceResourceDescriptionList 3825} 3826 3827// NextWithContext advances to the next page of values. If there was an error making 3828// the request the page does not advance and the error is returned. 3829func (page *ServiceResourceDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 3830 if tracing.IsEnabled() { 3831 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceDescriptionListPage.NextWithContext") 3832 defer func() { 3833 sc := -1 3834 if page.Response().Response.Response != nil { 3835 sc = page.Response().Response.Response.StatusCode 3836 } 3837 tracing.EndSpan(ctx, sc, err) 3838 }() 3839 } 3840 for { 3841 next, err := page.fn(ctx, page.srdl) 3842 if err != nil { 3843 return err 3844 } 3845 page.srdl = next 3846 if !next.hasNextLink() || !next.IsEmpty() { 3847 break 3848 } 3849 } 3850 return nil 3851} 3852 3853// Next advances to the next page of values. If there was an error making 3854// the request the page does not advance and the error is returned. 3855// Deprecated: Use NextWithContext() instead. 3856func (page *ServiceResourceDescriptionListPage) Next() error { 3857 return page.NextWithContext(context.Background()) 3858} 3859 3860// NotDone returns true if the page enumeration should be started or is not yet complete. 3861func (page ServiceResourceDescriptionListPage) NotDone() bool { 3862 return !page.srdl.IsEmpty() 3863} 3864 3865// Response returns the raw server response from the last page request. 3866func (page ServiceResourceDescriptionListPage) Response() ServiceResourceDescriptionList { 3867 return page.srdl 3868} 3869 3870// Values returns the slice of values for the current page or nil if there are no values. 3871func (page ServiceResourceDescriptionListPage) Values() []ServiceResourceDescription { 3872 if page.srdl.IsEmpty() { 3873 return nil 3874 } 3875 return *page.srdl.Value 3876} 3877 3878// Creates a new instance of the ServiceResourceDescriptionListPage type. 3879func NewServiceResourceDescriptionListPage(cur ServiceResourceDescriptionList, getNextPage func(context.Context, ServiceResourceDescriptionList) (ServiceResourceDescriptionList, error)) ServiceResourceDescriptionListPage { 3880 return ServiceResourceDescriptionListPage{ 3881 fn: getNextPage, 3882 srdl: cur, 3883 } 3884} 3885 3886// ServiceResourceProperties this type describes properties of a service resource. 3887type ServiceResourceProperties struct { 3888 // ProvisioningState - READ-ONLY; State of the resource. 3889 ProvisioningState *string `json:"provisioningState,omitempty"` 3890 // OsType - The operation system required by the code in service. Possible values include: 'Linux', 'Windows' 3891 OsType OperatingSystemType `json:"osType,omitempty"` 3892 // CodePackages - Describes the set of code packages that forms the service. A code package describes the container and the properties for running it. All the code packages are started together on the same host and share the same context (network, process etc.). 3893 CodePackages *[]ContainerCodePackageProperties `json:"codePackages,omitempty"` 3894 // NetworkRefs - The names of the private networks that this service needs to be part of. 3895 NetworkRefs *[]NetworkRef `json:"networkRefs,omitempty"` 3896 // Diagnostics - Reference to sinks in DiagnosticsDescription. 3897 Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` 3898 // Description - User readable description of the service. 3899 Description *string `json:"description,omitempty"` 3900 // ReplicaCount - The number of replicas of the service to create. Defaults to 1 if not specified. 3901 ReplicaCount *int32 `json:"replicaCount,omitempty"` 3902 // AutoScalingPolicies - Auto scaling policies 3903 AutoScalingPolicies *[]AutoScalingPolicy `json:"autoScalingPolicies,omitempty"` 3904 // Status - READ-ONLY; Status of the service. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 3905 Status ResourceStatus `json:"status,omitempty"` 3906 // StatusDetails - READ-ONLY; Gives additional information about the current status of the service. 3907 StatusDetails *string `json:"statusDetails,omitempty"` 3908 // HealthState - READ-ONLY; Describes the health state of an application resource. Possible values include: 'HealthStateInvalid', 'HealthStateOk', 'HealthStateWarning', 'HealthStateError', 'HealthStateUnknown' 3909 HealthState HealthState `json:"healthState,omitempty"` 3910 // UnhealthyEvaluation - READ-ONLY; When the service's health state is not 'Ok', this additional details from service fabric Health Manager for the user to know why the service is marked unhealthy. 3911 UnhealthyEvaluation *string `json:"unhealthyEvaluation,omitempty"` 3912} 3913 3914// MarshalJSON is the custom marshaler for ServiceResourceProperties. 3915func (srp ServiceResourceProperties) MarshalJSON() ([]byte, error) { 3916 objectMap := make(map[string]interface{}) 3917 if srp.OsType != "" { 3918 objectMap["osType"] = srp.OsType 3919 } 3920 if srp.CodePackages != nil { 3921 objectMap["codePackages"] = srp.CodePackages 3922 } 3923 if srp.NetworkRefs != nil { 3924 objectMap["networkRefs"] = srp.NetworkRefs 3925 } 3926 if srp.Diagnostics != nil { 3927 objectMap["diagnostics"] = srp.Diagnostics 3928 } 3929 if srp.Description != nil { 3930 objectMap["description"] = srp.Description 3931 } 3932 if srp.ReplicaCount != nil { 3933 objectMap["replicaCount"] = srp.ReplicaCount 3934 } 3935 if srp.AutoScalingPolicies != nil { 3936 objectMap["autoScalingPolicies"] = srp.AutoScalingPolicies 3937 } 3938 return json.Marshal(objectMap) 3939} 3940 3941// Setting describes a setting for the container. The setting file path can be fetched from environment 3942// variable "Fabric_SettingPath". The path for Windows container is "C:\\secrets". The path for Linux 3943// container is "/var/secrets". 3944type Setting struct { 3945 // Name - The name of the setting. 3946 Name *string `json:"name,omitempty"` 3947 // Value - The value of the setting. 3948 Value *string `json:"value,omitempty"` 3949} 3950 3951// TCPConfig describes the tcp configuration for external connectivity for this network. 3952type TCPConfig struct { 3953 // Name - tcp gateway config name. 3954 Name *string `json:"name,omitempty"` 3955 // Port - Specifies the port at which the service endpoint below needs to be exposed. 3956 Port *int32 `json:"port,omitempty"` 3957 // Destination - Describes destination endpoint for routing traffic. 3958 Destination *GatewayDestination `json:"destination,omitempty"` 3959} 3960 3961// TrackedResource the resource model definition for Azure Resource Manager tracked top-level resource. 3962type TrackedResource struct { 3963 // Tags - Resource tags. 3964 Tags map[string]*string `json:"tags"` 3965 // Location - The geo-location where the resource lives 3966 Location *string `json:"location,omitempty"` 3967 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 3968 ID *string `json:"id,omitempty"` 3969 // Name - READ-ONLY; The name of the resource 3970 Name *string `json:"name,omitempty"` 3971 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 3972 Type *string `json:"type,omitempty"` 3973} 3974 3975// MarshalJSON is the custom marshaler for TrackedResource. 3976func (tr TrackedResource) MarshalJSON() ([]byte, error) { 3977 objectMap := make(map[string]interface{}) 3978 if tr.Tags != nil { 3979 objectMap["tags"] = tr.Tags 3980 } 3981 if tr.Location != nil { 3982 objectMap["location"] = tr.Location 3983 } 3984 return json.Marshal(objectMap) 3985} 3986 3987// VolumeProperties describes properties of a volume resource. 3988type VolumeProperties struct { 3989 // Description - User readable description of the volume. 3990 Description *string `json:"description,omitempty"` 3991 // Status - READ-ONLY; Status of the volume. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 3992 Status ResourceStatus `json:"status,omitempty"` 3993 // StatusDetails - READ-ONLY; Gives additional information about the current status of the volume. 3994 StatusDetails *string `json:"statusDetails,omitempty"` 3995 // Provider - Provider of the volume. 3996 Provider *string `json:"provider,omitempty"` 3997 // AzureFileParameters - This type describes a volume provided by an Azure Files file share. 3998 AzureFileParameters *VolumeProviderParametersAzureFile `json:"azureFileParameters,omitempty"` 3999} 4000 4001// MarshalJSON is the custom marshaler for VolumeProperties. 4002func (vp VolumeProperties) MarshalJSON() ([]byte, error) { 4003 objectMap := make(map[string]interface{}) 4004 if vp.Description != nil { 4005 objectMap["description"] = vp.Description 4006 } 4007 if vp.Provider != nil { 4008 objectMap["provider"] = vp.Provider 4009 } 4010 if vp.AzureFileParameters != nil { 4011 objectMap["azureFileParameters"] = vp.AzureFileParameters 4012 } 4013 return json.Marshal(objectMap) 4014} 4015 4016// VolumeProviderParametersAzureFile this type describes a volume provided by an Azure Files file share. 4017type VolumeProviderParametersAzureFile struct { 4018 // AccountName - Name of the Azure storage account for the File Share. 4019 AccountName *string `json:"accountName,omitempty"` 4020 // AccountKey - Access key of the Azure storage account for the File Share. 4021 AccountKey *string `json:"accountKey,omitempty"` 4022 // ShareName - Name of the Azure Files file share that provides storage for the volume. 4023 ShareName *string `json:"shareName,omitempty"` 4024} 4025 4026// VolumeReference describes a reference to a volume resource. 4027type VolumeReference struct { 4028 // Name - Name of the volume being referenced. 4029 Name *string `json:"name,omitempty"` 4030 // ReadOnly - The flag indicating whether the volume is read only. Default is 'false'. 4031 ReadOnly *bool `json:"readOnly,omitempty"` 4032 // DestinationPath - The path within the container at which the volume should be mounted. Only valid path characters are allowed. 4033 DestinationPath *string `json:"destinationPath,omitempty"` 4034} 4035 4036// VolumeResourceDescription this type describes a volume resource. 4037type VolumeResourceDescription struct { 4038 autorest.Response `json:"-"` 4039 // VolumeResourceProperties - This type describes properties of a volume resource. 4040 *VolumeResourceProperties `json:"properties,omitempty"` 4041 // Tags - Resource tags. 4042 Tags map[string]*string `json:"tags"` 4043 // Location - The geo-location where the resource lives 4044 Location *string `json:"location,omitempty"` 4045 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 4046 ID *string `json:"id,omitempty"` 4047 // Name - READ-ONLY; The name of the resource 4048 Name *string `json:"name,omitempty"` 4049 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 4050 Type *string `json:"type,omitempty"` 4051} 4052 4053// MarshalJSON is the custom marshaler for VolumeResourceDescription. 4054func (vrd VolumeResourceDescription) MarshalJSON() ([]byte, error) { 4055 objectMap := make(map[string]interface{}) 4056 if vrd.VolumeResourceProperties != nil { 4057 objectMap["properties"] = vrd.VolumeResourceProperties 4058 } 4059 if vrd.Tags != nil { 4060 objectMap["tags"] = vrd.Tags 4061 } 4062 if vrd.Location != nil { 4063 objectMap["location"] = vrd.Location 4064 } 4065 return json.Marshal(objectMap) 4066} 4067 4068// UnmarshalJSON is the custom unmarshaler for VolumeResourceDescription struct. 4069func (vrd *VolumeResourceDescription) UnmarshalJSON(body []byte) error { 4070 var m map[string]*json.RawMessage 4071 err := json.Unmarshal(body, &m) 4072 if err != nil { 4073 return err 4074 } 4075 for k, v := range m { 4076 switch k { 4077 case "properties": 4078 if v != nil { 4079 var volumeResourceProperties VolumeResourceProperties 4080 err = json.Unmarshal(*v, &volumeResourceProperties) 4081 if err != nil { 4082 return err 4083 } 4084 vrd.VolumeResourceProperties = &volumeResourceProperties 4085 } 4086 case "tags": 4087 if v != nil { 4088 var tags map[string]*string 4089 err = json.Unmarshal(*v, &tags) 4090 if err != nil { 4091 return err 4092 } 4093 vrd.Tags = tags 4094 } 4095 case "location": 4096 if v != nil { 4097 var location string 4098 err = json.Unmarshal(*v, &location) 4099 if err != nil { 4100 return err 4101 } 4102 vrd.Location = &location 4103 } 4104 case "id": 4105 if v != nil { 4106 var ID string 4107 err = json.Unmarshal(*v, &ID) 4108 if err != nil { 4109 return err 4110 } 4111 vrd.ID = &ID 4112 } 4113 case "name": 4114 if v != nil { 4115 var name string 4116 err = json.Unmarshal(*v, &name) 4117 if err != nil { 4118 return err 4119 } 4120 vrd.Name = &name 4121 } 4122 case "type": 4123 if v != nil { 4124 var typeVar string 4125 err = json.Unmarshal(*v, &typeVar) 4126 if err != nil { 4127 return err 4128 } 4129 vrd.Type = &typeVar 4130 } 4131 } 4132 } 4133 4134 return nil 4135} 4136 4137// VolumeResourceDescriptionList a pageable list of volume resources. 4138type VolumeResourceDescriptionList struct { 4139 autorest.Response `json:"-"` 4140 // Value - One page of the list. 4141 Value *[]VolumeResourceDescription `json:"value,omitempty"` 4142 // NextLink - URI to fetch the next page of the list. 4143 NextLink *string `json:"nextLink,omitempty"` 4144} 4145 4146// VolumeResourceDescriptionListIterator provides access to a complete listing of VolumeResourceDescription 4147// values. 4148type VolumeResourceDescriptionListIterator struct { 4149 i int 4150 page VolumeResourceDescriptionListPage 4151} 4152 4153// NextWithContext advances to the next value. If there was an error making 4154// the request the iterator does not advance and the error is returned. 4155func (iter *VolumeResourceDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 4156 if tracing.IsEnabled() { 4157 ctx = tracing.StartSpan(ctx, fqdn+"/VolumeResourceDescriptionListIterator.NextWithContext") 4158 defer func() { 4159 sc := -1 4160 if iter.Response().Response.Response != nil { 4161 sc = iter.Response().Response.Response.StatusCode 4162 } 4163 tracing.EndSpan(ctx, sc, err) 4164 }() 4165 } 4166 iter.i++ 4167 if iter.i < len(iter.page.Values()) { 4168 return nil 4169 } 4170 err = iter.page.NextWithContext(ctx) 4171 if err != nil { 4172 iter.i-- 4173 return err 4174 } 4175 iter.i = 0 4176 return nil 4177} 4178 4179// Next advances to the next value. If there was an error making 4180// the request the iterator does not advance and the error is returned. 4181// Deprecated: Use NextWithContext() instead. 4182func (iter *VolumeResourceDescriptionListIterator) Next() error { 4183 return iter.NextWithContext(context.Background()) 4184} 4185 4186// NotDone returns true if the enumeration should be started or is not yet complete. 4187func (iter VolumeResourceDescriptionListIterator) NotDone() bool { 4188 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 4189} 4190 4191// Response returns the raw server response from the last page request. 4192func (iter VolumeResourceDescriptionListIterator) Response() VolumeResourceDescriptionList { 4193 return iter.page.Response() 4194} 4195 4196// Value returns the current value or a zero-initialized value if the 4197// iterator has advanced beyond the end of the collection. 4198func (iter VolumeResourceDescriptionListIterator) Value() VolumeResourceDescription { 4199 if !iter.page.NotDone() { 4200 return VolumeResourceDescription{} 4201 } 4202 return iter.page.Values()[iter.i] 4203} 4204 4205// Creates a new instance of the VolumeResourceDescriptionListIterator type. 4206func NewVolumeResourceDescriptionListIterator(page VolumeResourceDescriptionListPage) VolumeResourceDescriptionListIterator { 4207 return VolumeResourceDescriptionListIterator{page: page} 4208} 4209 4210// IsEmpty returns true if the ListResult contains no values. 4211func (vrdl VolumeResourceDescriptionList) IsEmpty() bool { 4212 return vrdl.Value == nil || len(*vrdl.Value) == 0 4213} 4214 4215// hasNextLink returns true if the NextLink is not empty. 4216func (vrdl VolumeResourceDescriptionList) hasNextLink() bool { 4217 return vrdl.NextLink != nil && len(*vrdl.NextLink) != 0 4218} 4219 4220// volumeResourceDescriptionListPreparer prepares a request to retrieve the next set of results. 4221// It returns nil if no more results exist. 4222func (vrdl VolumeResourceDescriptionList) volumeResourceDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 4223 if !vrdl.hasNextLink() { 4224 return nil, nil 4225 } 4226 return autorest.Prepare((&http.Request{}).WithContext(ctx), 4227 autorest.AsJSON(), 4228 autorest.AsGet(), 4229 autorest.WithBaseURL(to.String(vrdl.NextLink))) 4230} 4231 4232// VolumeResourceDescriptionListPage contains a page of VolumeResourceDescription values. 4233type VolumeResourceDescriptionListPage struct { 4234 fn func(context.Context, VolumeResourceDescriptionList) (VolumeResourceDescriptionList, error) 4235 vrdl VolumeResourceDescriptionList 4236} 4237 4238// NextWithContext advances to the next page of values. If there was an error making 4239// the request the page does not advance and the error is returned. 4240func (page *VolumeResourceDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 4241 if tracing.IsEnabled() { 4242 ctx = tracing.StartSpan(ctx, fqdn+"/VolumeResourceDescriptionListPage.NextWithContext") 4243 defer func() { 4244 sc := -1 4245 if page.Response().Response.Response != nil { 4246 sc = page.Response().Response.Response.StatusCode 4247 } 4248 tracing.EndSpan(ctx, sc, err) 4249 }() 4250 } 4251 for { 4252 next, err := page.fn(ctx, page.vrdl) 4253 if err != nil { 4254 return err 4255 } 4256 page.vrdl = next 4257 if !next.hasNextLink() || !next.IsEmpty() { 4258 break 4259 } 4260 } 4261 return nil 4262} 4263 4264// Next advances to the next page of values. If there was an error making 4265// the request the page does not advance and the error is returned. 4266// Deprecated: Use NextWithContext() instead. 4267func (page *VolumeResourceDescriptionListPage) Next() error { 4268 return page.NextWithContext(context.Background()) 4269} 4270 4271// NotDone returns true if the page enumeration should be started or is not yet complete. 4272func (page VolumeResourceDescriptionListPage) NotDone() bool { 4273 return !page.vrdl.IsEmpty() 4274} 4275 4276// Response returns the raw server response from the last page request. 4277func (page VolumeResourceDescriptionListPage) Response() VolumeResourceDescriptionList { 4278 return page.vrdl 4279} 4280 4281// Values returns the slice of values for the current page or nil if there are no values. 4282func (page VolumeResourceDescriptionListPage) Values() []VolumeResourceDescription { 4283 if page.vrdl.IsEmpty() { 4284 return nil 4285 } 4286 return *page.vrdl.Value 4287} 4288 4289// Creates a new instance of the VolumeResourceDescriptionListPage type. 4290func NewVolumeResourceDescriptionListPage(cur VolumeResourceDescriptionList, getNextPage func(context.Context, VolumeResourceDescriptionList) (VolumeResourceDescriptionList, error)) VolumeResourceDescriptionListPage { 4291 return VolumeResourceDescriptionListPage{ 4292 fn: getNextPage, 4293 vrdl: cur, 4294 } 4295} 4296 4297// VolumeResourceProperties this type describes properties of a volume resource. 4298type VolumeResourceProperties struct { 4299 // ProvisioningState - READ-ONLY; State of the resource. 4300 ProvisioningState *string `json:"provisioningState,omitempty"` 4301 // Description - User readable description of the volume. 4302 Description *string `json:"description,omitempty"` 4303 // Status - READ-ONLY; Status of the volume. Possible values include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 4304 Status ResourceStatus `json:"status,omitempty"` 4305 // StatusDetails - READ-ONLY; Gives additional information about the current status of the volume. 4306 StatusDetails *string `json:"statusDetails,omitempty"` 4307 // Provider - Provider of the volume. 4308 Provider *string `json:"provider,omitempty"` 4309 // AzureFileParameters - This type describes a volume provided by an Azure Files file share. 4310 AzureFileParameters *VolumeProviderParametersAzureFile `json:"azureFileParameters,omitempty"` 4311} 4312 4313// MarshalJSON is the custom marshaler for VolumeResourceProperties. 4314func (vrp VolumeResourceProperties) MarshalJSON() ([]byte, error) { 4315 objectMap := make(map[string]interface{}) 4316 if vrp.Description != nil { 4317 objectMap["description"] = vrp.Description 4318 } 4319 if vrp.Provider != nil { 4320 objectMap["provider"] = vrp.Provider 4321 } 4322 if vrp.AzureFileParameters != nil { 4323 objectMap["azureFileParameters"] = vrp.AzureFileParameters 4324 } 4325 return json.Marshal(objectMap) 4326} 4327