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