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-07-01-preview/servicefabricmesh" 21 22// ApplicationProperties this type describes properties of an application resource. 23type ApplicationProperties struct { 24 // Description - User readable description of the application. 25 Description *string `json:"description,omitempty"` 26 // DebugParams - Internal use. 27 DebugParams *string `json:"debugParams,omitempty"` 28 // Services - describes the services in the application. 29 Services *[]ServiceResourceDescription `json:"services,omitempty"` 30 // HealthState - READ-ONLY; Describes the health state of an application resource. Possible values include: 'HealthStateInvalid', 'HealthStateOk', 'HealthStateWarning', 'HealthStateError', 'HealthStateUnknown' 31 HealthState HealthState `json:"healthState,omitempty"` 32 // 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. 33 UnhealthyEvaluation *string `json:"unhealthyEvaluation,omitempty"` 34 // Status - READ-ONLY; Status of the application resource. Possible values include: 'Invalid', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 35 Status ApplicationResourceStatus `json:"status,omitempty"` 36 // StatusDetails - READ-ONLY; Gives additional information about the current status of the application deployment. 37 StatusDetails *string `json:"statusDetails,omitempty"` 38 // ServiceNames - READ-ONLY; Names of the services in the application. 39 ServiceNames *[]string `json:"serviceNames,omitempty"` 40 // Diagnostics - Describes the diagnostics definition and usage for an application resource. 41 Diagnostics *DiagnosticsDescription `json:"diagnostics,omitempty"` 42} 43 44// MarshalJSON is the custom marshaler for ApplicationProperties. 45func (ap ApplicationProperties) MarshalJSON() ([]byte, error) { 46 objectMap := make(map[string]interface{}) 47 if ap.Description != nil { 48 objectMap["description"] = ap.Description 49 } 50 if ap.DebugParams != nil { 51 objectMap["debugParams"] = ap.DebugParams 52 } 53 if ap.Services != nil { 54 objectMap["services"] = ap.Services 55 } 56 if ap.Diagnostics != nil { 57 objectMap["diagnostics"] = ap.Diagnostics 58 } 59 return json.Marshal(objectMap) 60} 61 62// ApplicationResourceDescription this type describes an application resource. 63type ApplicationResourceDescription struct { 64 autorest.Response `json:"-"` 65 // ApplicationResourceProperties - This type describes properties of an application resource. 66 *ApplicationResourceProperties `json:"properties,omitempty"` 67 // Tags - Resource tags. 68 Tags map[string]*string `json:"tags"` 69 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 70 ID *string `json:"id,omitempty"` 71 // Name - READ-ONLY; The name of the resource 72 Name *string `json:"name,omitempty"` 73 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 74 Type *string `json:"type,omitempty"` 75 // Location - The geo-location where the resource lives 76 Location *string `json:"location,omitempty"` 77} 78 79// MarshalJSON is the custom marshaler for ApplicationResourceDescription. 80func (ard ApplicationResourceDescription) MarshalJSON() ([]byte, error) { 81 objectMap := make(map[string]interface{}) 82 if ard.ApplicationResourceProperties != nil { 83 objectMap["properties"] = ard.ApplicationResourceProperties 84 } 85 if ard.Tags != nil { 86 objectMap["tags"] = ard.Tags 87 } 88 if ard.Location != nil { 89 objectMap["location"] = ard.Location 90 } 91 return json.Marshal(objectMap) 92} 93 94// UnmarshalJSON is the custom unmarshaler for ApplicationResourceDescription struct. 95func (ard *ApplicationResourceDescription) UnmarshalJSON(body []byte) error { 96 var m map[string]*json.RawMessage 97 err := json.Unmarshal(body, &m) 98 if err != nil { 99 return err 100 } 101 for k, v := range m { 102 switch k { 103 case "properties": 104 if v != nil { 105 var applicationResourceProperties ApplicationResourceProperties 106 err = json.Unmarshal(*v, &applicationResourceProperties) 107 if err != nil { 108 return err 109 } 110 ard.ApplicationResourceProperties = &applicationResourceProperties 111 } 112 case "tags": 113 if v != nil { 114 var tags map[string]*string 115 err = json.Unmarshal(*v, &tags) 116 if err != nil { 117 return err 118 } 119 ard.Tags = tags 120 } 121 case "id": 122 if v != nil { 123 var ID string 124 err = json.Unmarshal(*v, &ID) 125 if err != nil { 126 return err 127 } 128 ard.ID = &ID 129 } 130 case "name": 131 if v != nil { 132 var name string 133 err = json.Unmarshal(*v, &name) 134 if err != nil { 135 return err 136 } 137 ard.Name = &name 138 } 139 case "type": 140 if v != nil { 141 var typeVar string 142 err = json.Unmarshal(*v, &typeVar) 143 if err != nil { 144 return err 145 } 146 ard.Type = &typeVar 147 } 148 case "location": 149 if v != nil { 150 var location string 151 err = json.Unmarshal(*v, &location) 152 if err != nil { 153 return err 154 } 155 ard.Location = &location 156 } 157 } 158 } 159 160 return nil 161} 162 163// ApplicationResourceDescriptionList a pageable list of application resources. 164type ApplicationResourceDescriptionList struct { 165 autorest.Response `json:"-"` 166 // Value - One page of the list. 167 Value *[]ApplicationResourceDescription `json:"value,omitempty"` 168 // NextLink - URI to fetch the next page of the list. 169 NextLink *string `json:"nextLink,omitempty"` 170} 171 172// ApplicationResourceDescriptionListIterator provides access to a complete listing of 173// ApplicationResourceDescription values. 174type ApplicationResourceDescriptionListIterator struct { 175 i int 176 page ApplicationResourceDescriptionListPage 177} 178 179// NextWithContext advances to the next value. If there was an error making 180// the request the iterator does not advance and the error is returned. 181func (iter *ApplicationResourceDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 182 if tracing.IsEnabled() { 183 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationResourceDescriptionListIterator.NextWithContext") 184 defer func() { 185 sc := -1 186 if iter.Response().Response.Response != nil { 187 sc = iter.Response().Response.Response.StatusCode 188 } 189 tracing.EndSpan(ctx, sc, err) 190 }() 191 } 192 iter.i++ 193 if iter.i < len(iter.page.Values()) { 194 return nil 195 } 196 err = iter.page.NextWithContext(ctx) 197 if err != nil { 198 iter.i-- 199 return err 200 } 201 iter.i = 0 202 return nil 203} 204 205// Next advances to the next value. If there was an error making 206// the request the iterator does not advance and the error is returned. 207// Deprecated: Use NextWithContext() instead. 208func (iter *ApplicationResourceDescriptionListIterator) Next() error { 209 return iter.NextWithContext(context.Background()) 210} 211 212// NotDone returns true if the enumeration should be started or is not yet complete. 213func (iter ApplicationResourceDescriptionListIterator) NotDone() bool { 214 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 215} 216 217// Response returns the raw server response from the last page request. 218func (iter ApplicationResourceDescriptionListIterator) Response() ApplicationResourceDescriptionList { 219 return iter.page.Response() 220} 221 222// Value returns the current value or a zero-initialized value if the 223// iterator has advanced beyond the end of the collection. 224func (iter ApplicationResourceDescriptionListIterator) Value() ApplicationResourceDescription { 225 if !iter.page.NotDone() { 226 return ApplicationResourceDescription{} 227 } 228 return iter.page.Values()[iter.i] 229} 230 231// Creates a new instance of the ApplicationResourceDescriptionListIterator type. 232func NewApplicationResourceDescriptionListIterator(page ApplicationResourceDescriptionListPage) ApplicationResourceDescriptionListIterator { 233 return ApplicationResourceDescriptionListIterator{page: page} 234} 235 236// IsEmpty returns true if the ListResult contains no values. 237func (ardl ApplicationResourceDescriptionList) IsEmpty() bool { 238 return ardl.Value == nil || len(*ardl.Value) == 0 239} 240 241// hasNextLink returns true if the NextLink is not empty. 242func (ardl ApplicationResourceDescriptionList) hasNextLink() bool { 243 return ardl.NextLink != nil && len(*ardl.NextLink) != 0 244} 245 246// applicationResourceDescriptionListPreparer prepares a request to retrieve the next set of results. 247// It returns nil if no more results exist. 248func (ardl ApplicationResourceDescriptionList) applicationResourceDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 249 if !ardl.hasNextLink() { 250 return nil, nil 251 } 252 return autorest.Prepare((&http.Request{}).WithContext(ctx), 253 autorest.AsJSON(), 254 autorest.AsGet(), 255 autorest.WithBaseURL(to.String(ardl.NextLink))) 256} 257 258// ApplicationResourceDescriptionListPage contains a page of ApplicationResourceDescription values. 259type ApplicationResourceDescriptionListPage struct { 260 fn func(context.Context, ApplicationResourceDescriptionList) (ApplicationResourceDescriptionList, error) 261 ardl ApplicationResourceDescriptionList 262} 263 264// NextWithContext advances to the next page of values. If there was an error making 265// the request the page does not advance and the error is returned. 266func (page *ApplicationResourceDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 267 if tracing.IsEnabled() { 268 ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationResourceDescriptionListPage.NextWithContext") 269 defer func() { 270 sc := -1 271 if page.Response().Response.Response != nil { 272 sc = page.Response().Response.Response.StatusCode 273 } 274 tracing.EndSpan(ctx, sc, err) 275 }() 276 } 277 for { 278 next, err := page.fn(ctx, page.ardl) 279 if err != nil { 280 return err 281 } 282 page.ardl = next 283 if !next.hasNextLink() || !next.IsEmpty() { 284 break 285 } 286 } 287 return nil 288} 289 290// Next advances to the next page of values. If there was an error making 291// the request the page does not advance and the error is returned. 292// Deprecated: Use NextWithContext() instead. 293func (page *ApplicationResourceDescriptionListPage) Next() error { 294 return page.NextWithContext(context.Background()) 295} 296 297// NotDone returns true if the page enumeration should be started or is not yet complete. 298func (page ApplicationResourceDescriptionListPage) NotDone() bool { 299 return !page.ardl.IsEmpty() 300} 301 302// Response returns the raw server response from the last page request. 303func (page ApplicationResourceDescriptionListPage) Response() ApplicationResourceDescriptionList { 304 return page.ardl 305} 306 307// Values returns the slice of values for the current page or nil if there are no values. 308func (page ApplicationResourceDescriptionListPage) Values() []ApplicationResourceDescription { 309 if page.ardl.IsEmpty() { 310 return nil 311 } 312 return *page.ardl.Value 313} 314 315// Creates a new instance of the ApplicationResourceDescriptionListPage type. 316func NewApplicationResourceDescriptionListPage(cur ApplicationResourceDescriptionList, getNextPage func(context.Context, ApplicationResourceDescriptionList) (ApplicationResourceDescriptionList, error)) ApplicationResourceDescriptionListPage { 317 return ApplicationResourceDescriptionListPage{ 318 fn: getNextPage, 319 ardl: cur, 320 } 321} 322 323// ApplicationResourceProperties this type describes properties of an application resource. 324type ApplicationResourceProperties struct { 325 // ProvisioningState - READ-ONLY; State of the resource. 326 ProvisioningState *string `json:"provisioningState,omitempty"` 327 // Description - User readable description of the application. 328 Description *string `json:"description,omitempty"` 329 // DebugParams - Internal use. 330 DebugParams *string `json:"debugParams,omitempty"` 331 // Services - describes the services in the application. 332 Services *[]ServiceResourceDescription `json:"services,omitempty"` 333 // HealthState - READ-ONLY; Describes the health state of an application resource. Possible values include: 'HealthStateInvalid', 'HealthStateOk', 'HealthStateWarning', 'HealthStateError', 'HealthStateUnknown' 334 HealthState HealthState `json:"healthState,omitempty"` 335 // 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. 336 UnhealthyEvaluation *string `json:"unhealthyEvaluation,omitempty"` 337 // Status - READ-ONLY; Status of the application resource. Possible values include: 'Invalid', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' 338 Status ApplicationResourceStatus `json:"status,omitempty"` 339 // StatusDetails - READ-ONLY; Gives additional information about the current status of the application deployment. 340 StatusDetails *string `json:"statusDetails,omitempty"` 341 // ServiceNames - READ-ONLY; Names of the services in the application. 342 ServiceNames *[]string `json:"serviceNames,omitempty"` 343 // Diagnostics - Describes the diagnostics definition and usage for an application resource. 344 Diagnostics *DiagnosticsDescription `json:"diagnostics,omitempty"` 345} 346 347// MarshalJSON is the custom marshaler for ApplicationResourceProperties. 348func (arp ApplicationResourceProperties) MarshalJSON() ([]byte, error) { 349 objectMap := make(map[string]interface{}) 350 if arp.Description != nil { 351 objectMap["description"] = arp.Description 352 } 353 if arp.DebugParams != nil { 354 objectMap["debugParams"] = arp.DebugParams 355 } 356 if arp.Services != nil { 357 objectMap["services"] = arp.Services 358 } 359 if arp.Diagnostics != nil { 360 objectMap["diagnostics"] = arp.Diagnostics 361 } 362 return json.Marshal(objectMap) 363} 364 365// AvailableOperationDisplay an operation available at the listed Azure resource provider. 366type AvailableOperationDisplay struct { 367 // Provider - Name of the operation provider. 368 Provider *string `json:"provider,omitempty"` 369 // Resource - Name of the resource on which the operation is available. 370 Resource *string `json:"resource,omitempty"` 371 // Operation - Name of the available operation. 372 Operation *string `json:"operation,omitempty"` 373 // Description - Description of the available operation. 374 Description *string `json:"description,omitempty"` 375} 376 377// AzureInternalMonitoringPipelineSinkDescription diagnostics settings for Geneva. 378type AzureInternalMonitoringPipelineSinkDescription struct { 379 // AccountName - Azure Internal monitoring pipeline account. 380 AccountName *string `json:"accountName,omitempty"` 381 // Namespace - Azure Internal monitoring pipeline account namespace. 382 Namespace *string `json:"namespace,omitempty"` 383 // MaConfigURL - Azure Internal monitoring agent configuration. 384 MaConfigURL *string `json:"maConfigUrl,omitempty"` 385 // FluentdConfigURL - Azure Internal monitoring agent fluentd configuration. 386 FluentdConfigURL interface{} `json:"fluentdConfigUrl,omitempty"` 387 // AutoKeyConfigURL - Azure Internal monitoring pipeline autokey associated with the certificate. 388 AutoKeyConfigURL *string `json:"autoKeyConfigUrl,omitempty"` 389 // Name - Name of the sink. This value is referenced by DiagnosticsReferenceDescription 390 Name *string `json:"name,omitempty"` 391 // Description - A description of the sink. 392 Description *string `json:"description,omitempty"` 393 // Kind - Possible values include: 'KindDiagnosticsSinkProperties', 'KindAzureInternalMonitoringPipeline' 394 Kind Kind `json:"kind,omitempty"` 395} 396 397// MarshalJSON is the custom marshaler for AzureInternalMonitoringPipelineSinkDescription. 398func (aimpsd AzureInternalMonitoringPipelineSinkDescription) MarshalJSON() ([]byte, error) { 399 aimpsd.Kind = KindAzureInternalMonitoringPipeline 400 objectMap := make(map[string]interface{}) 401 if aimpsd.AccountName != nil { 402 objectMap["accountName"] = aimpsd.AccountName 403 } 404 if aimpsd.Namespace != nil { 405 objectMap["namespace"] = aimpsd.Namespace 406 } 407 if aimpsd.MaConfigURL != nil { 408 objectMap["maConfigUrl"] = aimpsd.MaConfigURL 409 } 410 if aimpsd.FluentdConfigURL != nil { 411 objectMap["fluentdConfigUrl"] = aimpsd.FluentdConfigURL 412 } 413 if aimpsd.AutoKeyConfigURL != nil { 414 objectMap["autoKeyConfigUrl"] = aimpsd.AutoKeyConfigURL 415 } 416 if aimpsd.Name != nil { 417 objectMap["name"] = aimpsd.Name 418 } 419 if aimpsd.Description != nil { 420 objectMap["description"] = aimpsd.Description 421 } 422 if aimpsd.Kind != "" { 423 objectMap["kind"] = aimpsd.Kind 424 } 425 return json.Marshal(objectMap) 426} 427 428// AsAzureInternalMonitoringPipelineSinkDescription is the BasicDiagnosticsSinkProperties implementation for AzureInternalMonitoringPipelineSinkDescription. 429func (aimpsd AzureInternalMonitoringPipelineSinkDescription) AsAzureInternalMonitoringPipelineSinkDescription() (*AzureInternalMonitoringPipelineSinkDescription, bool) { 430 return &aimpsd, true 431} 432 433// AsDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for AzureInternalMonitoringPipelineSinkDescription. 434func (aimpsd AzureInternalMonitoringPipelineSinkDescription) AsDiagnosticsSinkProperties() (*DiagnosticsSinkProperties, bool) { 435 return nil, false 436} 437 438// AsBasicDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for AzureInternalMonitoringPipelineSinkDescription. 439func (aimpsd AzureInternalMonitoringPipelineSinkDescription) AsBasicDiagnosticsSinkProperties() (BasicDiagnosticsSinkProperties, bool) { 440 return &aimpsd, true 441} 442 443// ContainerCodePackageProperties describes a container and its runtime properties. 444type ContainerCodePackageProperties struct { 445 // Name - The name of the code package. 446 Name *string `json:"name,omitempty"` 447 // Image - The Container image to use. 448 Image *string `json:"image,omitempty"` 449 // ImageRegistryCredential - Image registry credential. 450 ImageRegistryCredential *ImageRegistryCredential `json:"imageRegistryCredential,omitempty"` 451 // Entrypoint - Override for the default entry point in the container. 452 Entrypoint *string `json:"entrypoint,omitempty"` 453 // Commands - Command array to execute within the container in exec form. 454 Commands *[]string `json:"commands,omitempty"` 455 // EnvironmentVariables - The environment variables to set in this container 456 EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` 457 // 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". 458 Settings *[]Setting `json:"settings,omitempty"` 459 // Labels - The labels to set in this container. 460 Labels *[]ContainerLabel `json:"labels,omitempty"` 461 // Endpoints - The endpoints exposed by this container. 462 Endpoints *[]EndpointProperties `json:"endpoints,omitempty"` 463 // Resources - This type describes the resource requirements for a container or a service. 464 Resources *ResourceRequirements `json:"resources,omitempty"` 465 // VolumeRefs - The volumes to be attached to the container. 466 VolumeRefs *[]ContainerVolume `json:"volumeRefs,omitempty"` 467 // InstanceView - READ-ONLY; Runtime information of a container instance. 468 InstanceView *ContainerInstanceView `json:"instanceView,omitempty"` 469 // Diagnostics - Reference to sinks in DiagnosticsDescription. 470 Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` 471} 472 473// MarshalJSON is the custom marshaler for ContainerCodePackageProperties. 474func (ccpp ContainerCodePackageProperties) MarshalJSON() ([]byte, error) { 475 objectMap := make(map[string]interface{}) 476 if ccpp.Name != nil { 477 objectMap["name"] = ccpp.Name 478 } 479 if ccpp.Image != nil { 480 objectMap["image"] = ccpp.Image 481 } 482 if ccpp.ImageRegistryCredential != nil { 483 objectMap["imageRegistryCredential"] = ccpp.ImageRegistryCredential 484 } 485 if ccpp.Entrypoint != nil { 486 objectMap["entrypoint"] = ccpp.Entrypoint 487 } 488 if ccpp.Commands != nil { 489 objectMap["commands"] = ccpp.Commands 490 } 491 if ccpp.EnvironmentVariables != nil { 492 objectMap["environmentVariables"] = ccpp.EnvironmentVariables 493 } 494 if ccpp.Settings != nil { 495 objectMap["settings"] = ccpp.Settings 496 } 497 if ccpp.Labels != nil { 498 objectMap["labels"] = ccpp.Labels 499 } 500 if ccpp.Endpoints != nil { 501 objectMap["endpoints"] = ccpp.Endpoints 502 } 503 if ccpp.Resources != nil { 504 objectMap["resources"] = ccpp.Resources 505 } 506 if ccpp.VolumeRefs != nil { 507 objectMap["volumeRefs"] = ccpp.VolumeRefs 508 } 509 if ccpp.Diagnostics != nil { 510 objectMap["diagnostics"] = ccpp.Diagnostics 511 } 512 return json.Marshal(objectMap) 513} 514 515// ContainerEvent a container event. 516type ContainerEvent struct { 517 // Name - The name of the container event. 518 Name *string `json:"name,omitempty"` 519 // Count - The count of the event. 520 Count *int32 `json:"count,omitempty"` 521 // FirstTimestamp - Date/time of the first event. 522 FirstTimestamp *string `json:"firstTimestamp,omitempty"` 523 // LastTimestamp - Date/time of the last event. 524 LastTimestamp *string `json:"lastTimestamp,omitempty"` 525 // Message - The event message 526 Message *string `json:"message,omitempty"` 527 // Type - The event type. 528 Type *string `json:"type,omitempty"` 529} 530 531// ContainerInstanceView runtime information of a container instance. 532type ContainerInstanceView struct { 533 // RestartCount - The number of times the container has been restarted. 534 RestartCount *int32 `json:"restartCount,omitempty"` 535 // CurrentState - Current container instance state. 536 CurrentState *ContainerState `json:"currentState,omitempty"` 537 // PreviousState - Previous container instance state. 538 PreviousState *ContainerState `json:"previousState,omitempty"` 539 // Events - The events of this container instance. 540 Events *[]ContainerEvent `json:"events,omitempty"` 541} 542 543// ContainerLabel describes a container label. 544type ContainerLabel struct { 545 // Name - The name of the container label. 546 Name *string `json:"name,omitempty"` 547 // Value - The value of the container label. 548 Value *string `json:"value,omitempty"` 549} 550 551// ContainerLogs the logs of the container. 552type ContainerLogs struct { 553 autorest.Response `json:"-"` 554 // Content - content of the log. 555 Content *string `json:"content,omitempty"` 556} 557 558// ContainerState the container state. 559type ContainerState struct { 560 // State - The state of this container 561 State *string `json:"state,omitempty"` 562 // StartTime - Date/time when the container state started. 563 StartTime *date.Time `json:"startTime,omitempty"` 564 // ExitCode - The container exit code. 565 ExitCode *string `json:"exitCode,omitempty"` 566 // FinishTime - Date/time when the container state finished. 567 FinishTime *date.Time `json:"finishTime,omitempty"` 568 // DetailStatus - Human-readable status of this state. 569 DetailStatus *string `json:"detailStatus,omitempty"` 570} 571 572// ContainerVolume describes how a volume is attached to a container. 573type ContainerVolume struct { 574 // Name - Name of the volume. 575 Name *string `json:"name,omitempty"` 576 // ReadOnly - The flag indicating whether the volume is read only. Default is 'false'. 577 ReadOnly *bool `json:"readOnly,omitempty"` 578 // DestinationPath - The path within the container at which the volume should be mounted. Only valid path characters are allowed. 579 DestinationPath *string `json:"destinationPath,omitempty"` 580} 581 582// DiagnosticsDescription describes the diagnostics options available 583type DiagnosticsDescription struct { 584 // Sinks - List of supported sinks that can be referenced. 585 Sinks *[]BasicDiagnosticsSinkProperties `json:"sinks,omitempty"` 586 // Enabled - Status of whether or not sinks are enabled. 587 Enabled *bool `json:"enabled,omitempty"` 588 // DefaultSinkRefs - The sinks to be used if diagnostics is enabled. Sink choices can be overridden at the service and code package level. 589 DefaultSinkRefs *[]string `json:"defaultSinkRefs,omitempty"` 590} 591 592// UnmarshalJSON is the custom unmarshaler for DiagnosticsDescription struct. 593func (dd *DiagnosticsDescription) UnmarshalJSON(body []byte) error { 594 var m map[string]*json.RawMessage 595 err := json.Unmarshal(body, &m) 596 if err != nil { 597 return err 598 } 599 for k, v := range m { 600 switch k { 601 case "sinks": 602 if v != nil { 603 sinks, err := unmarshalBasicDiagnosticsSinkPropertiesArray(*v) 604 if err != nil { 605 return err 606 } 607 dd.Sinks = &sinks 608 } 609 case "enabled": 610 if v != nil { 611 var enabled bool 612 err = json.Unmarshal(*v, &enabled) 613 if err != nil { 614 return err 615 } 616 dd.Enabled = &enabled 617 } 618 case "defaultSinkRefs": 619 if v != nil { 620 var defaultSinkRefs []string 621 err = json.Unmarshal(*v, &defaultSinkRefs) 622 if err != nil { 623 return err 624 } 625 dd.DefaultSinkRefs = &defaultSinkRefs 626 } 627 } 628 } 629 630 return nil 631} 632 633// DiagnosticsRef reference to sinks in DiagnosticsDescription. 634type DiagnosticsRef struct { 635 // Enabled - Status of whether or not sinks are enabled. 636 Enabled *bool `json:"enabled,omitempty"` 637 // SinkRefs - List of sinks to be used if enabled. References the list of sinks in DiagnosticsDescription. 638 SinkRefs *[]string `json:"sinkRefs,omitempty"` 639} 640 641// BasicDiagnosticsSinkProperties properties of a DiagnosticsSink. 642type BasicDiagnosticsSinkProperties interface { 643 AsAzureInternalMonitoringPipelineSinkDescription() (*AzureInternalMonitoringPipelineSinkDescription, bool) 644 AsDiagnosticsSinkProperties() (*DiagnosticsSinkProperties, bool) 645} 646 647// DiagnosticsSinkProperties properties of a DiagnosticsSink. 648type DiagnosticsSinkProperties struct { 649 // Name - Name of the sink. This value is referenced by DiagnosticsReferenceDescription 650 Name *string `json:"name,omitempty"` 651 // Description - A description of the sink. 652 Description *string `json:"description,omitempty"` 653 // Kind - Possible values include: 'KindDiagnosticsSinkProperties', 'KindAzureInternalMonitoringPipeline' 654 Kind Kind `json:"kind,omitempty"` 655} 656 657func unmarshalBasicDiagnosticsSinkProperties(body []byte) (BasicDiagnosticsSinkProperties, error) { 658 var m map[string]interface{} 659 err := json.Unmarshal(body, &m) 660 if err != nil { 661 return nil, err 662 } 663 664 switch m["kind"] { 665 case string(KindAzureInternalMonitoringPipeline): 666 var aimpsd AzureInternalMonitoringPipelineSinkDescription 667 err := json.Unmarshal(body, &aimpsd) 668 return aimpsd, err 669 default: 670 var dsp DiagnosticsSinkProperties 671 err := json.Unmarshal(body, &dsp) 672 return dsp, err 673 } 674} 675func unmarshalBasicDiagnosticsSinkPropertiesArray(body []byte) ([]BasicDiagnosticsSinkProperties, error) { 676 var rawMessages []*json.RawMessage 677 err := json.Unmarshal(body, &rawMessages) 678 if err != nil { 679 return nil, err 680 } 681 682 dspArray := make([]BasicDiagnosticsSinkProperties, len(rawMessages)) 683 684 for index, rawMessage := range rawMessages { 685 dsp, err := unmarshalBasicDiagnosticsSinkProperties(*rawMessage) 686 if err != nil { 687 return nil, err 688 } 689 dspArray[index] = dsp 690 } 691 return dspArray, nil 692} 693 694// MarshalJSON is the custom marshaler for DiagnosticsSinkProperties. 695func (dsp DiagnosticsSinkProperties) MarshalJSON() ([]byte, error) { 696 dsp.Kind = KindDiagnosticsSinkProperties 697 objectMap := make(map[string]interface{}) 698 if dsp.Name != nil { 699 objectMap["name"] = dsp.Name 700 } 701 if dsp.Description != nil { 702 objectMap["description"] = dsp.Description 703 } 704 if dsp.Kind != "" { 705 objectMap["kind"] = dsp.Kind 706 } 707 return json.Marshal(objectMap) 708} 709 710// AsAzureInternalMonitoringPipelineSinkDescription is the BasicDiagnosticsSinkProperties implementation for DiagnosticsSinkProperties. 711func (dsp DiagnosticsSinkProperties) AsAzureInternalMonitoringPipelineSinkDescription() (*AzureInternalMonitoringPipelineSinkDescription, bool) { 712 return nil, false 713} 714 715// AsDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for DiagnosticsSinkProperties. 716func (dsp DiagnosticsSinkProperties) AsDiagnosticsSinkProperties() (*DiagnosticsSinkProperties, bool) { 717 return &dsp, true 718} 719 720// AsBasicDiagnosticsSinkProperties is the BasicDiagnosticsSinkProperties implementation for DiagnosticsSinkProperties. 721func (dsp DiagnosticsSinkProperties) AsBasicDiagnosticsSinkProperties() (BasicDiagnosticsSinkProperties, bool) { 722 return &dsp, true 723} 724 725// EndpointProperties describes a container endpoint. 726type EndpointProperties struct { 727 // Name - The name of the endpoint. 728 Name *string `json:"name,omitempty"` 729 // Port - Port used by the container. 730 Port *int32 `json:"port,omitempty"` 731} 732 733// EnvironmentVariable describes an environment variable for the container. 734type EnvironmentVariable struct { 735 // Name - The name of the environment variable. 736 Name *string `json:"name,omitempty"` 737 // Value - The value of the environment variable. 738 Value *string `json:"value,omitempty"` 739} 740 741// ErrorModel the error details. 742type ErrorModel struct { 743 // Code - The error code. 744 Code *string `json:"code,omitempty"` 745 // Message - The error message. 746 Message *string `json:"message,omitempty"` 747} 748 749// ImageRegistryCredential image registry credential. 750type ImageRegistryCredential struct { 751 // Server - Docker image registry server, without protocol such as `http` and `https`. 752 Server *string `json:"server,omitempty"` 753 // Username - The username for the private registry. 754 Username *string `json:"username,omitempty"` 755 // Password - The password for the private registry. 756 Password *string `json:"password,omitempty"` 757} 758 759// IngressConfig describes public connectivity configuration for the network. 760type IngressConfig struct { 761 // QosLevel - The QoS tier for ingress. Possible values include: 'Bronze' 762 QosLevel IngressQoSLevel `json:"qosLevel,omitempty"` 763 // Layer4 - Configuration for layer4 public connectivity for this network. 764 Layer4 *[]Layer4IngressConfig `json:"layer4,omitempty"` 765 // PublicIPAddress - READ-ONLY; The public IP address for reaching this network. 766 PublicIPAddress *string `json:"publicIPAddress,omitempty"` 767} 768 769// MarshalJSON is the custom marshaler for IngressConfig. 770func (ic IngressConfig) MarshalJSON() ([]byte, error) { 771 objectMap := make(map[string]interface{}) 772 if ic.QosLevel != "" { 773 objectMap["qosLevel"] = ic.QosLevel 774 } 775 if ic.Layer4 != nil { 776 objectMap["layer4"] = ic.Layer4 777 } 778 return json.Marshal(objectMap) 779} 780 781// Layer4IngressConfig describes the layer4 configuration for public connectivity for this network. 782type Layer4IngressConfig struct { 783 // Name - Layer4 ingress config name. 784 Name *string `json:"name,omitempty"` 785 // PublicPort - Specifies the public port at which the service endpoint below needs to be exposed. 786 PublicPort *int32 `json:"publicPort,omitempty"` 787 // ApplicationName - The application name which contains the service to be exposed. 788 ApplicationName *string `json:"applicationName,omitempty"` 789 // ServiceName - The service whose endpoint needs to be exposed at the public port. 790 ServiceName *string `json:"serviceName,omitempty"` 791 // EndpointName - The service endpoint that needs to be exposed. 792 EndpointName *string `json:"endpointName,omitempty"` 793} 794 795// ManagedProxyResource the resource model definition for Azure Resource Manager proxy resource. It will 796// have everything other than required location and tags. This proxy resource is explicitly created or 797// updated by including it in the parent resource. 798type ManagedProxyResource struct { 799 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 800 ID *string `json:"id,omitempty"` 801 // Name - The name of the resource 802 Name *string `json:"name,omitempty"` 803 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 804 Type *string `json:"type,omitempty"` 805} 806 807// MarshalJSON is the custom marshaler for ManagedProxyResource. 808func (mpr ManagedProxyResource) MarshalJSON() ([]byte, error) { 809 objectMap := make(map[string]interface{}) 810 if mpr.Name != nil { 811 objectMap["name"] = mpr.Name 812 } 813 return json.Marshal(objectMap) 814} 815 816// NetworkProperties describes a network. 817type NetworkProperties struct { 818 // Description - User readable description of the network. 819 Description *string `json:"description,omitempty"` 820 // AddressPrefix - the address prefix for this network. 821 AddressPrefix *string `json:"addressPrefix,omitempty"` 822 // IngressConfig - Configuration for public connectivity for this network. 823 IngressConfig *IngressConfig `json:"ingressConfig,omitempty"` 824} 825 826// NetworkRef describes a network reference in a service. 827type NetworkRef struct { 828 // Name - Name of the network. 829 Name *string `json:"name,omitempty"` 830} 831 832// NetworkResourceDescription this type describes a network resource. 833type NetworkResourceDescription struct { 834 autorest.Response `json:"-"` 835 // NetworkResourceProperties - Describes properties of a network resource. 836 *NetworkResourceProperties `json:"properties,omitempty"` 837 // Tags - Resource tags. 838 Tags map[string]*string `json:"tags"` 839 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 840 ID *string `json:"id,omitempty"` 841 // Name - READ-ONLY; The name of the resource 842 Name *string `json:"name,omitempty"` 843 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 844 Type *string `json:"type,omitempty"` 845 // Location - The geo-location where the resource lives 846 Location *string `json:"location,omitempty"` 847} 848 849// MarshalJSON is the custom marshaler for NetworkResourceDescription. 850func (nrd NetworkResourceDescription) MarshalJSON() ([]byte, error) { 851 objectMap := make(map[string]interface{}) 852 if nrd.NetworkResourceProperties != nil { 853 objectMap["properties"] = nrd.NetworkResourceProperties 854 } 855 if nrd.Tags != nil { 856 objectMap["tags"] = nrd.Tags 857 } 858 if nrd.Location != nil { 859 objectMap["location"] = nrd.Location 860 } 861 return json.Marshal(objectMap) 862} 863 864// UnmarshalJSON is the custom unmarshaler for NetworkResourceDescription struct. 865func (nrd *NetworkResourceDescription) UnmarshalJSON(body []byte) error { 866 var m map[string]*json.RawMessage 867 err := json.Unmarshal(body, &m) 868 if err != nil { 869 return err 870 } 871 for k, v := range m { 872 switch k { 873 case "properties": 874 if v != nil { 875 var networkResourceProperties NetworkResourceProperties 876 err = json.Unmarshal(*v, &networkResourceProperties) 877 if err != nil { 878 return err 879 } 880 nrd.NetworkResourceProperties = &networkResourceProperties 881 } 882 case "tags": 883 if v != nil { 884 var tags map[string]*string 885 err = json.Unmarshal(*v, &tags) 886 if err != nil { 887 return err 888 } 889 nrd.Tags = tags 890 } 891 case "id": 892 if v != nil { 893 var ID string 894 err = json.Unmarshal(*v, &ID) 895 if err != nil { 896 return err 897 } 898 nrd.ID = &ID 899 } 900 case "name": 901 if v != nil { 902 var name string 903 err = json.Unmarshal(*v, &name) 904 if err != nil { 905 return err 906 } 907 nrd.Name = &name 908 } 909 case "type": 910 if v != nil { 911 var typeVar string 912 err = json.Unmarshal(*v, &typeVar) 913 if err != nil { 914 return err 915 } 916 nrd.Type = &typeVar 917 } 918 case "location": 919 if v != nil { 920 var location string 921 err = json.Unmarshal(*v, &location) 922 if err != nil { 923 return err 924 } 925 nrd.Location = &location 926 } 927 } 928 } 929 930 return nil 931} 932 933// NetworkResourceDescriptionList a pageable list of network resources. 934type NetworkResourceDescriptionList struct { 935 autorest.Response `json:"-"` 936 // Value - One page of the list. 937 Value *[]NetworkResourceDescription `json:"value,omitempty"` 938 // NextLink - URI to fetch the next page of the list. 939 NextLink *string `json:"nextLink,omitempty"` 940} 941 942// NetworkResourceDescriptionListIterator provides access to a complete listing of 943// NetworkResourceDescription values. 944type NetworkResourceDescriptionListIterator struct { 945 i int 946 page NetworkResourceDescriptionListPage 947} 948 949// NextWithContext advances to the next value. If there was an error making 950// the request the iterator does not advance and the error is returned. 951func (iter *NetworkResourceDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 952 if tracing.IsEnabled() { 953 ctx = tracing.StartSpan(ctx, fqdn+"/NetworkResourceDescriptionListIterator.NextWithContext") 954 defer func() { 955 sc := -1 956 if iter.Response().Response.Response != nil { 957 sc = iter.Response().Response.Response.StatusCode 958 } 959 tracing.EndSpan(ctx, sc, err) 960 }() 961 } 962 iter.i++ 963 if iter.i < len(iter.page.Values()) { 964 return nil 965 } 966 err = iter.page.NextWithContext(ctx) 967 if err != nil { 968 iter.i-- 969 return err 970 } 971 iter.i = 0 972 return nil 973} 974 975// Next advances to the next value. If there was an error making 976// the request the iterator does not advance and the error is returned. 977// Deprecated: Use NextWithContext() instead. 978func (iter *NetworkResourceDescriptionListIterator) Next() error { 979 return iter.NextWithContext(context.Background()) 980} 981 982// NotDone returns true if the enumeration should be started or is not yet complete. 983func (iter NetworkResourceDescriptionListIterator) NotDone() bool { 984 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 985} 986 987// Response returns the raw server response from the last page request. 988func (iter NetworkResourceDescriptionListIterator) Response() NetworkResourceDescriptionList { 989 return iter.page.Response() 990} 991 992// Value returns the current value or a zero-initialized value if the 993// iterator has advanced beyond the end of the collection. 994func (iter NetworkResourceDescriptionListIterator) Value() NetworkResourceDescription { 995 if !iter.page.NotDone() { 996 return NetworkResourceDescription{} 997 } 998 return iter.page.Values()[iter.i] 999} 1000 1001// Creates a new instance of the NetworkResourceDescriptionListIterator type. 1002func NewNetworkResourceDescriptionListIterator(page NetworkResourceDescriptionListPage) NetworkResourceDescriptionListIterator { 1003 return NetworkResourceDescriptionListIterator{page: page} 1004} 1005 1006// IsEmpty returns true if the ListResult contains no values. 1007func (nrdl NetworkResourceDescriptionList) IsEmpty() bool { 1008 return nrdl.Value == nil || len(*nrdl.Value) == 0 1009} 1010 1011// hasNextLink returns true if the NextLink is not empty. 1012func (nrdl NetworkResourceDescriptionList) hasNextLink() bool { 1013 return nrdl.NextLink != nil && len(*nrdl.NextLink) != 0 1014} 1015 1016// networkResourceDescriptionListPreparer prepares a request to retrieve the next set of results. 1017// It returns nil if no more results exist. 1018func (nrdl NetworkResourceDescriptionList) networkResourceDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 1019 if !nrdl.hasNextLink() { 1020 return nil, nil 1021 } 1022 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1023 autorest.AsJSON(), 1024 autorest.AsGet(), 1025 autorest.WithBaseURL(to.String(nrdl.NextLink))) 1026} 1027 1028// NetworkResourceDescriptionListPage contains a page of NetworkResourceDescription values. 1029type NetworkResourceDescriptionListPage struct { 1030 fn func(context.Context, NetworkResourceDescriptionList) (NetworkResourceDescriptionList, error) 1031 nrdl NetworkResourceDescriptionList 1032} 1033 1034// NextWithContext advances to the next page of values. If there was an error making 1035// the request the page does not advance and the error is returned. 1036func (page *NetworkResourceDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 1037 if tracing.IsEnabled() { 1038 ctx = tracing.StartSpan(ctx, fqdn+"/NetworkResourceDescriptionListPage.NextWithContext") 1039 defer func() { 1040 sc := -1 1041 if page.Response().Response.Response != nil { 1042 sc = page.Response().Response.Response.StatusCode 1043 } 1044 tracing.EndSpan(ctx, sc, err) 1045 }() 1046 } 1047 for { 1048 next, err := page.fn(ctx, page.nrdl) 1049 if err != nil { 1050 return err 1051 } 1052 page.nrdl = next 1053 if !next.hasNextLink() || !next.IsEmpty() { 1054 break 1055 } 1056 } 1057 return nil 1058} 1059 1060// Next advances to the next page of values. If there was an error making 1061// the request the page does not advance and the error is returned. 1062// Deprecated: Use NextWithContext() instead. 1063func (page *NetworkResourceDescriptionListPage) Next() error { 1064 return page.NextWithContext(context.Background()) 1065} 1066 1067// NotDone returns true if the page enumeration should be started or is not yet complete. 1068func (page NetworkResourceDescriptionListPage) NotDone() bool { 1069 return !page.nrdl.IsEmpty() 1070} 1071 1072// Response returns the raw server response from the last page request. 1073func (page NetworkResourceDescriptionListPage) Response() NetworkResourceDescriptionList { 1074 return page.nrdl 1075} 1076 1077// Values returns the slice of values for the current page or nil if there are no values. 1078func (page NetworkResourceDescriptionListPage) Values() []NetworkResourceDescription { 1079 if page.nrdl.IsEmpty() { 1080 return nil 1081 } 1082 return *page.nrdl.Value 1083} 1084 1085// Creates a new instance of the NetworkResourceDescriptionListPage type. 1086func NewNetworkResourceDescriptionListPage(cur NetworkResourceDescriptionList, getNextPage func(context.Context, NetworkResourceDescriptionList) (NetworkResourceDescriptionList, error)) NetworkResourceDescriptionListPage { 1087 return NetworkResourceDescriptionListPage{ 1088 fn: getNextPage, 1089 nrdl: cur, 1090 } 1091} 1092 1093// NetworkResourceProperties describes properties of a network resource. 1094type NetworkResourceProperties struct { 1095 // ProvisioningState - READ-ONLY; State of the resource. 1096 ProvisioningState *string `json:"provisioningState,omitempty"` 1097 // Description - User readable description of the network. 1098 Description *string `json:"description,omitempty"` 1099 // AddressPrefix - the address prefix for this network. 1100 AddressPrefix *string `json:"addressPrefix,omitempty"` 1101 // IngressConfig - Configuration for public connectivity for this network. 1102 IngressConfig *IngressConfig `json:"ingressConfig,omitempty"` 1103} 1104 1105// MarshalJSON is the custom marshaler for NetworkResourceProperties. 1106func (nrp NetworkResourceProperties) MarshalJSON() ([]byte, error) { 1107 objectMap := make(map[string]interface{}) 1108 if nrp.Description != nil { 1109 objectMap["description"] = nrp.Description 1110 } 1111 if nrp.AddressPrefix != nil { 1112 objectMap["addressPrefix"] = nrp.AddressPrefix 1113 } 1114 if nrp.IngressConfig != nil { 1115 objectMap["ingressConfig"] = nrp.IngressConfig 1116 } 1117 return json.Marshal(objectMap) 1118} 1119 1120// OperationListResult describes the result of the request to list Service Fabric operations. 1121type OperationListResult struct { 1122 autorest.Response `json:"-"` 1123 // Value - List of Service Fabric operations supported by the Microsoft.ServiceFabric resource provider. 1124 Value *[]OperationResult `json:"value,omitempty"` 1125 // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. 1126 NextLink *string `json:"nextLink,omitempty"` 1127} 1128 1129// MarshalJSON is the custom marshaler for OperationListResult. 1130func (olr OperationListResult) MarshalJSON() ([]byte, error) { 1131 objectMap := make(map[string]interface{}) 1132 if olr.Value != nil { 1133 objectMap["value"] = olr.Value 1134 } 1135 return json.Marshal(objectMap) 1136} 1137 1138// OperationListResultIterator provides access to a complete listing of OperationResult values. 1139type OperationListResultIterator struct { 1140 i int 1141 page OperationListResultPage 1142} 1143 1144// NextWithContext advances to the next value. If there was an error making 1145// the request the iterator does not advance and the error is returned. 1146func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1147 if tracing.IsEnabled() { 1148 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1149 defer func() { 1150 sc := -1 1151 if iter.Response().Response.Response != nil { 1152 sc = iter.Response().Response.Response.StatusCode 1153 } 1154 tracing.EndSpan(ctx, sc, err) 1155 }() 1156 } 1157 iter.i++ 1158 if iter.i < len(iter.page.Values()) { 1159 return nil 1160 } 1161 err = iter.page.NextWithContext(ctx) 1162 if err != nil { 1163 iter.i-- 1164 return err 1165 } 1166 iter.i = 0 1167 return nil 1168} 1169 1170// Next advances to the next value. If there was an error making 1171// the request the iterator does not advance and the error is returned. 1172// Deprecated: Use NextWithContext() instead. 1173func (iter *OperationListResultIterator) Next() error { 1174 return iter.NextWithContext(context.Background()) 1175} 1176 1177// NotDone returns true if the enumeration should be started or is not yet complete. 1178func (iter OperationListResultIterator) NotDone() bool { 1179 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1180} 1181 1182// Response returns the raw server response from the last page request. 1183func (iter OperationListResultIterator) Response() OperationListResult { 1184 return iter.page.Response() 1185} 1186 1187// Value returns the current value or a zero-initialized value if the 1188// iterator has advanced beyond the end of the collection. 1189func (iter OperationListResultIterator) Value() OperationResult { 1190 if !iter.page.NotDone() { 1191 return OperationResult{} 1192 } 1193 return iter.page.Values()[iter.i] 1194} 1195 1196// Creates a new instance of the OperationListResultIterator type. 1197func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1198 return OperationListResultIterator{page: page} 1199} 1200 1201// IsEmpty returns true if the ListResult contains no values. 1202func (olr OperationListResult) IsEmpty() bool { 1203 return olr.Value == nil || len(*olr.Value) == 0 1204} 1205 1206// hasNextLink returns true if the NextLink is not empty. 1207func (olr OperationListResult) hasNextLink() bool { 1208 return olr.NextLink != nil && len(*olr.NextLink) != 0 1209} 1210 1211// operationListResultPreparer prepares a request to retrieve the next set of results. 1212// It returns nil if no more results exist. 1213func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1214 if !olr.hasNextLink() { 1215 return nil, nil 1216 } 1217 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1218 autorest.AsJSON(), 1219 autorest.AsGet(), 1220 autorest.WithBaseURL(to.String(olr.NextLink))) 1221} 1222 1223// OperationListResultPage contains a page of OperationResult values. 1224type OperationListResultPage struct { 1225 fn func(context.Context, OperationListResult) (OperationListResult, error) 1226 olr OperationListResult 1227} 1228 1229// NextWithContext advances to the next page of values. If there was an error making 1230// the request the page does not advance and the error is returned. 1231func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1232 if tracing.IsEnabled() { 1233 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1234 defer func() { 1235 sc := -1 1236 if page.Response().Response.Response != nil { 1237 sc = page.Response().Response.Response.StatusCode 1238 } 1239 tracing.EndSpan(ctx, sc, err) 1240 }() 1241 } 1242 for { 1243 next, err := page.fn(ctx, page.olr) 1244 if err != nil { 1245 return err 1246 } 1247 page.olr = next 1248 if !next.hasNextLink() || !next.IsEmpty() { 1249 break 1250 } 1251 } 1252 return nil 1253} 1254 1255// Next advances to the next page of values. If there was an error making 1256// the request the page does not advance and the error is returned. 1257// Deprecated: Use NextWithContext() instead. 1258func (page *OperationListResultPage) Next() error { 1259 return page.NextWithContext(context.Background()) 1260} 1261 1262// NotDone returns true if the page enumeration should be started or is not yet complete. 1263func (page OperationListResultPage) NotDone() bool { 1264 return !page.olr.IsEmpty() 1265} 1266 1267// Response returns the raw server response from the last page request. 1268func (page OperationListResultPage) Response() OperationListResult { 1269 return page.olr 1270} 1271 1272// Values returns the slice of values for the current page or nil if there are no values. 1273func (page OperationListResultPage) Values() []OperationResult { 1274 if page.olr.IsEmpty() { 1275 return nil 1276 } 1277 return *page.olr.Value 1278} 1279 1280// Creates a new instance of the OperationListResultPage type. 1281func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1282 return OperationListResultPage{ 1283 fn: getNextPage, 1284 olr: cur, 1285 } 1286} 1287 1288// OperationResult list of operations available at the listed Azure resource provider. 1289type OperationResult struct { 1290 // Name - The name of the operation. 1291 Name *string `json:"name,omitempty"` 1292 // Display - The object that represents the operation. 1293 Display *AvailableOperationDisplay `json:"display,omitempty"` 1294 // Origin - Origin result 1295 Origin *string `json:"origin,omitempty"` 1296 // NextLink - The URL to use for getting the next set of results. 1297 NextLink *string `json:"nextLink,omitempty"` 1298} 1299 1300// ProvisionedResourceProperties describes common properties of a provisioned resource. 1301type ProvisionedResourceProperties struct { 1302 // ProvisioningState - READ-ONLY; State of the resource. 1303 ProvisioningState *string `json:"provisioningState,omitempty"` 1304} 1305 1306// MarshalJSON is the custom marshaler for ProvisionedResourceProperties. 1307func (prp ProvisionedResourceProperties) MarshalJSON() ([]byte, error) { 1308 objectMap := make(map[string]interface{}) 1309 return json.Marshal(objectMap) 1310} 1311 1312// ProxyResource the resource model definition for Azure Resource Manager proxy resource. It will have 1313// everything other than required location and tags. 1314type ProxyResource struct { 1315 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1316 ID *string `json:"id,omitempty"` 1317 // Name - READ-ONLY; The name of the resource 1318 Name *string `json:"name,omitempty"` 1319 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1320 Type *string `json:"type,omitempty"` 1321 // Location - The geo-location where the resource lives 1322 Location *string `json:"location,omitempty"` 1323} 1324 1325// MarshalJSON is the custom marshaler for ProxyResource. 1326func (pr ProxyResource) MarshalJSON() ([]byte, error) { 1327 objectMap := make(map[string]interface{}) 1328 if pr.Location != nil { 1329 objectMap["location"] = pr.Location 1330 } 1331 return json.Marshal(objectMap) 1332} 1333 1334// Resource the resource model definition for Azure Resource Manager resource. 1335type Resource struct { 1336 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1337 ID *string `json:"id,omitempty"` 1338 // Name - READ-ONLY; The name of the resource 1339 Name *string `json:"name,omitempty"` 1340 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1341 Type *string `json:"type,omitempty"` 1342 // Location - The geo-location where the resource lives 1343 Location *string `json:"location,omitempty"` 1344} 1345 1346// MarshalJSON is the custom marshaler for Resource. 1347func (r Resource) MarshalJSON() ([]byte, error) { 1348 objectMap := make(map[string]interface{}) 1349 if r.Location != nil { 1350 objectMap["location"] = r.Location 1351 } 1352 return json.Marshal(objectMap) 1353} 1354 1355// ResourceLimits this type describes the resource limits for a given container. It describes the most 1356// amount of resources a container is allowed to use before being restarted. 1357type ResourceLimits struct { 1358 // MemoryInGB - The memory limit in GB. 1359 MemoryInGB *float64 `json:"memoryInGB,omitempty"` 1360 // CPU - CPU limits in cores. At present, only full cores are supported. 1361 CPU *float64 `json:"cpu,omitempty"` 1362} 1363 1364// ResourceRequests this type describes the requested resources for a given container. It describes the 1365// least amount of resources required for the container. A container can consume more than requested 1366// resources up to the specified limits before being restarted. Currently, the requested resources are 1367// treated as limits. 1368type ResourceRequests struct { 1369 // MemoryInGB - The memory request in GB for this container. 1370 MemoryInGB *float64 `json:"memoryInGB,omitempty"` 1371 // CPU - Requested number of CPU cores. At present, only full cores are supported. 1372 CPU *float64 `json:"cpu,omitempty"` 1373} 1374 1375// ResourceRequirements this type describes the resource requirements for a container or a service. 1376type ResourceRequirements struct { 1377 // Requests - Describes the requested resources for a given container. 1378 Requests *ResourceRequests `json:"requests,omitempty"` 1379 // Limits - Describes the maximum limits on the resources for a given container. 1380 Limits *ResourceLimits `json:"limits,omitempty"` 1381} 1382 1383// ServiceList a pageable list of all services in an application. 1384type ServiceList struct { 1385 autorest.Response `json:"-"` 1386 // Value - One page of the list. 1387 Value *[]ServiceResourceDescription `json:"value,omitempty"` 1388 // NextLink - URI to fetch the next page of the list. 1389 NextLink *string `json:"nextLink,omitempty"` 1390} 1391 1392// ServiceListIterator provides access to a complete listing of ServiceResourceDescription values. 1393type ServiceListIterator struct { 1394 i int 1395 page ServiceListPage 1396} 1397 1398// NextWithContext advances to the next value. If there was an error making 1399// the request the iterator does not advance and the error is returned. 1400func (iter *ServiceListIterator) NextWithContext(ctx context.Context) (err error) { 1401 if tracing.IsEnabled() { 1402 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListIterator.NextWithContext") 1403 defer func() { 1404 sc := -1 1405 if iter.Response().Response.Response != nil { 1406 sc = iter.Response().Response.Response.StatusCode 1407 } 1408 tracing.EndSpan(ctx, sc, err) 1409 }() 1410 } 1411 iter.i++ 1412 if iter.i < len(iter.page.Values()) { 1413 return nil 1414 } 1415 err = iter.page.NextWithContext(ctx) 1416 if err != nil { 1417 iter.i-- 1418 return err 1419 } 1420 iter.i = 0 1421 return nil 1422} 1423 1424// Next advances to the next value. If there was an error making 1425// the request the iterator does not advance and the error is returned. 1426// Deprecated: Use NextWithContext() instead. 1427func (iter *ServiceListIterator) Next() error { 1428 return iter.NextWithContext(context.Background()) 1429} 1430 1431// NotDone returns true if the enumeration should be started or is not yet complete. 1432func (iter ServiceListIterator) NotDone() bool { 1433 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1434} 1435 1436// Response returns the raw server response from the last page request. 1437func (iter ServiceListIterator) Response() ServiceList { 1438 return iter.page.Response() 1439} 1440 1441// Value returns the current value or a zero-initialized value if the 1442// iterator has advanced beyond the end of the collection. 1443func (iter ServiceListIterator) Value() ServiceResourceDescription { 1444 if !iter.page.NotDone() { 1445 return ServiceResourceDescription{} 1446 } 1447 return iter.page.Values()[iter.i] 1448} 1449 1450// Creates a new instance of the ServiceListIterator type. 1451func NewServiceListIterator(page ServiceListPage) ServiceListIterator { 1452 return ServiceListIterator{page: page} 1453} 1454 1455// IsEmpty returns true if the ListResult contains no values. 1456func (sl ServiceList) IsEmpty() bool { 1457 return sl.Value == nil || len(*sl.Value) == 0 1458} 1459 1460// hasNextLink returns true if the NextLink is not empty. 1461func (sl ServiceList) hasNextLink() bool { 1462 return sl.NextLink != nil && len(*sl.NextLink) != 0 1463} 1464 1465// serviceListPreparer prepares a request to retrieve the next set of results. 1466// It returns nil if no more results exist. 1467func (sl ServiceList) serviceListPreparer(ctx context.Context) (*http.Request, error) { 1468 if !sl.hasNextLink() { 1469 return nil, nil 1470 } 1471 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1472 autorest.AsJSON(), 1473 autorest.AsGet(), 1474 autorest.WithBaseURL(to.String(sl.NextLink))) 1475} 1476 1477// ServiceListPage contains a page of ServiceResourceDescription values. 1478type ServiceListPage struct { 1479 fn func(context.Context, ServiceList) (ServiceList, error) 1480 sl ServiceList 1481} 1482 1483// NextWithContext advances to the next page of values. If there was an error making 1484// the request the page does not advance and the error is returned. 1485func (page *ServiceListPage) NextWithContext(ctx context.Context) (err error) { 1486 if tracing.IsEnabled() { 1487 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListPage.NextWithContext") 1488 defer func() { 1489 sc := -1 1490 if page.Response().Response.Response != nil { 1491 sc = page.Response().Response.Response.StatusCode 1492 } 1493 tracing.EndSpan(ctx, sc, err) 1494 }() 1495 } 1496 for { 1497 next, err := page.fn(ctx, page.sl) 1498 if err != nil { 1499 return err 1500 } 1501 page.sl = next 1502 if !next.hasNextLink() || !next.IsEmpty() { 1503 break 1504 } 1505 } 1506 return nil 1507} 1508 1509// Next advances to the next page of values. If there was an error making 1510// the request the page does not advance and the error is returned. 1511// Deprecated: Use NextWithContext() instead. 1512func (page *ServiceListPage) Next() error { 1513 return page.NextWithContext(context.Background()) 1514} 1515 1516// NotDone returns true if the page enumeration should be started or is not yet complete. 1517func (page ServiceListPage) NotDone() bool { 1518 return !page.sl.IsEmpty() 1519} 1520 1521// Response returns the raw server response from the last page request. 1522func (page ServiceListPage) Response() ServiceList { 1523 return page.sl 1524} 1525 1526// Values returns the slice of values for the current page or nil if there are no values. 1527func (page ServiceListPage) Values() []ServiceResourceDescription { 1528 if page.sl.IsEmpty() { 1529 return nil 1530 } 1531 return *page.sl.Value 1532} 1533 1534// Creates a new instance of the ServiceListPage type. 1535func NewServiceListPage(cur ServiceList, getNextPage func(context.Context, ServiceList) (ServiceList, error)) ServiceListPage { 1536 return ServiceListPage{ 1537 fn: getNextPage, 1538 sl: cur, 1539 } 1540} 1541 1542// ServiceReplicaDescription this type describes a replica of a service resource. 1543type ServiceReplicaDescription struct { 1544 autorest.Response `json:"-"` 1545 // ReplicaName - Name of the replica. 1546 ReplicaName *string `json:"replicaName,omitempty"` 1547 // OsType - The Operating system type required by the code in service. 1548 // . Possible values include: 'Linux', 'Windows' 1549 OsType OperatingSystemTypes `json:"osType,omitempty"` 1550 // 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.). 1551 CodePackages *[]ContainerCodePackageProperties `json:"codePackages,omitempty"` 1552 // NetworkRefs - The names of the private networks that this service needs to be part of. 1553 NetworkRefs *[]NetworkRef `json:"networkRefs,omitempty"` 1554 // Diagnostics - Reference to sinks in DiagnosticsDescription. 1555 Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` 1556} 1557 1558// ServiceReplicaList a pageable list of replicas of a service resource. 1559type ServiceReplicaList struct { 1560 autorest.Response `json:"-"` 1561 // Value - One page of the list. 1562 Value *[]ServiceReplicaDescription `json:"value,omitempty"` 1563 // NextLink - URI to fetch the next page of the list. 1564 NextLink *string `json:"nextLink,omitempty"` 1565} 1566 1567// ServiceReplicaListIterator provides access to a complete listing of ServiceReplicaDescription values. 1568type ServiceReplicaListIterator struct { 1569 i int 1570 page ServiceReplicaListPage 1571} 1572 1573// NextWithContext advances to the next value. If there was an error making 1574// the request the iterator does not advance and the error is returned. 1575func (iter *ServiceReplicaListIterator) NextWithContext(ctx context.Context) (err error) { 1576 if tracing.IsEnabled() { 1577 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceReplicaListIterator.NextWithContext") 1578 defer func() { 1579 sc := -1 1580 if iter.Response().Response.Response != nil { 1581 sc = iter.Response().Response.Response.StatusCode 1582 } 1583 tracing.EndSpan(ctx, sc, err) 1584 }() 1585 } 1586 iter.i++ 1587 if iter.i < len(iter.page.Values()) { 1588 return nil 1589 } 1590 err = iter.page.NextWithContext(ctx) 1591 if err != nil { 1592 iter.i-- 1593 return err 1594 } 1595 iter.i = 0 1596 return nil 1597} 1598 1599// Next advances to the next value. If there was an error making 1600// the request the iterator does not advance and the error is returned. 1601// Deprecated: Use NextWithContext() instead. 1602func (iter *ServiceReplicaListIterator) Next() error { 1603 return iter.NextWithContext(context.Background()) 1604} 1605 1606// NotDone returns true if the enumeration should be started or is not yet complete. 1607func (iter ServiceReplicaListIterator) NotDone() bool { 1608 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1609} 1610 1611// Response returns the raw server response from the last page request. 1612func (iter ServiceReplicaListIterator) Response() ServiceReplicaList { 1613 return iter.page.Response() 1614} 1615 1616// Value returns the current value or a zero-initialized value if the 1617// iterator has advanced beyond the end of the collection. 1618func (iter ServiceReplicaListIterator) Value() ServiceReplicaDescription { 1619 if !iter.page.NotDone() { 1620 return ServiceReplicaDescription{} 1621 } 1622 return iter.page.Values()[iter.i] 1623} 1624 1625// Creates a new instance of the ServiceReplicaListIterator type. 1626func NewServiceReplicaListIterator(page ServiceReplicaListPage) ServiceReplicaListIterator { 1627 return ServiceReplicaListIterator{page: page} 1628} 1629 1630// IsEmpty returns true if the ListResult contains no values. 1631func (srl ServiceReplicaList) IsEmpty() bool { 1632 return srl.Value == nil || len(*srl.Value) == 0 1633} 1634 1635// hasNextLink returns true if the NextLink is not empty. 1636func (srl ServiceReplicaList) hasNextLink() bool { 1637 return srl.NextLink != nil && len(*srl.NextLink) != 0 1638} 1639 1640// serviceReplicaListPreparer prepares a request to retrieve the next set of results. 1641// It returns nil if no more results exist. 1642func (srl ServiceReplicaList) serviceReplicaListPreparer(ctx context.Context) (*http.Request, error) { 1643 if !srl.hasNextLink() { 1644 return nil, nil 1645 } 1646 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1647 autorest.AsJSON(), 1648 autorest.AsGet(), 1649 autorest.WithBaseURL(to.String(srl.NextLink))) 1650} 1651 1652// ServiceReplicaListPage contains a page of ServiceReplicaDescription values. 1653type ServiceReplicaListPage struct { 1654 fn func(context.Context, ServiceReplicaList) (ServiceReplicaList, error) 1655 srl ServiceReplicaList 1656} 1657 1658// NextWithContext advances to the next page of values. If there was an error making 1659// the request the page does not advance and the error is returned. 1660func (page *ServiceReplicaListPage) NextWithContext(ctx context.Context) (err error) { 1661 if tracing.IsEnabled() { 1662 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceReplicaListPage.NextWithContext") 1663 defer func() { 1664 sc := -1 1665 if page.Response().Response.Response != nil { 1666 sc = page.Response().Response.Response.StatusCode 1667 } 1668 tracing.EndSpan(ctx, sc, err) 1669 }() 1670 } 1671 for { 1672 next, err := page.fn(ctx, page.srl) 1673 if err != nil { 1674 return err 1675 } 1676 page.srl = next 1677 if !next.hasNextLink() || !next.IsEmpty() { 1678 break 1679 } 1680 } 1681 return nil 1682} 1683 1684// Next advances to the next page of values. If there was an error making 1685// the request the page does not advance and the error is returned. 1686// Deprecated: Use NextWithContext() instead. 1687func (page *ServiceReplicaListPage) Next() error { 1688 return page.NextWithContext(context.Background()) 1689} 1690 1691// NotDone returns true if the page enumeration should be started or is not yet complete. 1692func (page ServiceReplicaListPage) NotDone() bool { 1693 return !page.srl.IsEmpty() 1694} 1695 1696// Response returns the raw server response from the last page request. 1697func (page ServiceReplicaListPage) Response() ServiceReplicaList { 1698 return page.srl 1699} 1700 1701// Values returns the slice of values for the current page or nil if there are no values. 1702func (page ServiceReplicaListPage) Values() []ServiceReplicaDescription { 1703 if page.srl.IsEmpty() { 1704 return nil 1705 } 1706 return *page.srl.Value 1707} 1708 1709// Creates a new instance of the ServiceReplicaListPage type. 1710func NewServiceReplicaListPage(cur ServiceReplicaList, getNextPage func(context.Context, ServiceReplicaList) (ServiceReplicaList, error)) ServiceReplicaListPage { 1711 return ServiceReplicaListPage{ 1712 fn: getNextPage, 1713 srl: cur, 1714 } 1715} 1716 1717// ServiceReplicaProperties describes the properties of a service replica. 1718type ServiceReplicaProperties struct { 1719 // OsType - The Operating system type required by the code in service. 1720 // . Possible values include: 'Linux', 'Windows' 1721 OsType OperatingSystemTypes `json:"osType,omitempty"` 1722 // 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.). 1723 CodePackages *[]ContainerCodePackageProperties `json:"codePackages,omitempty"` 1724 // NetworkRefs - The names of the private networks that this service needs to be part of. 1725 NetworkRefs *[]NetworkRef `json:"networkRefs,omitempty"` 1726 // Diagnostics - Reference to sinks in DiagnosticsDescription. 1727 Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` 1728} 1729 1730// ServiceResourceDescription this type describes a service resource. 1731type ServiceResourceDescription struct { 1732 autorest.Response `json:"-"` 1733 // ServiceResourceProperties - This type describes properties of a service resource. 1734 *ServiceResourceProperties `json:"properties,omitempty"` 1735 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1736 ID *string `json:"id,omitempty"` 1737 // Name - The name of the resource 1738 Name *string `json:"name,omitempty"` 1739 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1740 Type *string `json:"type,omitempty"` 1741} 1742 1743// MarshalJSON is the custom marshaler for ServiceResourceDescription. 1744func (srd ServiceResourceDescription) MarshalJSON() ([]byte, error) { 1745 objectMap := make(map[string]interface{}) 1746 if srd.ServiceResourceProperties != nil { 1747 objectMap["properties"] = srd.ServiceResourceProperties 1748 } 1749 if srd.Name != nil { 1750 objectMap["name"] = srd.Name 1751 } 1752 return json.Marshal(objectMap) 1753} 1754 1755// UnmarshalJSON is the custom unmarshaler for ServiceResourceDescription struct. 1756func (srd *ServiceResourceDescription) UnmarshalJSON(body []byte) error { 1757 var m map[string]*json.RawMessage 1758 err := json.Unmarshal(body, &m) 1759 if err != nil { 1760 return err 1761 } 1762 for k, v := range m { 1763 switch k { 1764 case "properties": 1765 if v != nil { 1766 var serviceResourceProperties ServiceResourceProperties 1767 err = json.Unmarshal(*v, &serviceResourceProperties) 1768 if err != nil { 1769 return err 1770 } 1771 srd.ServiceResourceProperties = &serviceResourceProperties 1772 } 1773 case "id": 1774 if v != nil { 1775 var ID string 1776 err = json.Unmarshal(*v, &ID) 1777 if err != nil { 1778 return err 1779 } 1780 srd.ID = &ID 1781 } 1782 case "name": 1783 if v != nil { 1784 var name string 1785 err = json.Unmarshal(*v, &name) 1786 if err != nil { 1787 return err 1788 } 1789 srd.Name = &name 1790 } 1791 case "type": 1792 if v != nil { 1793 var typeVar string 1794 err = json.Unmarshal(*v, &typeVar) 1795 if err != nil { 1796 return err 1797 } 1798 srd.Type = &typeVar 1799 } 1800 } 1801 } 1802 1803 return nil 1804} 1805 1806// ServiceResourceProperties this type describes properties of a service resource. 1807type ServiceResourceProperties struct { 1808 // Description - User readable description of the service. 1809 Description *string `json:"description,omitempty"` 1810 // ReplicaCount - The number of replicas of the service to create. Defaults to 1 if not specified. 1811 ReplicaCount *int32 `json:"replicaCount,omitempty"` 1812 // HealthState - The health state of a resource such as Application, Service, or Network. Possible values include: 'HealthStateInvalid', 'HealthStateOk', 'HealthStateWarning', 'HealthStateError', 'HealthStateUnknown' 1813 HealthState HealthState `json:"healthState,omitempty"` 1814 // Status - READ-ONLY; Represents the status of the service. Possible values include: 'ServiceResourceStatusUnknown', 'ServiceResourceStatusActive', 'ServiceResourceStatusUpgrading', 'ServiceResourceStatusDeleting', 'ServiceResourceStatusCreating', 'ServiceResourceStatusFailed' 1815 Status ServiceResourceStatus `json:"status,omitempty"` 1816 // OsType - The Operating system type required by the code in service. 1817 // . Possible values include: 'Linux', 'Windows' 1818 OsType OperatingSystemTypes `json:"osType,omitempty"` 1819 // 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.). 1820 CodePackages *[]ContainerCodePackageProperties `json:"codePackages,omitempty"` 1821 // NetworkRefs - The names of the private networks that this service needs to be part of. 1822 NetworkRefs *[]NetworkRef `json:"networkRefs,omitempty"` 1823 // Diagnostics - Reference to sinks in DiagnosticsDescription. 1824 Diagnostics *DiagnosticsRef `json:"diagnostics,omitempty"` 1825} 1826 1827// MarshalJSON is the custom marshaler for ServiceResourceProperties. 1828func (srp ServiceResourceProperties) MarshalJSON() ([]byte, error) { 1829 objectMap := make(map[string]interface{}) 1830 if srp.Description != nil { 1831 objectMap["description"] = srp.Description 1832 } 1833 if srp.ReplicaCount != nil { 1834 objectMap["replicaCount"] = srp.ReplicaCount 1835 } 1836 if srp.HealthState != "" { 1837 objectMap["healthState"] = srp.HealthState 1838 } 1839 if srp.OsType != "" { 1840 objectMap["osType"] = srp.OsType 1841 } 1842 if srp.CodePackages != nil { 1843 objectMap["codePackages"] = srp.CodePackages 1844 } 1845 if srp.NetworkRefs != nil { 1846 objectMap["networkRefs"] = srp.NetworkRefs 1847 } 1848 if srp.Diagnostics != nil { 1849 objectMap["diagnostics"] = srp.Diagnostics 1850 } 1851 return json.Marshal(objectMap) 1852} 1853 1854// Setting describes a setting for the container. 1855type Setting struct { 1856 // Name - The name of the setting. 1857 Name *string `json:"name,omitempty"` 1858 // Value - The value of the setting. 1859 Value *string `json:"value,omitempty"` 1860} 1861 1862// TrackedResource the resource model definition for Azure Resource Manager tracked top-level resource. 1863type TrackedResource struct { 1864 // Tags - Resource tags. 1865 Tags map[string]*string `json:"tags"` 1866 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1867 ID *string `json:"id,omitempty"` 1868 // Name - READ-ONLY; The name of the resource 1869 Name *string `json:"name,omitempty"` 1870 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1871 Type *string `json:"type,omitempty"` 1872 // Location - The geo-location where the resource lives 1873 Location *string `json:"location,omitempty"` 1874} 1875 1876// MarshalJSON is the custom marshaler for TrackedResource. 1877func (tr TrackedResource) MarshalJSON() ([]byte, error) { 1878 objectMap := make(map[string]interface{}) 1879 if tr.Tags != nil { 1880 objectMap["tags"] = tr.Tags 1881 } 1882 if tr.Location != nil { 1883 objectMap["location"] = tr.Location 1884 } 1885 return json.Marshal(objectMap) 1886} 1887 1888// VolumeProperties this type describes properties of a volume resource. 1889type VolumeProperties struct { 1890 // Description - User readable description of the volume. 1891 Description *string `json:"description,omitempty"` 1892 // Provider - Provider of the volume. 1893 Provider *string `json:"provider,omitempty"` 1894 // AzureFileParameters - This type describes a volume provided by an Azure Files file share. 1895 AzureFileParameters *VolumeProviderParametersAzureFile `json:"azureFileParameters,omitempty"` 1896} 1897 1898// VolumeProviderParametersAzureFile this type describes a volume provided by an Azure Files file share. 1899type VolumeProviderParametersAzureFile struct { 1900 // AccountName - Name of the Azure storage account for the File Share. 1901 AccountName *string `json:"accountName,omitempty"` 1902 // AccountKey - Access key of the Azure storage account for the File Share. 1903 AccountKey *string `json:"accountKey,omitempty"` 1904 // ShareName - Name of the Azure Files file share that provides storage for the volume. 1905 ShareName *string `json:"shareName,omitempty"` 1906} 1907 1908// VolumeResourceDescription this type describes a volume resource. 1909type VolumeResourceDescription struct { 1910 autorest.Response `json:"-"` 1911 // VolumeResourceProperties - Describes properties of a volume resource. 1912 *VolumeResourceProperties `json:"properties,omitempty"` 1913 // Tags - Resource tags. 1914 Tags map[string]*string `json:"tags"` 1915 // ID - READ-ONLY; Fully qualified identifier for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1916 ID *string `json:"id,omitempty"` 1917 // Name - READ-ONLY; The name of the resource 1918 Name *string `json:"name,omitempty"` 1919 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1920 Type *string `json:"type,omitempty"` 1921 // Location - The geo-location where the resource lives 1922 Location *string `json:"location,omitempty"` 1923} 1924 1925// MarshalJSON is the custom marshaler for VolumeResourceDescription. 1926func (vrd VolumeResourceDescription) MarshalJSON() ([]byte, error) { 1927 objectMap := make(map[string]interface{}) 1928 if vrd.VolumeResourceProperties != nil { 1929 objectMap["properties"] = vrd.VolumeResourceProperties 1930 } 1931 if vrd.Tags != nil { 1932 objectMap["tags"] = vrd.Tags 1933 } 1934 if vrd.Location != nil { 1935 objectMap["location"] = vrd.Location 1936 } 1937 return json.Marshal(objectMap) 1938} 1939 1940// UnmarshalJSON is the custom unmarshaler for VolumeResourceDescription struct. 1941func (vrd *VolumeResourceDescription) UnmarshalJSON(body []byte) error { 1942 var m map[string]*json.RawMessage 1943 err := json.Unmarshal(body, &m) 1944 if err != nil { 1945 return err 1946 } 1947 for k, v := range m { 1948 switch k { 1949 case "properties": 1950 if v != nil { 1951 var volumeResourceProperties VolumeResourceProperties 1952 err = json.Unmarshal(*v, &volumeResourceProperties) 1953 if err != nil { 1954 return err 1955 } 1956 vrd.VolumeResourceProperties = &volumeResourceProperties 1957 } 1958 case "tags": 1959 if v != nil { 1960 var tags map[string]*string 1961 err = json.Unmarshal(*v, &tags) 1962 if err != nil { 1963 return err 1964 } 1965 vrd.Tags = tags 1966 } 1967 case "id": 1968 if v != nil { 1969 var ID string 1970 err = json.Unmarshal(*v, &ID) 1971 if err != nil { 1972 return err 1973 } 1974 vrd.ID = &ID 1975 } 1976 case "name": 1977 if v != nil { 1978 var name string 1979 err = json.Unmarshal(*v, &name) 1980 if err != nil { 1981 return err 1982 } 1983 vrd.Name = &name 1984 } 1985 case "type": 1986 if v != nil { 1987 var typeVar string 1988 err = json.Unmarshal(*v, &typeVar) 1989 if err != nil { 1990 return err 1991 } 1992 vrd.Type = &typeVar 1993 } 1994 case "location": 1995 if v != nil { 1996 var location string 1997 err = json.Unmarshal(*v, &location) 1998 if err != nil { 1999 return err 2000 } 2001 vrd.Location = &location 2002 } 2003 } 2004 } 2005 2006 return nil 2007} 2008 2009// VolumeResourceDescriptionList a pageable list of volume resources. 2010type VolumeResourceDescriptionList struct { 2011 autorest.Response `json:"-"` 2012 // Value - One page of the list. 2013 Value *[]VolumeResourceDescription `json:"value,omitempty"` 2014 // NextLink - URI to fetch the next page of the list. 2015 NextLink *string `json:"nextLink,omitempty"` 2016} 2017 2018// VolumeResourceDescriptionListIterator provides access to a complete listing of VolumeResourceDescription 2019// values. 2020type VolumeResourceDescriptionListIterator struct { 2021 i int 2022 page VolumeResourceDescriptionListPage 2023} 2024 2025// NextWithContext advances to the next value. If there was an error making 2026// the request the iterator does not advance and the error is returned. 2027func (iter *VolumeResourceDescriptionListIterator) NextWithContext(ctx context.Context) (err error) { 2028 if tracing.IsEnabled() { 2029 ctx = tracing.StartSpan(ctx, fqdn+"/VolumeResourceDescriptionListIterator.NextWithContext") 2030 defer func() { 2031 sc := -1 2032 if iter.Response().Response.Response != nil { 2033 sc = iter.Response().Response.Response.StatusCode 2034 } 2035 tracing.EndSpan(ctx, sc, err) 2036 }() 2037 } 2038 iter.i++ 2039 if iter.i < len(iter.page.Values()) { 2040 return nil 2041 } 2042 err = iter.page.NextWithContext(ctx) 2043 if err != nil { 2044 iter.i-- 2045 return err 2046 } 2047 iter.i = 0 2048 return nil 2049} 2050 2051// Next advances to the next value. If there was an error making 2052// the request the iterator does not advance and the error is returned. 2053// Deprecated: Use NextWithContext() instead. 2054func (iter *VolumeResourceDescriptionListIterator) Next() error { 2055 return iter.NextWithContext(context.Background()) 2056} 2057 2058// NotDone returns true if the enumeration should be started or is not yet complete. 2059func (iter VolumeResourceDescriptionListIterator) NotDone() bool { 2060 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2061} 2062 2063// Response returns the raw server response from the last page request. 2064func (iter VolumeResourceDescriptionListIterator) Response() VolumeResourceDescriptionList { 2065 return iter.page.Response() 2066} 2067 2068// Value returns the current value or a zero-initialized value if the 2069// iterator has advanced beyond the end of the collection. 2070func (iter VolumeResourceDescriptionListIterator) Value() VolumeResourceDescription { 2071 if !iter.page.NotDone() { 2072 return VolumeResourceDescription{} 2073 } 2074 return iter.page.Values()[iter.i] 2075} 2076 2077// Creates a new instance of the VolumeResourceDescriptionListIterator type. 2078func NewVolumeResourceDescriptionListIterator(page VolumeResourceDescriptionListPage) VolumeResourceDescriptionListIterator { 2079 return VolumeResourceDescriptionListIterator{page: page} 2080} 2081 2082// IsEmpty returns true if the ListResult contains no values. 2083func (vrdl VolumeResourceDescriptionList) IsEmpty() bool { 2084 return vrdl.Value == nil || len(*vrdl.Value) == 0 2085} 2086 2087// hasNextLink returns true if the NextLink is not empty. 2088func (vrdl VolumeResourceDescriptionList) hasNextLink() bool { 2089 return vrdl.NextLink != nil && len(*vrdl.NextLink) != 0 2090} 2091 2092// volumeResourceDescriptionListPreparer prepares a request to retrieve the next set of results. 2093// It returns nil if no more results exist. 2094func (vrdl VolumeResourceDescriptionList) volumeResourceDescriptionListPreparer(ctx context.Context) (*http.Request, error) { 2095 if !vrdl.hasNextLink() { 2096 return nil, nil 2097 } 2098 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2099 autorest.AsJSON(), 2100 autorest.AsGet(), 2101 autorest.WithBaseURL(to.String(vrdl.NextLink))) 2102} 2103 2104// VolumeResourceDescriptionListPage contains a page of VolumeResourceDescription values. 2105type VolumeResourceDescriptionListPage struct { 2106 fn func(context.Context, VolumeResourceDescriptionList) (VolumeResourceDescriptionList, error) 2107 vrdl VolumeResourceDescriptionList 2108} 2109 2110// NextWithContext advances to the next page of values. If there was an error making 2111// the request the page does not advance and the error is returned. 2112func (page *VolumeResourceDescriptionListPage) NextWithContext(ctx context.Context) (err error) { 2113 if tracing.IsEnabled() { 2114 ctx = tracing.StartSpan(ctx, fqdn+"/VolumeResourceDescriptionListPage.NextWithContext") 2115 defer func() { 2116 sc := -1 2117 if page.Response().Response.Response != nil { 2118 sc = page.Response().Response.Response.StatusCode 2119 } 2120 tracing.EndSpan(ctx, sc, err) 2121 }() 2122 } 2123 for { 2124 next, err := page.fn(ctx, page.vrdl) 2125 if err != nil { 2126 return err 2127 } 2128 page.vrdl = next 2129 if !next.hasNextLink() || !next.IsEmpty() { 2130 break 2131 } 2132 } 2133 return nil 2134} 2135 2136// Next advances to the next page of values. If there was an error making 2137// the request the page does not advance and the error is returned. 2138// Deprecated: Use NextWithContext() instead. 2139func (page *VolumeResourceDescriptionListPage) Next() error { 2140 return page.NextWithContext(context.Background()) 2141} 2142 2143// NotDone returns true if the page enumeration should be started or is not yet complete. 2144func (page VolumeResourceDescriptionListPage) NotDone() bool { 2145 return !page.vrdl.IsEmpty() 2146} 2147 2148// Response returns the raw server response from the last page request. 2149func (page VolumeResourceDescriptionListPage) Response() VolumeResourceDescriptionList { 2150 return page.vrdl 2151} 2152 2153// Values returns the slice of values for the current page or nil if there are no values. 2154func (page VolumeResourceDescriptionListPage) Values() []VolumeResourceDescription { 2155 if page.vrdl.IsEmpty() { 2156 return nil 2157 } 2158 return *page.vrdl.Value 2159} 2160 2161// Creates a new instance of the VolumeResourceDescriptionListPage type. 2162func NewVolumeResourceDescriptionListPage(cur VolumeResourceDescriptionList, getNextPage func(context.Context, VolumeResourceDescriptionList) (VolumeResourceDescriptionList, error)) VolumeResourceDescriptionListPage { 2163 return VolumeResourceDescriptionListPage{ 2164 fn: getNextPage, 2165 vrdl: cur, 2166 } 2167} 2168 2169// VolumeResourceProperties describes properties of a volume resource. 2170type VolumeResourceProperties struct { 2171 // ProvisioningState - READ-ONLY; State of the resource. 2172 ProvisioningState *string `json:"provisioningState,omitempty"` 2173 // Description - User readable description of the volume. 2174 Description *string `json:"description,omitempty"` 2175 // Provider - Provider of the volume. 2176 Provider *string `json:"provider,omitempty"` 2177 // AzureFileParameters - This type describes a volume provided by an Azure Files file share. 2178 AzureFileParameters *VolumeProviderParametersAzureFile `json:"azureFileParameters,omitempty"` 2179} 2180 2181// MarshalJSON is the custom marshaler for VolumeResourceProperties. 2182func (vrp VolumeResourceProperties) MarshalJSON() ([]byte, error) { 2183 objectMap := make(map[string]interface{}) 2184 if vrp.Description != nil { 2185 objectMap["description"] = vrp.Description 2186 } 2187 if vrp.Provider != nil { 2188 objectMap["provider"] = vrp.Provider 2189 } 2190 if vrp.AzureFileParameters != nil { 2191 objectMap["azureFileParameters"] = vrp.AzureFileParameters 2192 } 2193 return json.Marshal(objectMap) 2194} 2195