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