1package elastic 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/azure" 14 "github.com/Azure/go-autorest/autorest/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "net/http" 18) 19 20// The package's fully qualified name. 21const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/elastic/mgmt/2020-07-01-preview/elastic" 22 23// CloudDeployment details of the user's elastic deployment associated with the monitor resource. 24type CloudDeployment struct { 25 // Name - READ-ONLY; Elastic deployment name 26 Name *string `json:"name,omitempty"` 27 // DeploymentID - READ-ONLY; Elastic deployment Id 28 DeploymentID *string `json:"deploymentId,omitempty"` 29 // AzureSubscriptionID - READ-ONLY; Associated Azure subscription Id for the elastic deployment. 30 AzureSubscriptionID *string `json:"azureSubscriptionId,omitempty"` 31 // ElasticsearchRegion - READ-ONLY; Region where Deployment at Elastic side took place. 32 ElasticsearchRegion *string `json:"elasticsearchRegion,omitempty"` 33 // ElasticsearchServiceURL - READ-ONLY; Elasticsearch ingestion endpoint of the Elastic deployment. 34 ElasticsearchServiceURL *string `json:"elasticsearchServiceUrl,omitempty"` 35 // KibanaServiceURL - READ-ONLY; Kibana endpoint of the Elastic deployment. 36 KibanaServiceURL *string `json:"kibanaServiceUrl,omitempty"` 37 // KibanaSsoURL - READ-ONLY; Kibana dashboard sso URL of the Elastic deployment. 38 KibanaSsoURL *string `json:"kibanaSsoUrl,omitempty"` 39} 40 41// MarshalJSON is the custom marshaler for CloudDeployment. 42func (cd CloudDeployment) MarshalJSON() ([]byte, error) { 43 objectMap := make(map[string]interface{}) 44 return json.Marshal(objectMap) 45} 46 47// CloudUser details of the user's elastic account. 48type CloudUser struct { 49 // EmailAddress - READ-ONLY; Email of the Elastic User Account. 50 EmailAddress *string `json:"emailAddress,omitempty"` 51 // ID - READ-ONLY; User Id of the elastic account of the User. 52 ID *string `json:"id,omitempty"` 53 // ElasticCloudSsoDefaultURL - READ-ONLY; Elastic cloud default dashboard sso URL of the Elastic user account. 54 ElasticCloudSsoDefaultURL *string `json:"elasticCloudSsoDefaultUrl,omitempty"` 55} 56 57// MarshalJSON is the custom marshaler for CloudUser. 58func (cu CloudUser) MarshalJSON() ([]byte, error) { 59 objectMap := make(map[string]interface{}) 60 return json.Marshal(objectMap) 61} 62 63// CompanyInfo company information of the user to be passed to partners. 64type CompanyInfo struct { 65 // Domain - Domain of the company 66 Domain *string `json:"domain,omitempty"` 67 // Business - Business of the company 68 Business *string `json:"business,omitempty"` 69 // EmployeesNumber - Number of employees in the company 70 EmployeesNumber *string `json:"employeesNumber,omitempty"` 71 // State - State of the company location. 72 State *string `json:"state,omitempty"` 73 // Country - Country of the company location. 74 Country *string `json:"country,omitempty"` 75} 76 77// DeploymentInfoResponse the properties of deployment in Elastic cloud corresponding to the Elastic 78// monitor resource. 79type DeploymentInfoResponse struct { 80 autorest.Response `json:"-"` 81 // Status - READ-ONLY; The Elastic deployment status. Possible values include: 'DeploymentStatusHealthy', 'DeploymentStatusUnhealthy' 82 Status DeploymentStatus `json:"status,omitempty"` 83 // Version - READ-ONLY; Version of the elasticsearch in Elastic cloud deployment. 84 Version *string `json:"version,omitempty"` 85 // MemoryCapacity - READ-ONLY; RAM capacity of the elasticsearch in Elastic cloud deployment. 86 MemoryCapacity *string `json:"memoryCapacity,omitempty"` 87 // DiskCapacity - READ-ONLY; Disk capacity of the elasticsearch in Elastic cloud deployment. 88 DiskCapacity *string `json:"diskCapacity,omitempty"` 89} 90 91// MarshalJSON is the custom marshaler for DeploymentInfoResponse. 92func (dir DeploymentInfoResponse) MarshalJSON() ([]byte, error) { 93 objectMap := make(map[string]interface{}) 94 return json.Marshal(objectMap) 95} 96 97// ErrorResponseBody error response body. 98type ErrorResponseBody struct { 99 // Code - Error code. 100 Code *string `json:"code,omitempty"` 101 // Message - Error message. 102 Message *string `json:"message,omitempty"` 103 // Target - Error target. 104 Target *string `json:"target,omitempty"` 105 // Details - Error details. 106 Details *[]ErrorResponseBody `json:"details,omitempty"` 107} 108 109// FilteringTag the definition of a filtering tag. Filtering tags are used for capturing resources and 110// include/exclude them from being monitored. 111type FilteringTag struct { 112 // Name - The name (also known as the key) of the tag. 113 Name *string `json:"name,omitempty"` 114 // Value - The value of the tag. 115 Value *string `json:"value,omitempty"` 116 // Action - Valid actions for a filtering tag. Possible values include: 'TagActionInclude', 'TagActionExclude' 117 Action TagAction `json:"action,omitempty"` 118} 119 120// IdentityProperties identity properties. 121type IdentityProperties struct { 122 // PrincipalID - READ-ONLY; The identity ID. 123 PrincipalID *string `json:"principalId,omitempty"` 124 // TenantID - READ-ONLY; The tenant ID of resource. 125 TenantID *string `json:"tenantId,omitempty"` 126 // Type - Managed identity type. Possible values include: 'ManagedIdentityTypesSystemAssigned' 127 Type ManagedIdentityTypes `json:"type,omitempty"` 128} 129 130// MarshalJSON is the custom marshaler for IdentityProperties. 131func (IP IdentityProperties) MarshalJSON() ([]byte, error) { 132 objectMap := make(map[string]interface{}) 133 if IP.Type != "" { 134 objectMap["type"] = IP.Type 135 } 136 return json.Marshal(objectMap) 137} 138 139// LogRules set of rules for sending logs for the Monitor resource. 140type LogRules struct { 141 // SendAadLogs - Flag specifying if AAD logs should be sent for the Monitor resource. 142 SendAadLogs *bool `json:"sendAadLogs,omitempty"` 143 // SendSubscriptionLogs - Flag specifying if subscription logs should be sent for the Monitor resource. 144 SendSubscriptionLogs *bool `json:"sendSubscriptionLogs,omitempty"` 145 // SendActivityLogs - Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. 146 SendActivityLogs *bool `json:"sendActivityLogs,omitempty"` 147 // FilteringTags - List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. 148 FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` 149} 150 151// MonitoredResource the properties of a resource currently being monitored by the Elastic monitor 152// resource. 153type MonitoredResource struct { 154 // ID - The ARM id of the resource. 155 ID *string `json:"id,omitempty"` 156 // SendingLogs - Flag indicating the status of the resource for sending logs operation to Elastic. Possible values include: 'SendingLogsTrue', 'SendingLogsFalse' 157 SendingLogs SendingLogs `json:"sendingLogs,omitempty"` 158 // ReasonForLogsStatus - Reason for why the resource is sending logs (or why it is not sending). 159 ReasonForLogsStatus *string `json:"reasonForLogsStatus,omitempty"` 160} 161 162// MonitoredResourceListResponse response of a list operation. 163type MonitoredResourceListResponse struct { 164 autorest.Response `json:"-"` 165 // Value - Results of a list operation. 166 Value *[]MonitoredResource `json:"value,omitempty"` 167 // NextLink - Link to the next set of results, if any. 168 NextLink *string `json:"nextLink,omitempty"` 169} 170 171// MonitoredResourceListResponseIterator provides access to a complete listing of MonitoredResource values. 172type MonitoredResourceListResponseIterator struct { 173 i int 174 page MonitoredResourceListResponsePage 175} 176 177// NextWithContext advances to the next value. If there was an error making 178// the request the iterator does not advance and the error is returned. 179func (iter *MonitoredResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { 180 if tracing.IsEnabled() { 181 ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourceListResponseIterator.NextWithContext") 182 defer func() { 183 sc := -1 184 if iter.Response().Response.Response != nil { 185 sc = iter.Response().Response.Response.StatusCode 186 } 187 tracing.EndSpan(ctx, sc, err) 188 }() 189 } 190 iter.i++ 191 if iter.i < len(iter.page.Values()) { 192 return nil 193 } 194 err = iter.page.NextWithContext(ctx) 195 if err != nil { 196 iter.i-- 197 return err 198 } 199 iter.i = 0 200 return nil 201} 202 203// Next advances to the next value. If there was an error making 204// the request the iterator does not advance and the error is returned. 205// Deprecated: Use NextWithContext() instead. 206func (iter *MonitoredResourceListResponseIterator) Next() error { 207 return iter.NextWithContext(context.Background()) 208} 209 210// NotDone returns true if the enumeration should be started or is not yet complete. 211func (iter MonitoredResourceListResponseIterator) NotDone() bool { 212 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 213} 214 215// Response returns the raw server response from the last page request. 216func (iter MonitoredResourceListResponseIterator) Response() MonitoredResourceListResponse { 217 return iter.page.Response() 218} 219 220// Value returns the current value or a zero-initialized value if the 221// iterator has advanced beyond the end of the collection. 222func (iter MonitoredResourceListResponseIterator) Value() MonitoredResource { 223 if !iter.page.NotDone() { 224 return MonitoredResource{} 225 } 226 return iter.page.Values()[iter.i] 227} 228 229// Creates a new instance of the MonitoredResourceListResponseIterator type. 230func NewMonitoredResourceListResponseIterator(page MonitoredResourceListResponsePage) MonitoredResourceListResponseIterator { 231 return MonitoredResourceListResponseIterator{page: page} 232} 233 234// IsEmpty returns true if the ListResult contains no values. 235func (mrlr MonitoredResourceListResponse) IsEmpty() bool { 236 return mrlr.Value == nil || len(*mrlr.Value) == 0 237} 238 239// hasNextLink returns true if the NextLink is not empty. 240func (mrlr MonitoredResourceListResponse) hasNextLink() bool { 241 return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 242} 243 244// monitoredResourceListResponsePreparer prepares a request to retrieve the next set of results. 245// It returns nil if no more results exist. 246func (mrlr MonitoredResourceListResponse) monitoredResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { 247 if !mrlr.hasNextLink() { 248 return nil, nil 249 } 250 return autorest.Prepare((&http.Request{}).WithContext(ctx), 251 autorest.AsJSON(), 252 autorest.AsGet(), 253 autorest.WithBaseURL(to.String(mrlr.NextLink))) 254} 255 256// MonitoredResourceListResponsePage contains a page of MonitoredResource values. 257type MonitoredResourceListResponsePage struct { 258 fn func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error) 259 mrlr MonitoredResourceListResponse 260} 261 262// NextWithContext advances to the next page of values. If there was an error making 263// the request the page does not advance and the error is returned. 264func (page *MonitoredResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { 265 if tracing.IsEnabled() { 266 ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourceListResponsePage.NextWithContext") 267 defer func() { 268 sc := -1 269 if page.Response().Response.Response != nil { 270 sc = page.Response().Response.Response.StatusCode 271 } 272 tracing.EndSpan(ctx, sc, err) 273 }() 274 } 275 for { 276 next, err := page.fn(ctx, page.mrlr) 277 if err != nil { 278 return err 279 } 280 page.mrlr = next 281 if !next.hasNextLink() || !next.IsEmpty() { 282 break 283 } 284 } 285 return nil 286} 287 288// Next advances to the next page of values. If there was an error making 289// the request the page does not advance and the error is returned. 290// Deprecated: Use NextWithContext() instead. 291func (page *MonitoredResourceListResponsePage) Next() error { 292 return page.NextWithContext(context.Background()) 293} 294 295// NotDone returns true if the page enumeration should be started or is not yet complete. 296func (page MonitoredResourceListResponsePage) NotDone() bool { 297 return !page.mrlr.IsEmpty() 298} 299 300// Response returns the raw server response from the last page request. 301func (page MonitoredResourceListResponsePage) Response() MonitoredResourceListResponse { 302 return page.mrlr 303} 304 305// Values returns the slice of values for the current page or nil if there are no values. 306func (page MonitoredResourceListResponsePage) Values() []MonitoredResource { 307 if page.mrlr.IsEmpty() { 308 return nil 309 } 310 return *page.mrlr.Value 311} 312 313// Creates a new instance of the MonitoredResourceListResponsePage type. 314func NewMonitoredResourceListResponsePage(cur MonitoredResourceListResponse, getNextPage func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error)) MonitoredResourceListResponsePage { 315 return MonitoredResourceListResponsePage{ 316 fn: getNextPage, 317 mrlr: cur, 318 } 319} 320 321// MonitoringTagRules capture logs and metrics of Azure resources based on ARM tags. 322type MonitoringTagRules struct { 323 autorest.Response `json:"-"` 324 // Name - READ-ONLY; Name of the rule set. 325 Name *string `json:"name,omitempty"` 326 // ID - READ-ONLY; The id of the rule set. 327 ID *string `json:"id,omitempty"` 328 // Type - READ-ONLY; The type of the rule set. 329 Type *string `json:"type,omitempty"` 330 // Properties - Properties of the monitoring tag rules. 331 Properties *MonitoringTagRulesProperties `json:"properties,omitempty"` 332 // SystemData - READ-ONLY; The system metadata relating to this resource 333 SystemData *SystemData `json:"systemData,omitempty"` 334} 335 336// MarshalJSON is the custom marshaler for MonitoringTagRules. 337func (mtr MonitoringTagRules) MarshalJSON() ([]byte, error) { 338 objectMap := make(map[string]interface{}) 339 if mtr.Properties != nil { 340 objectMap["properties"] = mtr.Properties 341 } 342 return json.Marshal(objectMap) 343} 344 345// MonitoringTagRulesListResponse response of a list operation. 346type MonitoringTagRulesListResponse struct { 347 autorest.Response `json:"-"` 348 // Value - Results of a list operation. 349 Value *[]MonitoringTagRules `json:"value,omitempty"` 350 // NextLink - Link to the next set of results, if any. 351 NextLink *string `json:"nextLink,omitempty"` 352} 353 354// MonitoringTagRulesListResponseIterator provides access to a complete listing of MonitoringTagRules 355// values. 356type MonitoringTagRulesListResponseIterator struct { 357 i int 358 page MonitoringTagRulesListResponsePage 359} 360 361// NextWithContext advances to the next value. If there was an error making 362// the request the iterator does not advance and the error is returned. 363func (iter *MonitoringTagRulesListResponseIterator) NextWithContext(ctx context.Context) (err error) { 364 if tracing.IsEnabled() { 365 ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringTagRulesListResponseIterator.NextWithContext") 366 defer func() { 367 sc := -1 368 if iter.Response().Response.Response != nil { 369 sc = iter.Response().Response.Response.StatusCode 370 } 371 tracing.EndSpan(ctx, sc, err) 372 }() 373 } 374 iter.i++ 375 if iter.i < len(iter.page.Values()) { 376 return nil 377 } 378 err = iter.page.NextWithContext(ctx) 379 if err != nil { 380 iter.i-- 381 return err 382 } 383 iter.i = 0 384 return nil 385} 386 387// Next advances to the next value. If there was an error making 388// the request the iterator does not advance and the error is returned. 389// Deprecated: Use NextWithContext() instead. 390func (iter *MonitoringTagRulesListResponseIterator) Next() error { 391 return iter.NextWithContext(context.Background()) 392} 393 394// NotDone returns true if the enumeration should be started or is not yet complete. 395func (iter MonitoringTagRulesListResponseIterator) NotDone() bool { 396 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 397} 398 399// Response returns the raw server response from the last page request. 400func (iter MonitoringTagRulesListResponseIterator) Response() MonitoringTagRulesListResponse { 401 return iter.page.Response() 402} 403 404// Value returns the current value or a zero-initialized value if the 405// iterator has advanced beyond the end of the collection. 406func (iter MonitoringTagRulesListResponseIterator) Value() MonitoringTagRules { 407 if !iter.page.NotDone() { 408 return MonitoringTagRules{} 409 } 410 return iter.page.Values()[iter.i] 411} 412 413// Creates a new instance of the MonitoringTagRulesListResponseIterator type. 414func NewMonitoringTagRulesListResponseIterator(page MonitoringTagRulesListResponsePage) MonitoringTagRulesListResponseIterator { 415 return MonitoringTagRulesListResponseIterator{page: page} 416} 417 418// IsEmpty returns true if the ListResult contains no values. 419func (mtrlr MonitoringTagRulesListResponse) IsEmpty() bool { 420 return mtrlr.Value == nil || len(*mtrlr.Value) == 0 421} 422 423// hasNextLink returns true if the NextLink is not empty. 424func (mtrlr MonitoringTagRulesListResponse) hasNextLink() bool { 425 return mtrlr.NextLink != nil && len(*mtrlr.NextLink) != 0 426} 427 428// monitoringTagRulesListResponsePreparer prepares a request to retrieve the next set of results. 429// It returns nil if no more results exist. 430func (mtrlr MonitoringTagRulesListResponse) monitoringTagRulesListResponsePreparer(ctx context.Context) (*http.Request, error) { 431 if !mtrlr.hasNextLink() { 432 return nil, nil 433 } 434 return autorest.Prepare((&http.Request{}).WithContext(ctx), 435 autorest.AsJSON(), 436 autorest.AsGet(), 437 autorest.WithBaseURL(to.String(mtrlr.NextLink))) 438} 439 440// MonitoringTagRulesListResponsePage contains a page of MonitoringTagRules values. 441type MonitoringTagRulesListResponsePage struct { 442 fn func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error) 443 mtrlr MonitoringTagRulesListResponse 444} 445 446// NextWithContext advances to the next page of values. If there was an error making 447// the request the page does not advance and the error is returned. 448func (page *MonitoringTagRulesListResponsePage) NextWithContext(ctx context.Context) (err error) { 449 if tracing.IsEnabled() { 450 ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringTagRulesListResponsePage.NextWithContext") 451 defer func() { 452 sc := -1 453 if page.Response().Response.Response != nil { 454 sc = page.Response().Response.Response.StatusCode 455 } 456 tracing.EndSpan(ctx, sc, err) 457 }() 458 } 459 for { 460 next, err := page.fn(ctx, page.mtrlr) 461 if err != nil { 462 return err 463 } 464 page.mtrlr = next 465 if !next.hasNextLink() || !next.IsEmpty() { 466 break 467 } 468 } 469 return nil 470} 471 472// Next advances to the next page of values. If there was an error making 473// the request the page does not advance and the error is returned. 474// Deprecated: Use NextWithContext() instead. 475func (page *MonitoringTagRulesListResponsePage) Next() error { 476 return page.NextWithContext(context.Background()) 477} 478 479// NotDone returns true if the page enumeration should be started or is not yet complete. 480func (page MonitoringTagRulesListResponsePage) NotDone() bool { 481 return !page.mtrlr.IsEmpty() 482} 483 484// Response returns the raw server response from the last page request. 485func (page MonitoringTagRulesListResponsePage) Response() MonitoringTagRulesListResponse { 486 return page.mtrlr 487} 488 489// Values returns the slice of values for the current page or nil if there are no values. 490func (page MonitoringTagRulesListResponsePage) Values() []MonitoringTagRules { 491 if page.mtrlr.IsEmpty() { 492 return nil 493 } 494 return *page.mtrlr.Value 495} 496 497// Creates a new instance of the MonitoringTagRulesListResponsePage type. 498func NewMonitoringTagRulesListResponsePage(cur MonitoringTagRulesListResponse, getNextPage func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error)) MonitoringTagRulesListResponsePage { 499 return MonitoringTagRulesListResponsePage{ 500 fn: getNextPage, 501 mtrlr: cur, 502 } 503} 504 505// MonitoringTagRulesProperties definition of the properties for a TagRules resource. 506type MonitoringTagRulesProperties struct { 507 // ProvisioningState - Provisioning state of the monitoring tag rules. Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateNotSpecified' 508 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 509 // LogRules - Rules for sending logs. 510 LogRules *LogRules `json:"logRules,omitempty"` 511} 512 513// MonitorProperties properties specific to the monitor resource. 514type MonitorProperties struct { 515 // ProvisioningState - Provisioning state of the monitor resource. Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateNotSpecified' 516 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 517 // MonitoringStatus - Flag specifying if the resource monitoring is enabled or disabled. Possible values include: 'MonitoringStatusEnabled', 'MonitoringStatusDisabled' 518 MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` 519 // ElasticProperties - Elastic cloud properties. 520 ElasticProperties *Properties `json:"elasticProperties,omitempty"` 521 // UserInfo - User information. 522 UserInfo *UserInfo `json:"userInfo,omitempty"` 523 // LiftrResourceCategory - Possible values include: 'LiftrResourceCategoriesUnknown', 'LiftrResourceCategoriesMonitorLogs' 524 LiftrResourceCategory LiftrResourceCategories `json:"liftrResourceCategory,omitempty"` 525 // LiftrResourcePreference - READ-ONLY; The priority of the resource. 526 LiftrResourcePreference *int32 `json:"liftrResourcePreference,omitempty"` 527} 528 529// MarshalJSON is the custom marshaler for MonitorProperties. 530func (mp MonitorProperties) MarshalJSON() ([]byte, error) { 531 objectMap := make(map[string]interface{}) 532 if mp.ProvisioningState != "" { 533 objectMap["provisioningState"] = mp.ProvisioningState 534 } 535 if mp.MonitoringStatus != "" { 536 objectMap["monitoringStatus"] = mp.MonitoringStatus 537 } 538 if mp.ElasticProperties != nil { 539 objectMap["elasticProperties"] = mp.ElasticProperties 540 } 541 if mp.UserInfo != nil { 542 objectMap["userInfo"] = mp.UserInfo 543 } 544 if mp.LiftrResourceCategory != "" { 545 objectMap["liftrResourceCategory"] = mp.LiftrResourceCategory 546 } 547 return json.Marshal(objectMap) 548} 549 550// MonitorResource monitor resource. 551type MonitorResource struct { 552 autorest.Response `json:"-"` 553 // ID - READ-ONLY; ARM id of the monitor resource. 554 ID *string `json:"id,omitempty"` 555 // Name - READ-ONLY; Name of the monitor resource. 556 Name *string `json:"name,omitempty"` 557 // Type - READ-ONLY; The type of the monitor resource. 558 Type *string `json:"type,omitempty"` 559 // Sku - SKU of the monitor resource. 560 Sku *ResourceSku `json:"sku,omitempty"` 561 // Properties - Properties of the monitor resource. 562 Properties *MonitorProperties `json:"properties,omitempty"` 563 // Identity - Identity properties of the monitor resource. 564 Identity *IdentityProperties `json:"identity,omitempty"` 565 // Tags - The tags of the monitor resource. 566 Tags map[string]*string `json:"tags"` 567 // Location - The location of the monitor resource 568 Location *string `json:"location,omitempty"` 569 // SystemData - READ-ONLY; The system metadata relating to this resource 570 SystemData *SystemData `json:"systemData,omitempty"` 571} 572 573// MarshalJSON is the custom marshaler for MonitorResource. 574func (mr MonitorResource) MarshalJSON() ([]byte, error) { 575 objectMap := make(map[string]interface{}) 576 if mr.Sku != nil { 577 objectMap["sku"] = mr.Sku 578 } 579 if mr.Properties != nil { 580 objectMap["properties"] = mr.Properties 581 } 582 if mr.Identity != nil { 583 objectMap["identity"] = mr.Identity 584 } 585 if mr.Tags != nil { 586 objectMap["tags"] = mr.Tags 587 } 588 if mr.Location != nil { 589 objectMap["location"] = mr.Location 590 } 591 return json.Marshal(objectMap) 592} 593 594// MonitorResourceListResponse response of a list operation. 595type MonitorResourceListResponse struct { 596 autorest.Response `json:"-"` 597 // Value - Results of a list operation. 598 Value *[]MonitorResource `json:"value,omitempty"` 599 // NextLink - Link to the next set of results, if any. 600 NextLink *string `json:"nextLink,omitempty"` 601} 602 603// MonitorResourceListResponseIterator provides access to a complete listing of MonitorResource values. 604type MonitorResourceListResponseIterator struct { 605 i int 606 page MonitorResourceListResponsePage 607} 608 609// NextWithContext advances to the next value. If there was an error making 610// the request the iterator does not advance and the error is returned. 611func (iter *MonitorResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { 612 if tracing.IsEnabled() { 613 ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResponseIterator.NextWithContext") 614 defer func() { 615 sc := -1 616 if iter.Response().Response.Response != nil { 617 sc = iter.Response().Response.Response.StatusCode 618 } 619 tracing.EndSpan(ctx, sc, err) 620 }() 621 } 622 iter.i++ 623 if iter.i < len(iter.page.Values()) { 624 return nil 625 } 626 err = iter.page.NextWithContext(ctx) 627 if err != nil { 628 iter.i-- 629 return err 630 } 631 iter.i = 0 632 return nil 633} 634 635// Next advances to the next value. If there was an error making 636// the request the iterator does not advance and the error is returned. 637// Deprecated: Use NextWithContext() instead. 638func (iter *MonitorResourceListResponseIterator) Next() error { 639 return iter.NextWithContext(context.Background()) 640} 641 642// NotDone returns true if the enumeration should be started or is not yet complete. 643func (iter MonitorResourceListResponseIterator) NotDone() bool { 644 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 645} 646 647// Response returns the raw server response from the last page request. 648func (iter MonitorResourceListResponseIterator) Response() MonitorResourceListResponse { 649 return iter.page.Response() 650} 651 652// Value returns the current value or a zero-initialized value if the 653// iterator has advanced beyond the end of the collection. 654func (iter MonitorResourceListResponseIterator) Value() MonitorResource { 655 if !iter.page.NotDone() { 656 return MonitorResource{} 657 } 658 return iter.page.Values()[iter.i] 659} 660 661// Creates a new instance of the MonitorResourceListResponseIterator type. 662func NewMonitorResourceListResponseIterator(page MonitorResourceListResponsePage) MonitorResourceListResponseIterator { 663 return MonitorResourceListResponseIterator{page: page} 664} 665 666// IsEmpty returns true if the ListResult contains no values. 667func (mrlr MonitorResourceListResponse) IsEmpty() bool { 668 return mrlr.Value == nil || len(*mrlr.Value) == 0 669} 670 671// hasNextLink returns true if the NextLink is not empty. 672func (mrlr MonitorResourceListResponse) hasNextLink() bool { 673 return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 674} 675 676// monitorResourceListResponsePreparer prepares a request to retrieve the next set of results. 677// It returns nil if no more results exist. 678func (mrlr MonitorResourceListResponse) monitorResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { 679 if !mrlr.hasNextLink() { 680 return nil, nil 681 } 682 return autorest.Prepare((&http.Request{}).WithContext(ctx), 683 autorest.AsJSON(), 684 autorest.AsGet(), 685 autorest.WithBaseURL(to.String(mrlr.NextLink))) 686} 687 688// MonitorResourceListResponsePage contains a page of MonitorResource values. 689type MonitorResourceListResponsePage struct { 690 fn func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error) 691 mrlr MonitorResourceListResponse 692} 693 694// NextWithContext advances to the next page of values. If there was an error making 695// the request the page does not advance and the error is returned. 696func (page *MonitorResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { 697 if tracing.IsEnabled() { 698 ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResponsePage.NextWithContext") 699 defer func() { 700 sc := -1 701 if page.Response().Response.Response != nil { 702 sc = page.Response().Response.Response.StatusCode 703 } 704 tracing.EndSpan(ctx, sc, err) 705 }() 706 } 707 for { 708 next, err := page.fn(ctx, page.mrlr) 709 if err != nil { 710 return err 711 } 712 page.mrlr = next 713 if !next.hasNextLink() || !next.IsEmpty() { 714 break 715 } 716 } 717 return nil 718} 719 720// Next advances to the next page of values. If there was an error making 721// the request the page does not advance and the error is returned. 722// Deprecated: Use NextWithContext() instead. 723func (page *MonitorResourceListResponsePage) Next() error { 724 return page.NextWithContext(context.Background()) 725} 726 727// NotDone returns true if the page enumeration should be started or is not yet complete. 728func (page MonitorResourceListResponsePage) NotDone() bool { 729 return !page.mrlr.IsEmpty() 730} 731 732// Response returns the raw server response from the last page request. 733func (page MonitorResourceListResponsePage) Response() MonitorResourceListResponse { 734 return page.mrlr 735} 736 737// Values returns the slice of values for the current page or nil if there are no values. 738func (page MonitorResourceListResponsePage) Values() []MonitorResource { 739 if page.mrlr.IsEmpty() { 740 return nil 741 } 742 return *page.mrlr.Value 743} 744 745// Creates a new instance of the MonitorResourceListResponsePage type. 746func NewMonitorResourceListResponsePage(cur MonitorResourceListResponse, getNextPage func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error)) MonitorResourceListResponsePage { 747 return MonitorResourceListResponsePage{ 748 fn: getNextPage, 749 mrlr: cur, 750 } 751} 752 753// MonitorResourceUpdateParameters monitor resource update parameters. 754type MonitorResourceUpdateParameters struct { 755 // Tags - elastic monitor resource tags. 756 Tags map[string]*string `json:"tags"` 757} 758 759// MarshalJSON is the custom marshaler for MonitorResourceUpdateParameters. 760func (mrup MonitorResourceUpdateParameters) MarshalJSON() ([]byte, error) { 761 objectMap := make(map[string]interface{}) 762 if mrup.Tags != nil { 763 objectMap["tags"] = mrup.Tags 764 } 765 return json.Marshal(objectMap) 766} 767 768// MonitorsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 769// operation. 770type MonitorsCreateFuture struct { 771 azure.FutureAPI 772 // Result returns the result of the asynchronous operation. 773 // If the operation has not completed it will return an error. 774 Result func(MonitorsClient) (MonitorResource, error) 775} 776 777// UnmarshalJSON is the custom unmarshaller for CreateFuture. 778func (future *MonitorsCreateFuture) UnmarshalJSON(body []byte) error { 779 var azFuture azure.Future 780 if err := json.Unmarshal(body, &azFuture); err != nil { 781 return err 782 } 783 future.FutureAPI = &azFuture 784 future.Result = future.result 785 return nil 786} 787 788// result is the default implementation for MonitorsCreateFuture.Result. 789func (future *MonitorsCreateFuture) result(client MonitorsClient) (mr MonitorResource, err error) { 790 var done bool 791 done, err = future.DoneWithContext(context.Background(), client) 792 if err != nil { 793 err = autorest.NewErrorWithError(err, "elastic.MonitorsCreateFuture", "Result", future.Response(), "Polling failure") 794 return 795 } 796 if !done { 797 mr.Response.Response = future.Response() 798 err = azure.NewAsyncOpIncompleteError("elastic.MonitorsCreateFuture") 799 return 800 } 801 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 802 if mr.Response.Response, err = future.GetResult(sender); err == nil && mr.Response.Response.StatusCode != http.StatusNoContent { 803 mr, err = client.CreateResponder(mr.Response.Response) 804 if err != nil { 805 err = autorest.NewErrorWithError(err, "elastic.MonitorsCreateFuture", "Result", mr.Response.Response, "Failure responding to request") 806 } 807 } 808 return 809} 810 811// MonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 812// operation. 813type MonitorsDeleteFuture struct { 814 azure.FutureAPI 815 // Result returns the result of the asynchronous operation. 816 // If the operation has not completed it will return an error. 817 Result func(MonitorsClient) (autorest.Response, error) 818} 819 820// UnmarshalJSON is the custom unmarshaller for CreateFuture. 821func (future *MonitorsDeleteFuture) UnmarshalJSON(body []byte) error { 822 var azFuture azure.Future 823 if err := json.Unmarshal(body, &azFuture); err != nil { 824 return err 825 } 826 future.FutureAPI = &azFuture 827 future.Result = future.result 828 return nil 829} 830 831// result is the default implementation for MonitorsDeleteFuture.Result. 832func (future *MonitorsDeleteFuture) result(client MonitorsClient) (ar autorest.Response, err error) { 833 var done bool 834 done, err = future.DoneWithContext(context.Background(), client) 835 if err != nil { 836 err = autorest.NewErrorWithError(err, "elastic.MonitorsDeleteFuture", "Result", future.Response(), "Polling failure") 837 return 838 } 839 if !done { 840 ar.Response = future.Response() 841 err = azure.NewAsyncOpIncompleteError("elastic.MonitorsDeleteFuture") 842 return 843 } 844 ar.Response = future.Response() 845 return 846} 847 848// OperationDisplay the object that represents the operation. 849type OperationDisplay struct { 850 // Provider - Service provider, i.e., Microsoft.Elastic. 851 Provider *string `json:"provider,omitempty"` 852 // Resource - Type on which the operation is performed, e.g., 'monitors'. 853 Resource *string `json:"resource,omitempty"` 854 // Operation - Operation type, e.g., read, write, delete, etc. 855 Operation *string `json:"operation,omitempty"` 856 // Description - Description of the operation, e.g., 'Write monitors'. 857 Description *string `json:"description,omitempty"` 858} 859 860// OperationListResult result of GET request to list the Microsoft.Elastic operations. 861type OperationListResult struct { 862 autorest.Response `json:"-"` 863 // Value - List of operations supported by the Microsoft.Elastic provider. 864 Value *[]OperationResult `json:"value,omitempty"` 865 // NextLink - URL to get the next set of operation list results if there are any. 866 NextLink *string `json:"nextLink,omitempty"` 867} 868 869// OperationListResultIterator provides access to a complete listing of OperationResult values. 870type OperationListResultIterator struct { 871 i int 872 page OperationListResultPage 873} 874 875// NextWithContext advances to the next value. If there was an error making 876// the request the iterator does not advance and the error is returned. 877func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 878 if tracing.IsEnabled() { 879 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 880 defer func() { 881 sc := -1 882 if iter.Response().Response.Response != nil { 883 sc = iter.Response().Response.Response.StatusCode 884 } 885 tracing.EndSpan(ctx, sc, err) 886 }() 887 } 888 iter.i++ 889 if iter.i < len(iter.page.Values()) { 890 return nil 891 } 892 err = iter.page.NextWithContext(ctx) 893 if err != nil { 894 iter.i-- 895 return err 896 } 897 iter.i = 0 898 return nil 899} 900 901// Next advances to the next value. If there was an error making 902// the request the iterator does not advance and the error is returned. 903// Deprecated: Use NextWithContext() instead. 904func (iter *OperationListResultIterator) Next() error { 905 return iter.NextWithContext(context.Background()) 906} 907 908// NotDone returns true if the enumeration should be started or is not yet complete. 909func (iter OperationListResultIterator) NotDone() bool { 910 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 911} 912 913// Response returns the raw server response from the last page request. 914func (iter OperationListResultIterator) Response() OperationListResult { 915 return iter.page.Response() 916} 917 918// Value returns the current value or a zero-initialized value if the 919// iterator has advanced beyond the end of the collection. 920func (iter OperationListResultIterator) Value() OperationResult { 921 if !iter.page.NotDone() { 922 return OperationResult{} 923 } 924 return iter.page.Values()[iter.i] 925} 926 927// Creates a new instance of the OperationListResultIterator type. 928func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 929 return OperationListResultIterator{page: page} 930} 931 932// IsEmpty returns true if the ListResult contains no values. 933func (olr OperationListResult) IsEmpty() bool { 934 return olr.Value == nil || len(*olr.Value) == 0 935} 936 937// hasNextLink returns true if the NextLink is not empty. 938func (olr OperationListResult) hasNextLink() bool { 939 return olr.NextLink != nil && len(*olr.NextLink) != 0 940} 941 942// operationListResultPreparer prepares a request to retrieve the next set of results. 943// It returns nil if no more results exist. 944func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 945 if !olr.hasNextLink() { 946 return nil, nil 947 } 948 return autorest.Prepare((&http.Request{}).WithContext(ctx), 949 autorest.AsJSON(), 950 autorest.AsGet(), 951 autorest.WithBaseURL(to.String(olr.NextLink))) 952} 953 954// OperationListResultPage contains a page of OperationResult values. 955type OperationListResultPage struct { 956 fn func(context.Context, OperationListResult) (OperationListResult, error) 957 olr OperationListResult 958} 959 960// NextWithContext advances to the next page of values. If there was an error making 961// the request the page does not advance and the error is returned. 962func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 963 if tracing.IsEnabled() { 964 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 965 defer func() { 966 sc := -1 967 if page.Response().Response.Response != nil { 968 sc = page.Response().Response.Response.StatusCode 969 } 970 tracing.EndSpan(ctx, sc, err) 971 }() 972 } 973 for { 974 next, err := page.fn(ctx, page.olr) 975 if err != nil { 976 return err 977 } 978 page.olr = next 979 if !next.hasNextLink() || !next.IsEmpty() { 980 break 981 } 982 } 983 return nil 984} 985 986// Next advances to the next page of values. If there was an error making 987// the request the page does not advance and the error is returned. 988// Deprecated: Use NextWithContext() instead. 989func (page *OperationListResultPage) Next() error { 990 return page.NextWithContext(context.Background()) 991} 992 993// NotDone returns true if the page enumeration should be started or is not yet complete. 994func (page OperationListResultPage) NotDone() bool { 995 return !page.olr.IsEmpty() 996} 997 998// Response returns the raw server response from the last page request. 999func (page OperationListResultPage) Response() OperationListResult { 1000 return page.olr 1001} 1002 1003// Values returns the slice of values for the current page or nil if there are no values. 1004func (page OperationListResultPage) Values() []OperationResult { 1005 if page.olr.IsEmpty() { 1006 return nil 1007 } 1008 return *page.olr.Value 1009} 1010 1011// Creates a new instance of the OperationListResultPage type. 1012func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1013 return OperationListResultPage{ 1014 fn: getNextPage, 1015 olr: cur, 1016 } 1017} 1018 1019// OperationResult a Microsoft.Elastic REST API operation. 1020type OperationResult struct { 1021 // Name - Operation name, i.e., {provider}/{resource}/{operation}. 1022 Name *string `json:"name,omitempty"` 1023 // IsDataAction - Indicates whether the operation is a data action 1024 IsDataAction *bool `json:"isDataAction,omitempty"` 1025 // Display - The object that represents the operation. 1026 Display *OperationDisplay `json:"display,omitempty"` 1027 // Origin - Origin of the operation 1028 Origin *string `json:"origin,omitempty"` 1029} 1030 1031// Properties elastic Resource Properties. 1032type Properties struct { 1033 // ElasticCloudUser - Details of the user's elastic account. 1034 ElasticCloudUser *CloudUser `json:"elasticCloudUser,omitempty"` 1035 // ElasticCloudDeployment - Details of the elastic cloud deployment. 1036 ElasticCloudDeployment *CloudDeployment `json:"elasticCloudDeployment,omitempty"` 1037} 1038 1039// ResourceProviderDefaultErrorResponse RP default error response. 1040type ResourceProviderDefaultErrorResponse struct { 1041 // Error - READ-ONLY; Response body of Error 1042 Error *ErrorResponseBody `json:"error,omitempty"` 1043} 1044 1045// MarshalJSON is the custom marshaler for ResourceProviderDefaultErrorResponse. 1046func (rpder ResourceProviderDefaultErrorResponse) MarshalJSON() ([]byte, error) { 1047 objectMap := make(map[string]interface{}) 1048 return json.Marshal(objectMap) 1049} 1050 1051// ResourceSku microsoft.Elastic SKU. 1052type ResourceSku struct { 1053 // Name - Name of the SKU. 1054 Name *string `json:"name,omitempty"` 1055} 1056 1057// SystemData metadata pertaining to creation and last modification of the resource. 1058type SystemData struct { 1059 // CreatedBy - The identity that created the resource. 1060 CreatedBy *string `json:"createdBy,omitempty"` 1061 // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' 1062 CreatedByType CreatedByType `json:"createdByType,omitempty"` 1063 // CreatedAt - The timestamp of resource creation (UTC). 1064 CreatedAt *date.Time `json:"createdAt,omitempty"` 1065 // LastModifiedBy - The identity that last modified the resource. 1066 LastModifiedBy *string `json:"lastModifiedBy,omitempty"` 1067 // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' 1068 LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` 1069 // LastModifiedAt - The timestamp of resource last modification (UTC) 1070 LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` 1071} 1072 1073// TagRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1074// operation. 1075type TagRulesDeleteFuture struct { 1076 azure.FutureAPI 1077 // Result returns the result of the asynchronous operation. 1078 // If the operation has not completed it will return an error. 1079 Result func(TagRulesClient) (autorest.Response, error) 1080} 1081 1082// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1083func (future *TagRulesDeleteFuture) UnmarshalJSON(body []byte) error { 1084 var azFuture azure.Future 1085 if err := json.Unmarshal(body, &azFuture); err != nil { 1086 return err 1087 } 1088 future.FutureAPI = &azFuture 1089 future.Result = future.result 1090 return nil 1091} 1092 1093// result is the default implementation for TagRulesDeleteFuture.Result. 1094func (future *TagRulesDeleteFuture) result(client TagRulesClient) (ar autorest.Response, err error) { 1095 var done bool 1096 done, err = future.DoneWithContext(context.Background(), client) 1097 if err != nil { 1098 err = autorest.NewErrorWithError(err, "elastic.TagRulesDeleteFuture", "Result", future.Response(), "Polling failure") 1099 return 1100 } 1101 if !done { 1102 ar.Response = future.Response() 1103 err = azure.NewAsyncOpIncompleteError("elastic.TagRulesDeleteFuture") 1104 return 1105 } 1106 ar.Response = future.Response() 1107 return 1108} 1109 1110// UserInfo user Information to be passed to partners. 1111type UserInfo struct { 1112 // FirstName - First name of the user 1113 FirstName *string `json:"firstName,omitempty"` 1114 // LastName - Last name of the user 1115 LastName *string `json:"lastName,omitempty"` 1116 // CompanyName - Company name of the user 1117 CompanyName *string `json:"companyName,omitempty"` 1118 // EmailAddress - Email of the user used by Elastic for contacting them if needed 1119 EmailAddress *string `json:"emailAddress,omitempty"` 1120 // CompanyInfo - Company information of the user to be passed to partners. 1121 CompanyInfo *CompanyInfo `json:"companyInfo,omitempty"` 1122} 1123 1124// VMCollectionUpdate update VM resource collection. 1125type VMCollectionUpdate struct { 1126 // VMResourceID - ARM id of the VM resource. 1127 VMResourceID *string `json:"vmResourceId,omitempty"` 1128 // OperationName - Operation to be performed for given VM. Possible values include: 'OperationNameAdd', 'OperationNameDelete' 1129 OperationName OperationName `json:"operationName,omitempty"` 1130} 1131 1132// VMHostListResponse response of a list operation. 1133type VMHostListResponse struct { 1134 autorest.Response `json:"-"` 1135 // Value - Results of a list operation. 1136 Value *[]VMResources `json:"value,omitempty"` 1137 // NextLink - Link to the next Vm resource Id, if any. 1138 NextLink *string `json:"nextLink,omitempty"` 1139} 1140 1141// VMHostListResponseIterator provides access to a complete listing of VMResources values. 1142type VMHostListResponseIterator struct { 1143 i int 1144 page VMHostListResponsePage 1145} 1146 1147// NextWithContext advances to the next value. If there was an error making 1148// the request the iterator does not advance and the error is returned. 1149func (iter *VMHostListResponseIterator) NextWithContext(ctx context.Context) (err error) { 1150 if tracing.IsEnabled() { 1151 ctx = tracing.StartSpan(ctx, fqdn+"/VMHostListResponseIterator.NextWithContext") 1152 defer func() { 1153 sc := -1 1154 if iter.Response().Response.Response != nil { 1155 sc = iter.Response().Response.Response.StatusCode 1156 } 1157 tracing.EndSpan(ctx, sc, err) 1158 }() 1159 } 1160 iter.i++ 1161 if iter.i < len(iter.page.Values()) { 1162 return nil 1163 } 1164 err = iter.page.NextWithContext(ctx) 1165 if err != nil { 1166 iter.i-- 1167 return err 1168 } 1169 iter.i = 0 1170 return nil 1171} 1172 1173// Next advances to the next value. If there was an error making 1174// the request the iterator does not advance and the error is returned. 1175// Deprecated: Use NextWithContext() instead. 1176func (iter *VMHostListResponseIterator) Next() error { 1177 return iter.NextWithContext(context.Background()) 1178} 1179 1180// NotDone returns true if the enumeration should be started or is not yet complete. 1181func (iter VMHostListResponseIterator) NotDone() bool { 1182 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1183} 1184 1185// Response returns the raw server response from the last page request. 1186func (iter VMHostListResponseIterator) Response() VMHostListResponse { 1187 return iter.page.Response() 1188} 1189 1190// Value returns the current value or a zero-initialized value if the 1191// iterator has advanced beyond the end of the collection. 1192func (iter VMHostListResponseIterator) Value() VMResources { 1193 if !iter.page.NotDone() { 1194 return VMResources{} 1195 } 1196 return iter.page.Values()[iter.i] 1197} 1198 1199// Creates a new instance of the VMHostListResponseIterator type. 1200func NewVMHostListResponseIterator(page VMHostListResponsePage) VMHostListResponseIterator { 1201 return VMHostListResponseIterator{page: page} 1202} 1203 1204// IsEmpty returns true if the ListResult contains no values. 1205func (vhlr VMHostListResponse) IsEmpty() bool { 1206 return vhlr.Value == nil || len(*vhlr.Value) == 0 1207} 1208 1209// hasNextLink returns true if the NextLink is not empty. 1210func (vhlr VMHostListResponse) hasNextLink() bool { 1211 return vhlr.NextLink != nil && len(*vhlr.NextLink) != 0 1212} 1213 1214// vMHostListResponsePreparer prepares a request to retrieve the next set of results. 1215// It returns nil if no more results exist. 1216func (vhlr VMHostListResponse) vMHostListResponsePreparer(ctx context.Context) (*http.Request, error) { 1217 if !vhlr.hasNextLink() { 1218 return nil, nil 1219 } 1220 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1221 autorest.AsJSON(), 1222 autorest.AsGet(), 1223 autorest.WithBaseURL(to.String(vhlr.NextLink))) 1224} 1225 1226// VMHostListResponsePage contains a page of VMResources values. 1227type VMHostListResponsePage struct { 1228 fn func(context.Context, VMHostListResponse) (VMHostListResponse, error) 1229 vhlr VMHostListResponse 1230} 1231 1232// NextWithContext advances to the next page of values. If there was an error making 1233// the request the page does not advance and the error is returned. 1234func (page *VMHostListResponsePage) NextWithContext(ctx context.Context) (err error) { 1235 if tracing.IsEnabled() { 1236 ctx = tracing.StartSpan(ctx, fqdn+"/VMHostListResponsePage.NextWithContext") 1237 defer func() { 1238 sc := -1 1239 if page.Response().Response.Response != nil { 1240 sc = page.Response().Response.Response.StatusCode 1241 } 1242 tracing.EndSpan(ctx, sc, err) 1243 }() 1244 } 1245 for { 1246 next, err := page.fn(ctx, page.vhlr) 1247 if err != nil { 1248 return err 1249 } 1250 page.vhlr = next 1251 if !next.hasNextLink() || !next.IsEmpty() { 1252 break 1253 } 1254 } 1255 return nil 1256} 1257 1258// Next advances to the next page of values. If there was an error making 1259// the request the page does not advance and the error is returned. 1260// Deprecated: Use NextWithContext() instead. 1261func (page *VMHostListResponsePage) Next() error { 1262 return page.NextWithContext(context.Background()) 1263} 1264 1265// NotDone returns true if the page enumeration should be started or is not yet complete. 1266func (page VMHostListResponsePage) NotDone() bool { 1267 return !page.vhlr.IsEmpty() 1268} 1269 1270// Response returns the raw server response from the last page request. 1271func (page VMHostListResponsePage) Response() VMHostListResponse { 1272 return page.vhlr 1273} 1274 1275// Values returns the slice of values for the current page or nil if there are no values. 1276func (page VMHostListResponsePage) Values() []VMResources { 1277 if page.vhlr.IsEmpty() { 1278 return nil 1279 } 1280 return *page.vhlr.Value 1281} 1282 1283// Creates a new instance of the VMHostListResponsePage type. 1284func NewVMHostListResponsePage(cur VMHostListResponse, getNextPage func(context.Context, VMHostListResponse) (VMHostListResponse, error)) VMHostListResponsePage { 1285 return VMHostListResponsePage{ 1286 fn: getNextPage, 1287 vhlr: cur, 1288 } 1289} 1290 1291// VMIngestionDetailsResponse the vm ingestion details to install an agent. 1292type VMIngestionDetailsResponse struct { 1293 autorest.Response `json:"-"` 1294 // CloudID - The cloudId of given Elastic monitor resource. 1295 CloudID *string `json:"cloudId,omitempty"` 1296 // IngestionKey - Ingestion details to install agent on given VM. 1297 IngestionKey *string `json:"ingestionKey,omitempty"` 1298} 1299 1300// VMResources the vm resource properties that is currently being monitored by the Elastic monitor 1301// resource. 1302type VMResources struct { 1303 // VMResourceID - The ARM id of the VM resource. 1304 VMResourceID *string `json:"vmResourceId,omitempty"` 1305} 1306