1package policyinsights 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/date" 14 "github.com/Azure/go-autorest/autorest/to" 15 "github.com/Azure/go-autorest/tracing" 16 "net/http" 17) 18 19// The package's fully qualified name. 20const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2018-07-01-preview/policyinsights" 21 22// ErrorDefinition error definition. 23type ErrorDefinition struct { 24 // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. 25 Code *string `json:"code,omitempty"` 26 // Message - READ-ONLY; Description of the error. 27 Message *string `json:"message,omitempty"` 28 // Target - READ-ONLY; The target of the error. 29 Target *string `json:"target,omitempty"` 30 // Details - READ-ONLY; Internal error details. 31 Details *[]ErrorDefinition `json:"details,omitempty"` 32 // AdditionalInfo - READ-ONLY; Additional scenario specific error details. 33 AdditionalInfo *[]TypedErrorInfo `json:"additionalInfo,omitempty"` 34} 35 36// MarshalJSON is the custom marshaler for ErrorDefinition. 37func (ed ErrorDefinition) MarshalJSON() ([]byte, error) { 38 objectMap := make(map[string]interface{}) 39 return json.Marshal(objectMap) 40} 41 42// ErrorResponse error response. 43type ErrorResponse struct { 44 // Error - The error details. 45 Error *ErrorDefinition `json:"error,omitempty"` 46} 47 48// ExpressionEvaluationDetails evaluation details of policy language expressions. 49type ExpressionEvaluationDetails struct { 50 // Result - Evaluation result. 51 Result *string `json:"result,omitempty"` 52 // Expression - Expression evaluated. 53 Expression *string `json:"expression,omitempty"` 54 // Path - Property path if the expression is a field or an alias. 55 Path *string `json:"path,omitempty"` 56 // ExpressionValue - Value of the expression. 57 ExpressionValue interface{} `json:"expressionValue,omitempty"` 58 // TargetValue - Target value to be compared with the expression value. 59 TargetValue interface{} `json:"targetValue,omitempty"` 60 // Operator - Operator to compare the expression value and the target value. 61 Operator *string `json:"operator,omitempty"` 62} 63 64// IfNotExistsEvaluationDetails evaluation details of IfNotExists effect. 65type IfNotExistsEvaluationDetails struct { 66 // ResourceID - ID of the last evaluated resource for IfNotExists effect. 67 ResourceID *string `json:"resourceId,omitempty"` 68 // TotalResources - Total number of resources to which the existence condition is applicable. 69 TotalResources *int32 `json:"totalResources,omitempty"` 70} 71 72// Operation operation definition. 73type Operation struct { 74 // Name - Operation name. 75 Name *string `json:"name,omitempty"` 76 // Display - Display metadata associated with the operation. 77 Display *OperationDisplay `json:"display,omitempty"` 78} 79 80// OperationDisplay display metadata associated with the operation. 81type OperationDisplay struct { 82 // Provider - Resource provider name. 83 Provider *string `json:"provider,omitempty"` 84 // Resource - Resource name on which the operation is performed. 85 Resource *string `json:"resource,omitempty"` 86 // Operation - Operation name. 87 Operation *string `json:"operation,omitempty"` 88 // Description - Operation description. 89 Description *string `json:"description,omitempty"` 90} 91 92// OperationsListResults list of available operations. 93type OperationsListResults struct { 94 autorest.Response `json:"-"` 95 // OdataCount - OData entity count; represents the number of operations returned. 96 OdataCount *int32 `json:"@odata.count,omitempty"` 97 // Value - List of available operations. 98 Value *[]Operation `json:"value,omitempty"` 99} 100 101// PolicyAssignmentSummary policy assignment summary. 102type PolicyAssignmentSummary struct { 103 // PolicyAssignmentID - Policy assignment ID. 104 PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"` 105 // PolicySetDefinitionID - Policy set definition ID, if the policy assignment is for a policy set. 106 PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"` 107 // Results - Non-compliance summary for the policy assignment. 108 Results *SummaryResults `json:"results,omitempty"` 109 // PolicyDefinitions - Policy definitions summary. 110 PolicyDefinitions *[]PolicyDefinitionSummary `json:"policyDefinitions,omitempty"` 111} 112 113// PolicyDefinitionSummary policy definition summary. 114type PolicyDefinitionSummary struct { 115 // PolicyDefinitionID - Policy definition ID. 116 PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` 117 // PolicyDefinitionReferenceID - Policy definition reference ID. 118 PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"` 119 // Effect - Policy effect, i.e. policy definition action. 120 Effect *string `json:"effect,omitempty"` 121 // Results - Non-compliance summary for the policy definition. 122 Results *SummaryResults `json:"results,omitempty"` 123} 124 125// PolicyDetails the policy details. 126type PolicyDetails struct { 127 // PolicyDefinitionID - READ-ONLY; The ID of the policy definition. 128 PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` 129 // PolicyAssignmentID - READ-ONLY; The ID of the policy assignment. 130 PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"` 131 // PolicyAssignmentDisplayName - READ-ONLY; The display name of the policy assignment. 132 PolicyAssignmentDisplayName *string `json:"policyAssignmentDisplayName,omitempty"` 133 // PolicyAssignmentScope - READ-ONLY; The scope of the policy assignment. 134 PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty"` 135 // PolicySetDefinitionID - READ-ONLY; The ID of the policy set definition. 136 PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"` 137 // PolicyDefinitionReferenceID - READ-ONLY; The policy definition reference ID within the policy set definition. 138 PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"` 139} 140 141// MarshalJSON is the custom marshaler for PolicyDetails. 142func (pd PolicyDetails) MarshalJSON() ([]byte, error) { 143 objectMap := make(map[string]interface{}) 144 return json.Marshal(objectMap) 145} 146 147// PolicyEvaluationDetails policy evaluation details. 148type PolicyEvaluationDetails struct { 149 // EvaluatedExpressions - Details of the evaluated expressions. 150 EvaluatedExpressions *[]ExpressionEvaluationDetails `json:"evaluatedExpressions,omitempty"` 151 // IfNotExistsDetails - Evaluation details of IfNotExists effect. 152 IfNotExistsDetails *IfNotExistsEvaluationDetails `json:"ifNotExistsDetails,omitempty"` 153} 154 155// PolicyEvent policy event record. 156type PolicyEvent struct { 157 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 158 AdditionalProperties map[string]interface{} `json:""` 159 // OdataID - OData entity ID; always set to null since policy event records do not have an entity ID. 160 OdataID *string `json:"@odata.id,omitempty"` 161 // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. 162 OdataContext *string `json:"@odata.context,omitempty"` 163 // Timestamp - Timestamp for the policy event record. 164 Timestamp *date.Time `json:"timestamp,omitempty"` 165 // ResourceID - Resource ID. 166 ResourceID *string `json:"resourceId,omitempty"` 167 // PolicyAssignmentID - Policy assignment ID. 168 PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"` 169 // PolicyDefinitionID - Policy definition ID. 170 PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` 171 // EffectiveParameters - Effective parameters for the policy assignment. 172 EffectiveParameters *string `json:"effectiveParameters,omitempty"` 173 // IsCompliant - Flag which states whether the resource is compliant against the policy assignment it was evaluated against. 174 IsCompliant *bool `json:"isCompliant,omitempty"` 175 // SubscriptionID - Subscription ID. 176 SubscriptionID *string `json:"subscriptionId,omitempty"` 177 // ResourceType - Resource type. 178 ResourceType *string `json:"resourceType,omitempty"` 179 // ResourceLocation - Resource location. 180 ResourceLocation *string `json:"resourceLocation,omitempty"` 181 // ResourceGroup - Resource group name. 182 ResourceGroup *string `json:"resourceGroup,omitempty"` 183 // ResourceTags - List of resource tags. 184 ResourceTags *string `json:"resourceTags,omitempty"` 185 // PolicyAssignmentName - Policy assignment name. 186 PolicyAssignmentName *string `json:"policyAssignmentName,omitempty"` 187 // PolicyAssignmentOwner - Policy assignment owner. 188 PolicyAssignmentOwner *string `json:"policyAssignmentOwner,omitempty"` 189 // PolicyAssignmentParameters - Policy assignment parameters. 190 PolicyAssignmentParameters *string `json:"policyAssignmentParameters,omitempty"` 191 // PolicyAssignmentScope - Policy assignment scope. 192 PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty"` 193 // PolicyDefinitionName - Policy definition name. 194 PolicyDefinitionName *string `json:"policyDefinitionName,omitempty"` 195 // PolicyDefinitionAction - Policy definition action, i.e. effect. 196 PolicyDefinitionAction *string `json:"policyDefinitionAction,omitempty"` 197 // PolicyDefinitionCategory - Policy definition category. 198 PolicyDefinitionCategory *string `json:"policyDefinitionCategory,omitempty"` 199 // PolicySetDefinitionID - Policy set definition ID, if the policy assignment is for a policy set. 200 PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"` 201 // PolicySetDefinitionName - Policy set definition name, if the policy assignment is for a policy set. 202 PolicySetDefinitionName *string `json:"policySetDefinitionName,omitempty"` 203 // PolicySetDefinitionOwner - Policy set definition owner, if the policy assignment is for a policy set. 204 PolicySetDefinitionOwner *string `json:"policySetDefinitionOwner,omitempty"` 205 // PolicySetDefinitionCategory - Policy set definition category, if the policy assignment is for a policy set. 206 PolicySetDefinitionCategory *string `json:"policySetDefinitionCategory,omitempty"` 207 // PolicySetDefinitionParameters - Policy set definition parameters, if the policy assignment is for a policy set. 208 PolicySetDefinitionParameters *string `json:"policySetDefinitionParameters,omitempty"` 209 // ManagementGroupIds - Comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. 210 ManagementGroupIds *string `json:"managementGroupIds,omitempty"` 211 // PolicyDefinitionReferenceID - Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. 212 PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"` 213 // TenantID - Tenant ID for the policy event record. 214 TenantID *string `json:"tenantId,omitempty"` 215 // PrincipalOid - Principal object ID for the user who initiated the resource operation that triggered the policy event. 216 PrincipalOid *string `json:"principalOid,omitempty"` 217} 218 219// MarshalJSON is the custom marshaler for PolicyEvent. 220func (peVar PolicyEvent) MarshalJSON() ([]byte, error) { 221 objectMap := make(map[string]interface{}) 222 if peVar.OdataID != nil { 223 objectMap["@odata.id"] = peVar.OdataID 224 } 225 if peVar.OdataContext != nil { 226 objectMap["@odata.context"] = peVar.OdataContext 227 } 228 if peVar.Timestamp != nil { 229 objectMap["timestamp"] = peVar.Timestamp 230 } 231 if peVar.ResourceID != nil { 232 objectMap["resourceId"] = peVar.ResourceID 233 } 234 if peVar.PolicyAssignmentID != nil { 235 objectMap["policyAssignmentId"] = peVar.PolicyAssignmentID 236 } 237 if peVar.PolicyDefinitionID != nil { 238 objectMap["policyDefinitionId"] = peVar.PolicyDefinitionID 239 } 240 if peVar.EffectiveParameters != nil { 241 objectMap["effectiveParameters"] = peVar.EffectiveParameters 242 } 243 if peVar.IsCompliant != nil { 244 objectMap["isCompliant"] = peVar.IsCompliant 245 } 246 if peVar.SubscriptionID != nil { 247 objectMap["subscriptionId"] = peVar.SubscriptionID 248 } 249 if peVar.ResourceType != nil { 250 objectMap["resourceType"] = peVar.ResourceType 251 } 252 if peVar.ResourceLocation != nil { 253 objectMap["resourceLocation"] = peVar.ResourceLocation 254 } 255 if peVar.ResourceGroup != nil { 256 objectMap["resourceGroup"] = peVar.ResourceGroup 257 } 258 if peVar.ResourceTags != nil { 259 objectMap["resourceTags"] = peVar.ResourceTags 260 } 261 if peVar.PolicyAssignmentName != nil { 262 objectMap["policyAssignmentName"] = peVar.PolicyAssignmentName 263 } 264 if peVar.PolicyAssignmentOwner != nil { 265 objectMap["policyAssignmentOwner"] = peVar.PolicyAssignmentOwner 266 } 267 if peVar.PolicyAssignmentParameters != nil { 268 objectMap["policyAssignmentParameters"] = peVar.PolicyAssignmentParameters 269 } 270 if peVar.PolicyAssignmentScope != nil { 271 objectMap["policyAssignmentScope"] = peVar.PolicyAssignmentScope 272 } 273 if peVar.PolicyDefinitionName != nil { 274 objectMap["policyDefinitionName"] = peVar.PolicyDefinitionName 275 } 276 if peVar.PolicyDefinitionAction != nil { 277 objectMap["policyDefinitionAction"] = peVar.PolicyDefinitionAction 278 } 279 if peVar.PolicyDefinitionCategory != nil { 280 objectMap["policyDefinitionCategory"] = peVar.PolicyDefinitionCategory 281 } 282 if peVar.PolicySetDefinitionID != nil { 283 objectMap["policySetDefinitionId"] = peVar.PolicySetDefinitionID 284 } 285 if peVar.PolicySetDefinitionName != nil { 286 objectMap["policySetDefinitionName"] = peVar.PolicySetDefinitionName 287 } 288 if peVar.PolicySetDefinitionOwner != nil { 289 objectMap["policySetDefinitionOwner"] = peVar.PolicySetDefinitionOwner 290 } 291 if peVar.PolicySetDefinitionCategory != nil { 292 objectMap["policySetDefinitionCategory"] = peVar.PolicySetDefinitionCategory 293 } 294 if peVar.PolicySetDefinitionParameters != nil { 295 objectMap["policySetDefinitionParameters"] = peVar.PolicySetDefinitionParameters 296 } 297 if peVar.ManagementGroupIds != nil { 298 objectMap["managementGroupIds"] = peVar.ManagementGroupIds 299 } 300 if peVar.PolicyDefinitionReferenceID != nil { 301 objectMap["policyDefinitionReferenceId"] = peVar.PolicyDefinitionReferenceID 302 } 303 if peVar.TenantID != nil { 304 objectMap["tenantId"] = peVar.TenantID 305 } 306 if peVar.PrincipalOid != nil { 307 objectMap["principalOid"] = peVar.PrincipalOid 308 } 309 for k, v := range peVar.AdditionalProperties { 310 objectMap[k] = v 311 } 312 return json.Marshal(objectMap) 313} 314 315// UnmarshalJSON is the custom unmarshaler for PolicyEvent struct. 316func (peVar *PolicyEvent) UnmarshalJSON(body []byte) error { 317 var m map[string]*json.RawMessage 318 err := json.Unmarshal(body, &m) 319 if err != nil { 320 return err 321 } 322 for k, v := range m { 323 switch k { 324 default: 325 if v != nil { 326 var additionalProperties interface{} 327 err = json.Unmarshal(*v, &additionalProperties) 328 if err != nil { 329 return err 330 } 331 if peVar.AdditionalProperties == nil { 332 peVar.AdditionalProperties = make(map[string]interface{}) 333 } 334 peVar.AdditionalProperties[k] = additionalProperties 335 } 336 case "@odata.id": 337 if v != nil { 338 var odataID string 339 err = json.Unmarshal(*v, &odataID) 340 if err != nil { 341 return err 342 } 343 peVar.OdataID = &odataID 344 } 345 case "@odata.context": 346 if v != nil { 347 var odataContext string 348 err = json.Unmarshal(*v, &odataContext) 349 if err != nil { 350 return err 351 } 352 peVar.OdataContext = &odataContext 353 } 354 case "timestamp": 355 if v != nil { 356 var timestamp date.Time 357 err = json.Unmarshal(*v, ×tamp) 358 if err != nil { 359 return err 360 } 361 peVar.Timestamp = ×tamp 362 } 363 case "resourceId": 364 if v != nil { 365 var resourceID string 366 err = json.Unmarshal(*v, &resourceID) 367 if err != nil { 368 return err 369 } 370 peVar.ResourceID = &resourceID 371 } 372 case "policyAssignmentId": 373 if v != nil { 374 var policyAssignmentID string 375 err = json.Unmarshal(*v, &policyAssignmentID) 376 if err != nil { 377 return err 378 } 379 peVar.PolicyAssignmentID = &policyAssignmentID 380 } 381 case "policyDefinitionId": 382 if v != nil { 383 var policyDefinitionID string 384 err = json.Unmarshal(*v, &policyDefinitionID) 385 if err != nil { 386 return err 387 } 388 peVar.PolicyDefinitionID = &policyDefinitionID 389 } 390 case "effectiveParameters": 391 if v != nil { 392 var effectiveParameters string 393 err = json.Unmarshal(*v, &effectiveParameters) 394 if err != nil { 395 return err 396 } 397 peVar.EffectiveParameters = &effectiveParameters 398 } 399 case "isCompliant": 400 if v != nil { 401 var isCompliant bool 402 err = json.Unmarshal(*v, &isCompliant) 403 if err != nil { 404 return err 405 } 406 peVar.IsCompliant = &isCompliant 407 } 408 case "subscriptionId": 409 if v != nil { 410 var subscriptionID string 411 err = json.Unmarshal(*v, &subscriptionID) 412 if err != nil { 413 return err 414 } 415 peVar.SubscriptionID = &subscriptionID 416 } 417 case "resourceType": 418 if v != nil { 419 var resourceType string 420 err = json.Unmarshal(*v, &resourceType) 421 if err != nil { 422 return err 423 } 424 peVar.ResourceType = &resourceType 425 } 426 case "resourceLocation": 427 if v != nil { 428 var resourceLocation string 429 err = json.Unmarshal(*v, &resourceLocation) 430 if err != nil { 431 return err 432 } 433 peVar.ResourceLocation = &resourceLocation 434 } 435 case "resourceGroup": 436 if v != nil { 437 var resourceGroup string 438 err = json.Unmarshal(*v, &resourceGroup) 439 if err != nil { 440 return err 441 } 442 peVar.ResourceGroup = &resourceGroup 443 } 444 case "resourceTags": 445 if v != nil { 446 var resourceTags string 447 err = json.Unmarshal(*v, &resourceTags) 448 if err != nil { 449 return err 450 } 451 peVar.ResourceTags = &resourceTags 452 } 453 case "policyAssignmentName": 454 if v != nil { 455 var policyAssignmentName string 456 err = json.Unmarshal(*v, &policyAssignmentName) 457 if err != nil { 458 return err 459 } 460 peVar.PolicyAssignmentName = &policyAssignmentName 461 } 462 case "policyAssignmentOwner": 463 if v != nil { 464 var policyAssignmentOwner string 465 err = json.Unmarshal(*v, &policyAssignmentOwner) 466 if err != nil { 467 return err 468 } 469 peVar.PolicyAssignmentOwner = &policyAssignmentOwner 470 } 471 case "policyAssignmentParameters": 472 if v != nil { 473 var policyAssignmentParameters string 474 err = json.Unmarshal(*v, &policyAssignmentParameters) 475 if err != nil { 476 return err 477 } 478 peVar.PolicyAssignmentParameters = &policyAssignmentParameters 479 } 480 case "policyAssignmentScope": 481 if v != nil { 482 var policyAssignmentScope string 483 err = json.Unmarshal(*v, &policyAssignmentScope) 484 if err != nil { 485 return err 486 } 487 peVar.PolicyAssignmentScope = &policyAssignmentScope 488 } 489 case "policyDefinitionName": 490 if v != nil { 491 var policyDefinitionName string 492 err = json.Unmarshal(*v, &policyDefinitionName) 493 if err != nil { 494 return err 495 } 496 peVar.PolicyDefinitionName = &policyDefinitionName 497 } 498 case "policyDefinitionAction": 499 if v != nil { 500 var policyDefinitionAction string 501 err = json.Unmarshal(*v, &policyDefinitionAction) 502 if err != nil { 503 return err 504 } 505 peVar.PolicyDefinitionAction = &policyDefinitionAction 506 } 507 case "policyDefinitionCategory": 508 if v != nil { 509 var policyDefinitionCategory string 510 err = json.Unmarshal(*v, &policyDefinitionCategory) 511 if err != nil { 512 return err 513 } 514 peVar.PolicyDefinitionCategory = &policyDefinitionCategory 515 } 516 case "policySetDefinitionId": 517 if v != nil { 518 var policySetDefinitionID string 519 err = json.Unmarshal(*v, &policySetDefinitionID) 520 if err != nil { 521 return err 522 } 523 peVar.PolicySetDefinitionID = &policySetDefinitionID 524 } 525 case "policySetDefinitionName": 526 if v != nil { 527 var policySetDefinitionName string 528 err = json.Unmarshal(*v, &policySetDefinitionName) 529 if err != nil { 530 return err 531 } 532 peVar.PolicySetDefinitionName = &policySetDefinitionName 533 } 534 case "policySetDefinitionOwner": 535 if v != nil { 536 var policySetDefinitionOwner string 537 err = json.Unmarshal(*v, &policySetDefinitionOwner) 538 if err != nil { 539 return err 540 } 541 peVar.PolicySetDefinitionOwner = &policySetDefinitionOwner 542 } 543 case "policySetDefinitionCategory": 544 if v != nil { 545 var policySetDefinitionCategory string 546 err = json.Unmarshal(*v, &policySetDefinitionCategory) 547 if err != nil { 548 return err 549 } 550 peVar.PolicySetDefinitionCategory = &policySetDefinitionCategory 551 } 552 case "policySetDefinitionParameters": 553 if v != nil { 554 var policySetDefinitionParameters string 555 err = json.Unmarshal(*v, &policySetDefinitionParameters) 556 if err != nil { 557 return err 558 } 559 peVar.PolicySetDefinitionParameters = &policySetDefinitionParameters 560 } 561 case "managementGroupIds": 562 if v != nil { 563 var managementGroupIds string 564 err = json.Unmarshal(*v, &managementGroupIds) 565 if err != nil { 566 return err 567 } 568 peVar.ManagementGroupIds = &managementGroupIds 569 } 570 case "policyDefinitionReferenceId": 571 if v != nil { 572 var policyDefinitionReferenceID string 573 err = json.Unmarshal(*v, &policyDefinitionReferenceID) 574 if err != nil { 575 return err 576 } 577 peVar.PolicyDefinitionReferenceID = &policyDefinitionReferenceID 578 } 579 case "tenantId": 580 if v != nil { 581 var tenantID string 582 err = json.Unmarshal(*v, &tenantID) 583 if err != nil { 584 return err 585 } 586 peVar.TenantID = &tenantID 587 } 588 case "principalOid": 589 if v != nil { 590 var principalOid string 591 err = json.Unmarshal(*v, &principalOid) 592 if err != nil { 593 return err 594 } 595 peVar.PrincipalOid = &principalOid 596 } 597 } 598 } 599 600 return nil 601} 602 603// PolicyEventsQueryResults query results. 604type PolicyEventsQueryResults struct { 605 autorest.Response `json:"-"` 606 // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. 607 OdataContext *string `json:"@odata.context,omitempty"` 608 // OdataCount - OData entity count; represents the number of policy event records returned. 609 OdataCount *int32 `json:"@odata.count,omitempty"` 610 // OdataNextLink - Odata next link; URL to get the next set of results. 611 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 612 // Value - Query results. 613 Value *[]PolicyEvent `json:"value,omitempty"` 614} 615 616// PolicyEventsQueryResultsIterator provides access to a complete listing of PolicyEvent values. 617type PolicyEventsQueryResultsIterator struct { 618 i int 619 page PolicyEventsQueryResultsPage 620} 621 622// NextWithContext advances to the next value. If there was an error making 623// the request the iterator does not advance and the error is returned. 624func (iter *PolicyEventsQueryResultsIterator) NextWithContext(ctx context.Context) (err error) { 625 if tracing.IsEnabled() { 626 ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsQueryResultsIterator.NextWithContext") 627 defer func() { 628 sc := -1 629 if iter.Response().Response.Response != nil { 630 sc = iter.Response().Response.Response.StatusCode 631 } 632 tracing.EndSpan(ctx, sc, err) 633 }() 634 } 635 iter.i++ 636 if iter.i < len(iter.page.Values()) { 637 return nil 638 } 639 err = iter.page.NextWithContext(ctx) 640 if err != nil { 641 iter.i-- 642 return err 643 } 644 iter.i = 0 645 return nil 646} 647 648// Next advances to the next value. If there was an error making 649// the request the iterator does not advance and the error is returned. 650// Deprecated: Use NextWithContext() instead. 651func (iter *PolicyEventsQueryResultsIterator) Next() error { 652 return iter.NextWithContext(context.Background()) 653} 654 655// NotDone returns true if the enumeration should be started or is not yet complete. 656func (iter PolicyEventsQueryResultsIterator) NotDone() bool { 657 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 658} 659 660// Response returns the raw server response from the last page request. 661func (iter PolicyEventsQueryResultsIterator) Response() PolicyEventsQueryResults { 662 return iter.page.Response() 663} 664 665// Value returns the current value or a zero-initialized value if the 666// iterator has advanced beyond the end of the collection. 667func (iter PolicyEventsQueryResultsIterator) Value() PolicyEvent { 668 if !iter.page.NotDone() { 669 return PolicyEvent{} 670 } 671 return iter.page.Values()[iter.i] 672} 673 674// Creates a new instance of the PolicyEventsQueryResultsIterator type. 675func NewPolicyEventsQueryResultsIterator(page PolicyEventsQueryResultsPage) PolicyEventsQueryResultsIterator { 676 return PolicyEventsQueryResultsIterator{page: page} 677} 678 679// IsEmpty returns true if the ListResult contains no values. 680func (peqr PolicyEventsQueryResults) IsEmpty() bool { 681 return peqr.Value == nil || len(*peqr.Value) == 0 682} 683 684// hasNextLink returns true if the NextLink is not empty. 685func (peqr PolicyEventsQueryResults) hasNextLink() bool { 686 return peqr.OdataNextLink != nil && len(*peqr.OdataNextLink) != 0 687} 688 689// policyEventsQueryResultsPreparer prepares a request to retrieve the next set of results. 690// It returns nil if no more results exist. 691func (peqr PolicyEventsQueryResults) policyEventsQueryResultsPreparer(ctx context.Context) (*http.Request, error) { 692 if !peqr.hasNextLink() { 693 return nil, nil 694 } 695 return autorest.Prepare((&http.Request{}).WithContext(ctx), 696 autorest.AsJSON(), 697 autorest.AsGet(), 698 autorest.WithBaseURL(to.String(peqr.OdataNextLink))) 699} 700 701// PolicyEventsQueryResultsPage contains a page of PolicyEvent values. 702type PolicyEventsQueryResultsPage struct { 703 fn func(context.Context, PolicyEventsQueryResults) (PolicyEventsQueryResults, error) 704 peqr PolicyEventsQueryResults 705} 706 707// NextWithContext advances to the next page of values. If there was an error making 708// the request the page does not advance and the error is returned. 709func (page *PolicyEventsQueryResultsPage) NextWithContext(ctx context.Context) (err error) { 710 if tracing.IsEnabled() { 711 ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsQueryResultsPage.NextWithContext") 712 defer func() { 713 sc := -1 714 if page.Response().Response.Response != nil { 715 sc = page.Response().Response.Response.StatusCode 716 } 717 tracing.EndSpan(ctx, sc, err) 718 }() 719 } 720 for { 721 next, err := page.fn(ctx, page.peqr) 722 if err != nil { 723 return err 724 } 725 page.peqr = next 726 if !next.hasNextLink() || !next.IsEmpty() { 727 break 728 } 729 } 730 return nil 731} 732 733// Next advances to the next page of values. If there was an error making 734// the request the page does not advance and the error is returned. 735// Deprecated: Use NextWithContext() instead. 736func (page *PolicyEventsQueryResultsPage) Next() error { 737 return page.NextWithContext(context.Background()) 738} 739 740// NotDone returns true if the page enumeration should be started or is not yet complete. 741func (page PolicyEventsQueryResultsPage) NotDone() bool { 742 return !page.peqr.IsEmpty() 743} 744 745// Response returns the raw server response from the last page request. 746func (page PolicyEventsQueryResultsPage) Response() PolicyEventsQueryResults { 747 return page.peqr 748} 749 750// Values returns the slice of values for the current page or nil if there are no values. 751func (page PolicyEventsQueryResultsPage) Values() []PolicyEvent { 752 if page.peqr.IsEmpty() { 753 return nil 754 } 755 return *page.peqr.Value 756} 757 758// Creates a new instance of the PolicyEventsQueryResultsPage type. 759func NewPolicyEventsQueryResultsPage(cur PolicyEventsQueryResults, getNextPage func(context.Context, PolicyEventsQueryResults) (PolicyEventsQueryResults, error)) PolicyEventsQueryResultsPage { 760 return PolicyEventsQueryResultsPage{ 761 fn: getNextPage, 762 peqr: cur, 763 } 764} 765 766// PolicyState policy state record. 767type PolicyState struct { 768 // AdditionalProperties - Unmatched properties from the message are deserialized this collection 769 AdditionalProperties map[string]interface{} `json:""` 770 // OdataID - OData entity ID; always set to null since policy state records do not have an entity ID. 771 OdataID *string `json:"@odata.id,omitempty"` 772 // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. 773 OdataContext *string `json:"@odata.context,omitempty"` 774 // Timestamp - Timestamp for the policy state record. 775 Timestamp *date.Time `json:"timestamp,omitempty"` 776 // ResourceID - Resource ID. 777 ResourceID *string `json:"resourceId,omitempty"` 778 // PolicyAssignmentID - Policy assignment ID. 779 PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"` 780 // PolicyDefinitionID - Policy definition ID. 781 PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` 782 // EffectiveParameters - Effective parameters for the policy assignment. 783 EffectiveParameters *string `json:"effectiveParameters,omitempty"` 784 // IsCompliant - Flag which states whether the resource is compliant against the policy assignment it was evaluated against. 785 IsCompliant *bool `json:"isCompliant,omitempty"` 786 // SubscriptionID - Subscription ID. 787 SubscriptionID *string `json:"subscriptionId,omitempty"` 788 // ResourceType - Resource type. 789 ResourceType *string `json:"resourceType,omitempty"` 790 // ResourceLocation - Resource location. 791 ResourceLocation *string `json:"resourceLocation,omitempty"` 792 // ResourceGroup - Resource group name. 793 ResourceGroup *string `json:"resourceGroup,omitempty"` 794 // ResourceTags - List of resource tags. 795 ResourceTags *string `json:"resourceTags,omitempty"` 796 // PolicyAssignmentName - Policy assignment name. 797 PolicyAssignmentName *string `json:"policyAssignmentName,omitempty"` 798 // PolicyAssignmentOwner - Policy assignment owner. 799 PolicyAssignmentOwner *string `json:"policyAssignmentOwner,omitempty"` 800 // PolicyAssignmentParameters - Policy assignment parameters. 801 PolicyAssignmentParameters *string `json:"policyAssignmentParameters,omitempty"` 802 // PolicyAssignmentScope - Policy assignment scope. 803 PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty"` 804 // PolicyDefinitionName - Policy definition name. 805 PolicyDefinitionName *string `json:"policyDefinitionName,omitempty"` 806 // PolicyDefinitionAction - Policy definition action, i.e. effect. 807 PolicyDefinitionAction *string `json:"policyDefinitionAction,omitempty"` 808 // PolicyDefinitionCategory - Policy definition category. 809 PolicyDefinitionCategory *string `json:"policyDefinitionCategory,omitempty"` 810 // PolicySetDefinitionID - Policy set definition ID, if the policy assignment is for a policy set. 811 PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"` 812 // PolicySetDefinitionName - Policy set definition name, if the policy assignment is for a policy set. 813 PolicySetDefinitionName *string `json:"policySetDefinitionName,omitempty"` 814 // PolicySetDefinitionOwner - Policy set definition owner, if the policy assignment is for a policy set. 815 PolicySetDefinitionOwner *string `json:"policySetDefinitionOwner,omitempty"` 816 // PolicySetDefinitionCategory - Policy set definition category, if the policy assignment is for a policy set. 817 PolicySetDefinitionCategory *string `json:"policySetDefinitionCategory,omitempty"` 818 // PolicySetDefinitionParameters - Policy set definition parameters, if the policy assignment is for a policy set. 819 PolicySetDefinitionParameters *string `json:"policySetDefinitionParameters,omitempty"` 820 // ManagementGroupIds - Comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. 821 ManagementGroupIds *string `json:"managementGroupIds,omitempty"` 822 // PolicyDefinitionReferenceID - Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. 823 PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"` 824 // ComplianceState - Compliance state of the resource. 825 ComplianceState *string `json:"complianceState,omitempty"` 826 // PolicyEvaluationDetails - Policy evaluation details. 827 PolicyEvaluationDetails *PolicyEvaluationDetails `json:"policyEvaluationDetails,omitempty"` 828} 829 830// MarshalJSON is the custom marshaler for PolicyState. 831func (ps PolicyState) MarshalJSON() ([]byte, error) { 832 objectMap := make(map[string]interface{}) 833 if ps.OdataID != nil { 834 objectMap["@odata.id"] = ps.OdataID 835 } 836 if ps.OdataContext != nil { 837 objectMap["@odata.context"] = ps.OdataContext 838 } 839 if ps.Timestamp != nil { 840 objectMap["timestamp"] = ps.Timestamp 841 } 842 if ps.ResourceID != nil { 843 objectMap["resourceId"] = ps.ResourceID 844 } 845 if ps.PolicyAssignmentID != nil { 846 objectMap["policyAssignmentId"] = ps.PolicyAssignmentID 847 } 848 if ps.PolicyDefinitionID != nil { 849 objectMap["policyDefinitionId"] = ps.PolicyDefinitionID 850 } 851 if ps.EffectiveParameters != nil { 852 objectMap["effectiveParameters"] = ps.EffectiveParameters 853 } 854 if ps.IsCompliant != nil { 855 objectMap["isCompliant"] = ps.IsCompliant 856 } 857 if ps.SubscriptionID != nil { 858 objectMap["subscriptionId"] = ps.SubscriptionID 859 } 860 if ps.ResourceType != nil { 861 objectMap["resourceType"] = ps.ResourceType 862 } 863 if ps.ResourceLocation != nil { 864 objectMap["resourceLocation"] = ps.ResourceLocation 865 } 866 if ps.ResourceGroup != nil { 867 objectMap["resourceGroup"] = ps.ResourceGroup 868 } 869 if ps.ResourceTags != nil { 870 objectMap["resourceTags"] = ps.ResourceTags 871 } 872 if ps.PolicyAssignmentName != nil { 873 objectMap["policyAssignmentName"] = ps.PolicyAssignmentName 874 } 875 if ps.PolicyAssignmentOwner != nil { 876 objectMap["policyAssignmentOwner"] = ps.PolicyAssignmentOwner 877 } 878 if ps.PolicyAssignmentParameters != nil { 879 objectMap["policyAssignmentParameters"] = ps.PolicyAssignmentParameters 880 } 881 if ps.PolicyAssignmentScope != nil { 882 objectMap["policyAssignmentScope"] = ps.PolicyAssignmentScope 883 } 884 if ps.PolicyDefinitionName != nil { 885 objectMap["policyDefinitionName"] = ps.PolicyDefinitionName 886 } 887 if ps.PolicyDefinitionAction != nil { 888 objectMap["policyDefinitionAction"] = ps.PolicyDefinitionAction 889 } 890 if ps.PolicyDefinitionCategory != nil { 891 objectMap["policyDefinitionCategory"] = ps.PolicyDefinitionCategory 892 } 893 if ps.PolicySetDefinitionID != nil { 894 objectMap["policySetDefinitionId"] = ps.PolicySetDefinitionID 895 } 896 if ps.PolicySetDefinitionName != nil { 897 objectMap["policySetDefinitionName"] = ps.PolicySetDefinitionName 898 } 899 if ps.PolicySetDefinitionOwner != nil { 900 objectMap["policySetDefinitionOwner"] = ps.PolicySetDefinitionOwner 901 } 902 if ps.PolicySetDefinitionCategory != nil { 903 objectMap["policySetDefinitionCategory"] = ps.PolicySetDefinitionCategory 904 } 905 if ps.PolicySetDefinitionParameters != nil { 906 objectMap["policySetDefinitionParameters"] = ps.PolicySetDefinitionParameters 907 } 908 if ps.ManagementGroupIds != nil { 909 objectMap["managementGroupIds"] = ps.ManagementGroupIds 910 } 911 if ps.PolicyDefinitionReferenceID != nil { 912 objectMap["policyDefinitionReferenceId"] = ps.PolicyDefinitionReferenceID 913 } 914 if ps.ComplianceState != nil { 915 objectMap["complianceState"] = ps.ComplianceState 916 } 917 if ps.PolicyEvaluationDetails != nil { 918 objectMap["policyEvaluationDetails"] = ps.PolicyEvaluationDetails 919 } 920 for k, v := range ps.AdditionalProperties { 921 objectMap[k] = v 922 } 923 return json.Marshal(objectMap) 924} 925 926// UnmarshalJSON is the custom unmarshaler for PolicyState struct. 927func (ps *PolicyState) UnmarshalJSON(body []byte) error { 928 var m map[string]*json.RawMessage 929 err := json.Unmarshal(body, &m) 930 if err != nil { 931 return err 932 } 933 for k, v := range m { 934 switch k { 935 default: 936 if v != nil { 937 var additionalProperties interface{} 938 err = json.Unmarshal(*v, &additionalProperties) 939 if err != nil { 940 return err 941 } 942 if ps.AdditionalProperties == nil { 943 ps.AdditionalProperties = make(map[string]interface{}) 944 } 945 ps.AdditionalProperties[k] = additionalProperties 946 } 947 case "@odata.id": 948 if v != nil { 949 var odataID string 950 err = json.Unmarshal(*v, &odataID) 951 if err != nil { 952 return err 953 } 954 ps.OdataID = &odataID 955 } 956 case "@odata.context": 957 if v != nil { 958 var odataContext string 959 err = json.Unmarshal(*v, &odataContext) 960 if err != nil { 961 return err 962 } 963 ps.OdataContext = &odataContext 964 } 965 case "timestamp": 966 if v != nil { 967 var timestamp date.Time 968 err = json.Unmarshal(*v, ×tamp) 969 if err != nil { 970 return err 971 } 972 ps.Timestamp = ×tamp 973 } 974 case "resourceId": 975 if v != nil { 976 var resourceID string 977 err = json.Unmarshal(*v, &resourceID) 978 if err != nil { 979 return err 980 } 981 ps.ResourceID = &resourceID 982 } 983 case "policyAssignmentId": 984 if v != nil { 985 var policyAssignmentID string 986 err = json.Unmarshal(*v, &policyAssignmentID) 987 if err != nil { 988 return err 989 } 990 ps.PolicyAssignmentID = &policyAssignmentID 991 } 992 case "policyDefinitionId": 993 if v != nil { 994 var policyDefinitionID string 995 err = json.Unmarshal(*v, &policyDefinitionID) 996 if err != nil { 997 return err 998 } 999 ps.PolicyDefinitionID = &policyDefinitionID 1000 } 1001 case "effectiveParameters": 1002 if v != nil { 1003 var effectiveParameters string 1004 err = json.Unmarshal(*v, &effectiveParameters) 1005 if err != nil { 1006 return err 1007 } 1008 ps.EffectiveParameters = &effectiveParameters 1009 } 1010 case "isCompliant": 1011 if v != nil { 1012 var isCompliant bool 1013 err = json.Unmarshal(*v, &isCompliant) 1014 if err != nil { 1015 return err 1016 } 1017 ps.IsCompliant = &isCompliant 1018 } 1019 case "subscriptionId": 1020 if v != nil { 1021 var subscriptionID string 1022 err = json.Unmarshal(*v, &subscriptionID) 1023 if err != nil { 1024 return err 1025 } 1026 ps.SubscriptionID = &subscriptionID 1027 } 1028 case "resourceType": 1029 if v != nil { 1030 var resourceType string 1031 err = json.Unmarshal(*v, &resourceType) 1032 if err != nil { 1033 return err 1034 } 1035 ps.ResourceType = &resourceType 1036 } 1037 case "resourceLocation": 1038 if v != nil { 1039 var resourceLocation string 1040 err = json.Unmarshal(*v, &resourceLocation) 1041 if err != nil { 1042 return err 1043 } 1044 ps.ResourceLocation = &resourceLocation 1045 } 1046 case "resourceGroup": 1047 if v != nil { 1048 var resourceGroup string 1049 err = json.Unmarshal(*v, &resourceGroup) 1050 if err != nil { 1051 return err 1052 } 1053 ps.ResourceGroup = &resourceGroup 1054 } 1055 case "resourceTags": 1056 if v != nil { 1057 var resourceTags string 1058 err = json.Unmarshal(*v, &resourceTags) 1059 if err != nil { 1060 return err 1061 } 1062 ps.ResourceTags = &resourceTags 1063 } 1064 case "policyAssignmentName": 1065 if v != nil { 1066 var policyAssignmentName string 1067 err = json.Unmarshal(*v, &policyAssignmentName) 1068 if err != nil { 1069 return err 1070 } 1071 ps.PolicyAssignmentName = &policyAssignmentName 1072 } 1073 case "policyAssignmentOwner": 1074 if v != nil { 1075 var policyAssignmentOwner string 1076 err = json.Unmarshal(*v, &policyAssignmentOwner) 1077 if err != nil { 1078 return err 1079 } 1080 ps.PolicyAssignmentOwner = &policyAssignmentOwner 1081 } 1082 case "policyAssignmentParameters": 1083 if v != nil { 1084 var policyAssignmentParameters string 1085 err = json.Unmarshal(*v, &policyAssignmentParameters) 1086 if err != nil { 1087 return err 1088 } 1089 ps.PolicyAssignmentParameters = &policyAssignmentParameters 1090 } 1091 case "policyAssignmentScope": 1092 if v != nil { 1093 var policyAssignmentScope string 1094 err = json.Unmarshal(*v, &policyAssignmentScope) 1095 if err != nil { 1096 return err 1097 } 1098 ps.PolicyAssignmentScope = &policyAssignmentScope 1099 } 1100 case "policyDefinitionName": 1101 if v != nil { 1102 var policyDefinitionName string 1103 err = json.Unmarshal(*v, &policyDefinitionName) 1104 if err != nil { 1105 return err 1106 } 1107 ps.PolicyDefinitionName = &policyDefinitionName 1108 } 1109 case "policyDefinitionAction": 1110 if v != nil { 1111 var policyDefinitionAction string 1112 err = json.Unmarshal(*v, &policyDefinitionAction) 1113 if err != nil { 1114 return err 1115 } 1116 ps.PolicyDefinitionAction = &policyDefinitionAction 1117 } 1118 case "policyDefinitionCategory": 1119 if v != nil { 1120 var policyDefinitionCategory string 1121 err = json.Unmarshal(*v, &policyDefinitionCategory) 1122 if err != nil { 1123 return err 1124 } 1125 ps.PolicyDefinitionCategory = &policyDefinitionCategory 1126 } 1127 case "policySetDefinitionId": 1128 if v != nil { 1129 var policySetDefinitionID string 1130 err = json.Unmarshal(*v, &policySetDefinitionID) 1131 if err != nil { 1132 return err 1133 } 1134 ps.PolicySetDefinitionID = &policySetDefinitionID 1135 } 1136 case "policySetDefinitionName": 1137 if v != nil { 1138 var policySetDefinitionName string 1139 err = json.Unmarshal(*v, &policySetDefinitionName) 1140 if err != nil { 1141 return err 1142 } 1143 ps.PolicySetDefinitionName = &policySetDefinitionName 1144 } 1145 case "policySetDefinitionOwner": 1146 if v != nil { 1147 var policySetDefinitionOwner string 1148 err = json.Unmarshal(*v, &policySetDefinitionOwner) 1149 if err != nil { 1150 return err 1151 } 1152 ps.PolicySetDefinitionOwner = &policySetDefinitionOwner 1153 } 1154 case "policySetDefinitionCategory": 1155 if v != nil { 1156 var policySetDefinitionCategory string 1157 err = json.Unmarshal(*v, &policySetDefinitionCategory) 1158 if err != nil { 1159 return err 1160 } 1161 ps.PolicySetDefinitionCategory = &policySetDefinitionCategory 1162 } 1163 case "policySetDefinitionParameters": 1164 if v != nil { 1165 var policySetDefinitionParameters string 1166 err = json.Unmarshal(*v, &policySetDefinitionParameters) 1167 if err != nil { 1168 return err 1169 } 1170 ps.PolicySetDefinitionParameters = &policySetDefinitionParameters 1171 } 1172 case "managementGroupIds": 1173 if v != nil { 1174 var managementGroupIds string 1175 err = json.Unmarshal(*v, &managementGroupIds) 1176 if err != nil { 1177 return err 1178 } 1179 ps.ManagementGroupIds = &managementGroupIds 1180 } 1181 case "policyDefinitionReferenceId": 1182 if v != nil { 1183 var policyDefinitionReferenceID string 1184 err = json.Unmarshal(*v, &policyDefinitionReferenceID) 1185 if err != nil { 1186 return err 1187 } 1188 ps.PolicyDefinitionReferenceID = &policyDefinitionReferenceID 1189 } 1190 case "complianceState": 1191 if v != nil { 1192 var complianceState string 1193 err = json.Unmarshal(*v, &complianceState) 1194 if err != nil { 1195 return err 1196 } 1197 ps.ComplianceState = &complianceState 1198 } 1199 case "policyEvaluationDetails": 1200 if v != nil { 1201 var policyEvaluationDetails PolicyEvaluationDetails 1202 err = json.Unmarshal(*v, &policyEvaluationDetails) 1203 if err != nil { 1204 return err 1205 } 1206 ps.PolicyEvaluationDetails = &policyEvaluationDetails 1207 } 1208 } 1209 } 1210 1211 return nil 1212} 1213 1214// PolicyStatesQueryResults query results. 1215type PolicyStatesQueryResults struct { 1216 autorest.Response `json:"-"` 1217 // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. 1218 OdataContext *string `json:"@odata.context,omitempty"` 1219 // OdataCount - OData entity count; represents the number of policy state records returned. 1220 OdataCount *int32 `json:"@odata.count,omitempty"` 1221 // OdataNextLink - Odata next link; URL to get the next set of results. 1222 OdataNextLink *string `json:"@odata.nextLink,omitempty"` 1223 // Value - Query results. 1224 Value *[]PolicyState `json:"value,omitempty"` 1225} 1226 1227// PolicyStatesQueryResultsIterator provides access to a complete listing of PolicyState values. 1228type PolicyStatesQueryResultsIterator struct { 1229 i int 1230 page PolicyStatesQueryResultsPage 1231} 1232 1233// NextWithContext advances to the next value. If there was an error making 1234// the request the iterator does not advance and the error is returned. 1235func (iter *PolicyStatesQueryResultsIterator) NextWithContext(ctx context.Context) (err error) { 1236 if tracing.IsEnabled() { 1237 ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesQueryResultsIterator.NextWithContext") 1238 defer func() { 1239 sc := -1 1240 if iter.Response().Response.Response != nil { 1241 sc = iter.Response().Response.Response.StatusCode 1242 } 1243 tracing.EndSpan(ctx, sc, err) 1244 }() 1245 } 1246 iter.i++ 1247 if iter.i < len(iter.page.Values()) { 1248 return nil 1249 } 1250 err = iter.page.NextWithContext(ctx) 1251 if err != nil { 1252 iter.i-- 1253 return err 1254 } 1255 iter.i = 0 1256 return nil 1257} 1258 1259// Next advances to the next value. If there was an error making 1260// the request the iterator does not advance and the error is returned. 1261// Deprecated: Use NextWithContext() instead. 1262func (iter *PolicyStatesQueryResultsIterator) Next() error { 1263 return iter.NextWithContext(context.Background()) 1264} 1265 1266// NotDone returns true if the enumeration should be started or is not yet complete. 1267func (iter PolicyStatesQueryResultsIterator) NotDone() bool { 1268 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1269} 1270 1271// Response returns the raw server response from the last page request. 1272func (iter PolicyStatesQueryResultsIterator) Response() PolicyStatesQueryResults { 1273 return iter.page.Response() 1274} 1275 1276// Value returns the current value or a zero-initialized value if the 1277// iterator has advanced beyond the end of the collection. 1278func (iter PolicyStatesQueryResultsIterator) Value() PolicyState { 1279 if !iter.page.NotDone() { 1280 return PolicyState{} 1281 } 1282 return iter.page.Values()[iter.i] 1283} 1284 1285// Creates a new instance of the PolicyStatesQueryResultsIterator type. 1286func NewPolicyStatesQueryResultsIterator(page PolicyStatesQueryResultsPage) PolicyStatesQueryResultsIterator { 1287 return PolicyStatesQueryResultsIterator{page: page} 1288} 1289 1290// IsEmpty returns true if the ListResult contains no values. 1291func (psqr PolicyStatesQueryResults) IsEmpty() bool { 1292 return psqr.Value == nil || len(*psqr.Value) == 0 1293} 1294 1295// hasNextLink returns true if the NextLink is not empty. 1296func (psqr PolicyStatesQueryResults) hasNextLink() bool { 1297 return psqr.OdataNextLink != nil && len(*psqr.OdataNextLink) != 0 1298} 1299 1300// policyStatesQueryResultsPreparer prepares a request to retrieve the next set of results. 1301// It returns nil if no more results exist. 1302func (psqr PolicyStatesQueryResults) policyStatesQueryResultsPreparer(ctx context.Context) (*http.Request, error) { 1303 if !psqr.hasNextLink() { 1304 return nil, nil 1305 } 1306 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1307 autorest.AsJSON(), 1308 autorest.AsGet(), 1309 autorest.WithBaseURL(to.String(psqr.OdataNextLink))) 1310} 1311 1312// PolicyStatesQueryResultsPage contains a page of PolicyState values. 1313type PolicyStatesQueryResultsPage struct { 1314 fn func(context.Context, PolicyStatesQueryResults) (PolicyStatesQueryResults, error) 1315 psqr PolicyStatesQueryResults 1316} 1317 1318// NextWithContext advances to the next page of values. If there was an error making 1319// the request the page does not advance and the error is returned. 1320func (page *PolicyStatesQueryResultsPage) NextWithContext(ctx context.Context) (err error) { 1321 if tracing.IsEnabled() { 1322 ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesQueryResultsPage.NextWithContext") 1323 defer func() { 1324 sc := -1 1325 if page.Response().Response.Response != nil { 1326 sc = page.Response().Response.Response.StatusCode 1327 } 1328 tracing.EndSpan(ctx, sc, err) 1329 }() 1330 } 1331 for { 1332 next, err := page.fn(ctx, page.psqr) 1333 if err != nil { 1334 return err 1335 } 1336 page.psqr = next 1337 if !next.hasNextLink() || !next.IsEmpty() { 1338 break 1339 } 1340 } 1341 return nil 1342} 1343 1344// Next advances to the next page of values. If there was an error making 1345// the request the page does not advance and the error is returned. 1346// Deprecated: Use NextWithContext() instead. 1347func (page *PolicyStatesQueryResultsPage) Next() error { 1348 return page.NextWithContext(context.Background()) 1349} 1350 1351// NotDone returns true if the page enumeration should be started or is not yet complete. 1352func (page PolicyStatesQueryResultsPage) NotDone() bool { 1353 return !page.psqr.IsEmpty() 1354} 1355 1356// Response returns the raw server response from the last page request. 1357func (page PolicyStatesQueryResultsPage) Response() PolicyStatesQueryResults { 1358 return page.psqr 1359} 1360 1361// Values returns the slice of values for the current page or nil if there are no values. 1362func (page PolicyStatesQueryResultsPage) Values() []PolicyState { 1363 if page.psqr.IsEmpty() { 1364 return nil 1365 } 1366 return *page.psqr.Value 1367} 1368 1369// Creates a new instance of the PolicyStatesQueryResultsPage type. 1370func NewPolicyStatesQueryResultsPage(cur PolicyStatesQueryResults, getNextPage func(context.Context, PolicyStatesQueryResults) (PolicyStatesQueryResults, error)) PolicyStatesQueryResultsPage { 1371 return PolicyStatesQueryResultsPage{ 1372 fn: getNextPage, 1373 psqr: cur, 1374 } 1375} 1376 1377// PolicyTrackedResource policy tracked resource record. 1378type PolicyTrackedResource struct { 1379 // TrackedResourceID - READ-ONLY; The ID of the policy tracked resource. 1380 TrackedResourceID *string `json:"trackedResourceId,omitempty"` 1381 // PolicyDetails - READ-ONLY; The details of the policy that require the tracked resource. 1382 PolicyDetails *PolicyDetails `json:"policyDetails,omitempty"` 1383 // CreatedBy - READ-ONLY; The details of the policy triggered deployment that created the tracked resource. 1384 CreatedBy *TrackedResourceModificationDetails `json:"createdBy,omitempty"` 1385 // LastModifiedBy - READ-ONLY; The details of the policy triggered deployment that modified the tracked resource. 1386 LastModifiedBy *TrackedResourceModificationDetails `json:"lastModifiedBy,omitempty"` 1387 // LastUpdateUtc - READ-ONLY; Timestamp of the last update to the tracked resource. 1388 LastUpdateUtc *date.Time `json:"lastUpdateUtc,omitempty"` 1389} 1390 1391// MarshalJSON is the custom marshaler for PolicyTrackedResource. 1392func (ptr PolicyTrackedResource) MarshalJSON() ([]byte, error) { 1393 objectMap := make(map[string]interface{}) 1394 return json.Marshal(objectMap) 1395} 1396 1397// PolicyTrackedResourcesQueryResults query results. 1398type PolicyTrackedResourcesQueryResults struct { 1399 autorest.Response `json:"-"` 1400 // Value - READ-ONLY; Query results. 1401 Value *[]PolicyTrackedResource `json:"value,omitempty"` 1402 // NextLink - READ-ONLY; The URL to get the next set of results. 1403 NextLink *string `json:"nextLink,omitempty"` 1404} 1405 1406// MarshalJSON is the custom marshaler for PolicyTrackedResourcesQueryResults. 1407func (ptrqr PolicyTrackedResourcesQueryResults) MarshalJSON() ([]byte, error) { 1408 objectMap := make(map[string]interface{}) 1409 return json.Marshal(objectMap) 1410} 1411 1412// PolicyTrackedResourcesQueryResultsIterator provides access to a complete listing of 1413// PolicyTrackedResource values. 1414type PolicyTrackedResourcesQueryResultsIterator struct { 1415 i int 1416 page PolicyTrackedResourcesQueryResultsPage 1417} 1418 1419// NextWithContext advances to the next value. If there was an error making 1420// the request the iterator does not advance and the error is returned. 1421func (iter *PolicyTrackedResourcesQueryResultsIterator) NextWithContext(ctx context.Context) (err error) { 1422 if tracing.IsEnabled() { 1423 ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesQueryResultsIterator.NextWithContext") 1424 defer func() { 1425 sc := -1 1426 if iter.Response().Response.Response != nil { 1427 sc = iter.Response().Response.Response.StatusCode 1428 } 1429 tracing.EndSpan(ctx, sc, err) 1430 }() 1431 } 1432 iter.i++ 1433 if iter.i < len(iter.page.Values()) { 1434 return nil 1435 } 1436 err = iter.page.NextWithContext(ctx) 1437 if err != nil { 1438 iter.i-- 1439 return err 1440 } 1441 iter.i = 0 1442 return nil 1443} 1444 1445// Next advances to the next value. If there was an error making 1446// the request the iterator does not advance and the error is returned. 1447// Deprecated: Use NextWithContext() instead. 1448func (iter *PolicyTrackedResourcesQueryResultsIterator) Next() error { 1449 return iter.NextWithContext(context.Background()) 1450} 1451 1452// NotDone returns true if the enumeration should be started or is not yet complete. 1453func (iter PolicyTrackedResourcesQueryResultsIterator) NotDone() bool { 1454 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1455} 1456 1457// Response returns the raw server response from the last page request. 1458func (iter PolicyTrackedResourcesQueryResultsIterator) Response() PolicyTrackedResourcesQueryResults { 1459 return iter.page.Response() 1460} 1461 1462// Value returns the current value or a zero-initialized value if the 1463// iterator has advanced beyond the end of the collection. 1464func (iter PolicyTrackedResourcesQueryResultsIterator) Value() PolicyTrackedResource { 1465 if !iter.page.NotDone() { 1466 return PolicyTrackedResource{} 1467 } 1468 return iter.page.Values()[iter.i] 1469} 1470 1471// Creates a new instance of the PolicyTrackedResourcesQueryResultsIterator type. 1472func NewPolicyTrackedResourcesQueryResultsIterator(page PolicyTrackedResourcesQueryResultsPage) PolicyTrackedResourcesQueryResultsIterator { 1473 return PolicyTrackedResourcesQueryResultsIterator{page: page} 1474} 1475 1476// IsEmpty returns true if the ListResult contains no values. 1477func (ptrqr PolicyTrackedResourcesQueryResults) IsEmpty() bool { 1478 return ptrqr.Value == nil || len(*ptrqr.Value) == 0 1479} 1480 1481// hasNextLink returns true if the NextLink is not empty. 1482func (ptrqr PolicyTrackedResourcesQueryResults) hasNextLink() bool { 1483 return ptrqr.NextLink != nil && len(*ptrqr.NextLink) != 0 1484} 1485 1486// policyTrackedResourcesQueryResultsPreparer prepares a request to retrieve the next set of results. 1487// It returns nil if no more results exist. 1488func (ptrqr PolicyTrackedResourcesQueryResults) policyTrackedResourcesQueryResultsPreparer(ctx context.Context) (*http.Request, error) { 1489 if !ptrqr.hasNextLink() { 1490 return nil, nil 1491 } 1492 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1493 autorest.AsJSON(), 1494 autorest.AsGet(), 1495 autorest.WithBaseURL(to.String(ptrqr.NextLink))) 1496} 1497 1498// PolicyTrackedResourcesQueryResultsPage contains a page of PolicyTrackedResource values. 1499type PolicyTrackedResourcesQueryResultsPage struct { 1500 fn func(context.Context, PolicyTrackedResourcesQueryResults) (PolicyTrackedResourcesQueryResults, error) 1501 ptrqr PolicyTrackedResourcesQueryResults 1502} 1503 1504// NextWithContext advances to the next page of values. If there was an error making 1505// the request the page does not advance and the error is returned. 1506func (page *PolicyTrackedResourcesQueryResultsPage) NextWithContext(ctx context.Context) (err error) { 1507 if tracing.IsEnabled() { 1508 ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesQueryResultsPage.NextWithContext") 1509 defer func() { 1510 sc := -1 1511 if page.Response().Response.Response != nil { 1512 sc = page.Response().Response.Response.StatusCode 1513 } 1514 tracing.EndSpan(ctx, sc, err) 1515 }() 1516 } 1517 for { 1518 next, err := page.fn(ctx, page.ptrqr) 1519 if err != nil { 1520 return err 1521 } 1522 page.ptrqr = next 1523 if !next.hasNextLink() || !next.IsEmpty() { 1524 break 1525 } 1526 } 1527 return nil 1528} 1529 1530// Next advances to the next page of values. If there was an error making 1531// the request the page does not advance and the error is returned. 1532// Deprecated: Use NextWithContext() instead. 1533func (page *PolicyTrackedResourcesQueryResultsPage) Next() error { 1534 return page.NextWithContext(context.Background()) 1535} 1536 1537// NotDone returns true if the page enumeration should be started or is not yet complete. 1538func (page PolicyTrackedResourcesQueryResultsPage) NotDone() bool { 1539 return !page.ptrqr.IsEmpty() 1540} 1541 1542// Response returns the raw server response from the last page request. 1543func (page PolicyTrackedResourcesQueryResultsPage) Response() PolicyTrackedResourcesQueryResults { 1544 return page.ptrqr 1545} 1546 1547// Values returns the slice of values for the current page or nil if there are no values. 1548func (page PolicyTrackedResourcesQueryResultsPage) Values() []PolicyTrackedResource { 1549 if page.ptrqr.IsEmpty() { 1550 return nil 1551 } 1552 return *page.ptrqr.Value 1553} 1554 1555// Creates a new instance of the PolicyTrackedResourcesQueryResultsPage type. 1556func NewPolicyTrackedResourcesQueryResultsPage(cur PolicyTrackedResourcesQueryResults, getNextPage func(context.Context, PolicyTrackedResourcesQueryResults) (PolicyTrackedResourcesQueryResults, error)) PolicyTrackedResourcesQueryResultsPage { 1557 return PolicyTrackedResourcesQueryResultsPage{ 1558 fn: getNextPage, 1559 ptrqr: cur, 1560 } 1561} 1562 1563// QueryFailure error response. 1564type QueryFailure struct { 1565 // Error - Error definition. 1566 Error *QueryFailureError `json:"error,omitempty"` 1567} 1568 1569// QueryFailureError error definition. 1570type QueryFailureError struct { 1571 // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. 1572 Code *string `json:"code,omitempty"` 1573 // Message - READ-ONLY; Description of the error. 1574 Message *string `json:"message,omitempty"` 1575} 1576 1577// MarshalJSON is the custom marshaler for QueryFailureError. 1578func (qf QueryFailureError) MarshalJSON() ([]byte, error) { 1579 objectMap := make(map[string]interface{}) 1580 return json.Marshal(objectMap) 1581} 1582 1583// Remediation the remediation definition. 1584type Remediation struct { 1585 autorest.Response `json:"-"` 1586 // RemediationProperties - Properties for the remediation. 1587 *RemediationProperties `json:"properties,omitempty"` 1588 // ID - READ-ONLY; The ID of the remediation. 1589 ID *string `json:"id,omitempty"` 1590 // Type - READ-ONLY; The type of the remediation. 1591 Type *string `json:"type,omitempty"` 1592 // Name - READ-ONLY; The name of the remediation. 1593 Name *string `json:"name,omitempty"` 1594} 1595 1596// MarshalJSON is the custom marshaler for Remediation. 1597func (r Remediation) MarshalJSON() ([]byte, error) { 1598 objectMap := make(map[string]interface{}) 1599 if r.RemediationProperties != nil { 1600 objectMap["properties"] = r.RemediationProperties 1601 } 1602 return json.Marshal(objectMap) 1603} 1604 1605// UnmarshalJSON is the custom unmarshaler for Remediation struct. 1606func (r *Remediation) UnmarshalJSON(body []byte) error { 1607 var m map[string]*json.RawMessage 1608 err := json.Unmarshal(body, &m) 1609 if err != nil { 1610 return err 1611 } 1612 for k, v := range m { 1613 switch k { 1614 case "properties": 1615 if v != nil { 1616 var remediationProperties RemediationProperties 1617 err = json.Unmarshal(*v, &remediationProperties) 1618 if err != nil { 1619 return err 1620 } 1621 r.RemediationProperties = &remediationProperties 1622 } 1623 case "id": 1624 if v != nil { 1625 var ID string 1626 err = json.Unmarshal(*v, &ID) 1627 if err != nil { 1628 return err 1629 } 1630 r.ID = &ID 1631 } 1632 case "type": 1633 if v != nil { 1634 var typeVar string 1635 err = json.Unmarshal(*v, &typeVar) 1636 if err != nil { 1637 return err 1638 } 1639 r.Type = &typeVar 1640 } 1641 case "name": 1642 if v != nil { 1643 var name string 1644 err = json.Unmarshal(*v, &name) 1645 if err != nil { 1646 return err 1647 } 1648 r.Name = &name 1649 } 1650 } 1651 } 1652 1653 return nil 1654} 1655 1656// RemediationDeployment details of a single deployment created by the remediation. 1657type RemediationDeployment struct { 1658 // RemediatedResourceID - READ-ONLY; Resource ID of the resource that is being remediated by the deployment. 1659 RemediatedResourceID *string `json:"remediatedResourceId,omitempty"` 1660 // DeploymentID - READ-ONLY; Resource ID of the template deployment that will remediate the resource. 1661 DeploymentID *string `json:"deploymentId,omitempty"` 1662 // Status - READ-ONLY; Status of the remediation deployment. 1663 Status *string `json:"status,omitempty"` 1664 // ResourceLocation - READ-ONLY; Location of the resource that is being remediated. 1665 ResourceLocation *string `json:"resourceLocation,omitempty"` 1666 // Error - READ-ONLY; Error encountered while remediated the resource. 1667 Error *ErrorDefinition `json:"error,omitempty"` 1668 // CreatedOn - READ-ONLY; The time at which the remediation was created. 1669 CreatedOn *date.Time `json:"createdOn,omitempty"` 1670 // LastUpdatedOn - READ-ONLY; The time at which the remediation deployment was last updated. 1671 LastUpdatedOn *date.Time `json:"lastUpdatedOn,omitempty"` 1672} 1673 1674// MarshalJSON is the custom marshaler for RemediationDeployment. 1675func (rd RemediationDeployment) MarshalJSON() ([]byte, error) { 1676 objectMap := make(map[string]interface{}) 1677 return json.Marshal(objectMap) 1678} 1679 1680// RemediationDeploymentsListResult list of deployments for a remediation. 1681type RemediationDeploymentsListResult struct { 1682 autorest.Response `json:"-"` 1683 // Value - READ-ONLY; Array of deployments for the remediation. 1684 Value *[]RemediationDeployment `json:"value,omitempty"` 1685 // NextLink - READ-ONLY; The URL to get the next set of results. 1686 NextLink *string `json:"nextLink,omitempty"` 1687} 1688 1689// MarshalJSON is the custom marshaler for RemediationDeploymentsListResult. 1690func (rdlr RemediationDeploymentsListResult) MarshalJSON() ([]byte, error) { 1691 objectMap := make(map[string]interface{}) 1692 return json.Marshal(objectMap) 1693} 1694 1695// RemediationDeploymentsListResultIterator provides access to a complete listing of RemediationDeployment 1696// values. 1697type RemediationDeploymentsListResultIterator struct { 1698 i int 1699 page RemediationDeploymentsListResultPage 1700} 1701 1702// NextWithContext advances to the next value. If there was an error making 1703// the request the iterator does not advance and the error is returned. 1704func (iter *RemediationDeploymentsListResultIterator) NextWithContext(ctx context.Context) (err error) { 1705 if tracing.IsEnabled() { 1706 ctx = tracing.StartSpan(ctx, fqdn+"/RemediationDeploymentsListResultIterator.NextWithContext") 1707 defer func() { 1708 sc := -1 1709 if iter.Response().Response.Response != nil { 1710 sc = iter.Response().Response.Response.StatusCode 1711 } 1712 tracing.EndSpan(ctx, sc, err) 1713 }() 1714 } 1715 iter.i++ 1716 if iter.i < len(iter.page.Values()) { 1717 return nil 1718 } 1719 err = iter.page.NextWithContext(ctx) 1720 if err != nil { 1721 iter.i-- 1722 return err 1723 } 1724 iter.i = 0 1725 return nil 1726} 1727 1728// Next advances to the next value. If there was an error making 1729// the request the iterator does not advance and the error is returned. 1730// Deprecated: Use NextWithContext() instead. 1731func (iter *RemediationDeploymentsListResultIterator) Next() error { 1732 return iter.NextWithContext(context.Background()) 1733} 1734 1735// NotDone returns true if the enumeration should be started or is not yet complete. 1736func (iter RemediationDeploymentsListResultIterator) NotDone() bool { 1737 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1738} 1739 1740// Response returns the raw server response from the last page request. 1741func (iter RemediationDeploymentsListResultIterator) Response() RemediationDeploymentsListResult { 1742 return iter.page.Response() 1743} 1744 1745// Value returns the current value or a zero-initialized value if the 1746// iterator has advanced beyond the end of the collection. 1747func (iter RemediationDeploymentsListResultIterator) Value() RemediationDeployment { 1748 if !iter.page.NotDone() { 1749 return RemediationDeployment{} 1750 } 1751 return iter.page.Values()[iter.i] 1752} 1753 1754// Creates a new instance of the RemediationDeploymentsListResultIterator type. 1755func NewRemediationDeploymentsListResultIterator(page RemediationDeploymentsListResultPage) RemediationDeploymentsListResultIterator { 1756 return RemediationDeploymentsListResultIterator{page: page} 1757} 1758 1759// IsEmpty returns true if the ListResult contains no values. 1760func (rdlr RemediationDeploymentsListResult) IsEmpty() bool { 1761 return rdlr.Value == nil || len(*rdlr.Value) == 0 1762} 1763 1764// hasNextLink returns true if the NextLink is not empty. 1765func (rdlr RemediationDeploymentsListResult) hasNextLink() bool { 1766 return rdlr.NextLink != nil && len(*rdlr.NextLink) != 0 1767} 1768 1769// remediationDeploymentsListResultPreparer prepares a request to retrieve the next set of results. 1770// It returns nil if no more results exist. 1771func (rdlr RemediationDeploymentsListResult) remediationDeploymentsListResultPreparer(ctx context.Context) (*http.Request, error) { 1772 if !rdlr.hasNextLink() { 1773 return nil, nil 1774 } 1775 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1776 autorest.AsJSON(), 1777 autorest.AsGet(), 1778 autorest.WithBaseURL(to.String(rdlr.NextLink))) 1779} 1780 1781// RemediationDeploymentsListResultPage contains a page of RemediationDeployment values. 1782type RemediationDeploymentsListResultPage struct { 1783 fn func(context.Context, RemediationDeploymentsListResult) (RemediationDeploymentsListResult, error) 1784 rdlr RemediationDeploymentsListResult 1785} 1786 1787// NextWithContext advances to the next page of values. If there was an error making 1788// the request the page does not advance and the error is returned. 1789func (page *RemediationDeploymentsListResultPage) NextWithContext(ctx context.Context) (err error) { 1790 if tracing.IsEnabled() { 1791 ctx = tracing.StartSpan(ctx, fqdn+"/RemediationDeploymentsListResultPage.NextWithContext") 1792 defer func() { 1793 sc := -1 1794 if page.Response().Response.Response != nil { 1795 sc = page.Response().Response.Response.StatusCode 1796 } 1797 tracing.EndSpan(ctx, sc, err) 1798 }() 1799 } 1800 for { 1801 next, err := page.fn(ctx, page.rdlr) 1802 if err != nil { 1803 return err 1804 } 1805 page.rdlr = next 1806 if !next.hasNextLink() || !next.IsEmpty() { 1807 break 1808 } 1809 } 1810 return nil 1811} 1812 1813// Next advances to the next page of values. If there was an error making 1814// the request the page does not advance and the error is returned. 1815// Deprecated: Use NextWithContext() instead. 1816func (page *RemediationDeploymentsListResultPage) Next() error { 1817 return page.NextWithContext(context.Background()) 1818} 1819 1820// NotDone returns true if the page enumeration should be started or is not yet complete. 1821func (page RemediationDeploymentsListResultPage) NotDone() bool { 1822 return !page.rdlr.IsEmpty() 1823} 1824 1825// Response returns the raw server response from the last page request. 1826func (page RemediationDeploymentsListResultPage) Response() RemediationDeploymentsListResult { 1827 return page.rdlr 1828} 1829 1830// Values returns the slice of values for the current page or nil if there are no values. 1831func (page RemediationDeploymentsListResultPage) Values() []RemediationDeployment { 1832 if page.rdlr.IsEmpty() { 1833 return nil 1834 } 1835 return *page.rdlr.Value 1836} 1837 1838// Creates a new instance of the RemediationDeploymentsListResultPage type. 1839func NewRemediationDeploymentsListResultPage(cur RemediationDeploymentsListResult, getNextPage func(context.Context, RemediationDeploymentsListResult) (RemediationDeploymentsListResult, error)) RemediationDeploymentsListResultPage { 1840 return RemediationDeploymentsListResultPage{ 1841 fn: getNextPage, 1842 rdlr: cur, 1843 } 1844} 1845 1846// RemediationDeploymentSummary the deployment status summary for all deployments created by the 1847// remediation. 1848type RemediationDeploymentSummary struct { 1849 // TotalDeployments - The number of deployments required by the remediation. 1850 TotalDeployments *int32 `json:"totalDeployments,omitempty"` 1851 // SuccessfulDeployments - The number of deployments required by the remediation that have succeeded. 1852 SuccessfulDeployments *int32 `json:"successfulDeployments,omitempty"` 1853 // FailedDeployments - The number of deployments required by the remediation that have failed. 1854 FailedDeployments *int32 `json:"failedDeployments,omitempty"` 1855} 1856 1857// RemediationFilters the filters that will be applied to determine which resources to remediate. 1858type RemediationFilters struct { 1859 // Locations - The resource locations that will be remediated. 1860 Locations *[]string `json:"locations,omitempty"` 1861} 1862 1863// RemediationListResult list of remediations. 1864type RemediationListResult struct { 1865 autorest.Response `json:"-"` 1866 // Value - READ-ONLY; Array of remediation definitions. 1867 Value *[]Remediation `json:"value,omitempty"` 1868 // NextLink - READ-ONLY; The URL to get the next set of results. 1869 NextLink *string `json:"nextLink,omitempty"` 1870} 1871 1872// MarshalJSON is the custom marshaler for RemediationListResult. 1873func (rlr RemediationListResult) MarshalJSON() ([]byte, error) { 1874 objectMap := make(map[string]interface{}) 1875 return json.Marshal(objectMap) 1876} 1877 1878// RemediationListResultIterator provides access to a complete listing of Remediation values. 1879type RemediationListResultIterator struct { 1880 i int 1881 page RemediationListResultPage 1882} 1883 1884// NextWithContext advances to the next value. If there was an error making 1885// the request the iterator does not advance and the error is returned. 1886func (iter *RemediationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1887 if tracing.IsEnabled() { 1888 ctx = tracing.StartSpan(ctx, fqdn+"/RemediationListResultIterator.NextWithContext") 1889 defer func() { 1890 sc := -1 1891 if iter.Response().Response.Response != nil { 1892 sc = iter.Response().Response.Response.StatusCode 1893 } 1894 tracing.EndSpan(ctx, sc, err) 1895 }() 1896 } 1897 iter.i++ 1898 if iter.i < len(iter.page.Values()) { 1899 return nil 1900 } 1901 err = iter.page.NextWithContext(ctx) 1902 if err != nil { 1903 iter.i-- 1904 return err 1905 } 1906 iter.i = 0 1907 return nil 1908} 1909 1910// Next advances to the next value. If there was an error making 1911// the request the iterator does not advance and the error is returned. 1912// Deprecated: Use NextWithContext() instead. 1913func (iter *RemediationListResultIterator) Next() error { 1914 return iter.NextWithContext(context.Background()) 1915} 1916 1917// NotDone returns true if the enumeration should be started or is not yet complete. 1918func (iter RemediationListResultIterator) NotDone() bool { 1919 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1920} 1921 1922// Response returns the raw server response from the last page request. 1923func (iter RemediationListResultIterator) Response() RemediationListResult { 1924 return iter.page.Response() 1925} 1926 1927// Value returns the current value or a zero-initialized value if the 1928// iterator has advanced beyond the end of the collection. 1929func (iter RemediationListResultIterator) Value() Remediation { 1930 if !iter.page.NotDone() { 1931 return Remediation{} 1932 } 1933 return iter.page.Values()[iter.i] 1934} 1935 1936// Creates a new instance of the RemediationListResultIterator type. 1937func NewRemediationListResultIterator(page RemediationListResultPage) RemediationListResultIterator { 1938 return RemediationListResultIterator{page: page} 1939} 1940 1941// IsEmpty returns true if the ListResult contains no values. 1942func (rlr RemediationListResult) IsEmpty() bool { 1943 return rlr.Value == nil || len(*rlr.Value) == 0 1944} 1945 1946// hasNextLink returns true if the NextLink is not empty. 1947func (rlr RemediationListResult) hasNextLink() bool { 1948 return rlr.NextLink != nil && len(*rlr.NextLink) != 0 1949} 1950 1951// remediationListResultPreparer prepares a request to retrieve the next set of results. 1952// It returns nil if no more results exist. 1953func (rlr RemediationListResult) remediationListResultPreparer(ctx context.Context) (*http.Request, error) { 1954 if !rlr.hasNextLink() { 1955 return nil, nil 1956 } 1957 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1958 autorest.AsJSON(), 1959 autorest.AsGet(), 1960 autorest.WithBaseURL(to.String(rlr.NextLink))) 1961} 1962 1963// RemediationListResultPage contains a page of Remediation values. 1964type RemediationListResultPage struct { 1965 fn func(context.Context, RemediationListResult) (RemediationListResult, error) 1966 rlr RemediationListResult 1967} 1968 1969// NextWithContext advances to the next page of values. If there was an error making 1970// the request the page does not advance and the error is returned. 1971func (page *RemediationListResultPage) NextWithContext(ctx context.Context) (err error) { 1972 if tracing.IsEnabled() { 1973 ctx = tracing.StartSpan(ctx, fqdn+"/RemediationListResultPage.NextWithContext") 1974 defer func() { 1975 sc := -1 1976 if page.Response().Response.Response != nil { 1977 sc = page.Response().Response.Response.StatusCode 1978 } 1979 tracing.EndSpan(ctx, sc, err) 1980 }() 1981 } 1982 for { 1983 next, err := page.fn(ctx, page.rlr) 1984 if err != nil { 1985 return err 1986 } 1987 page.rlr = next 1988 if !next.hasNextLink() || !next.IsEmpty() { 1989 break 1990 } 1991 } 1992 return nil 1993} 1994 1995// Next advances to the next page of values. If there was an error making 1996// the request the page does not advance and the error is returned. 1997// Deprecated: Use NextWithContext() instead. 1998func (page *RemediationListResultPage) Next() error { 1999 return page.NextWithContext(context.Background()) 2000} 2001 2002// NotDone returns true if the page enumeration should be started or is not yet complete. 2003func (page RemediationListResultPage) NotDone() bool { 2004 return !page.rlr.IsEmpty() 2005} 2006 2007// Response returns the raw server response from the last page request. 2008func (page RemediationListResultPage) Response() RemediationListResult { 2009 return page.rlr 2010} 2011 2012// Values returns the slice of values for the current page or nil if there are no values. 2013func (page RemediationListResultPage) Values() []Remediation { 2014 if page.rlr.IsEmpty() { 2015 return nil 2016 } 2017 return *page.rlr.Value 2018} 2019 2020// Creates a new instance of the RemediationListResultPage type. 2021func NewRemediationListResultPage(cur RemediationListResult, getNextPage func(context.Context, RemediationListResult) (RemediationListResult, error)) RemediationListResultPage { 2022 return RemediationListResultPage{ 2023 fn: getNextPage, 2024 rlr: cur, 2025 } 2026} 2027 2028// RemediationProperties the remediation properties. 2029type RemediationProperties struct { 2030 // PolicyAssignmentID - The resource ID of the policy assignment that should be remediated. 2031 PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"` 2032 // PolicyDefinitionReferenceID - The policy definition reference ID of the individual definition that should be remediated. Required when the policy assignment being remediated assigns a policy set definition. 2033 PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"` 2034 // ProvisioningState - READ-ONLY; The status of the remediation. 2035 ProvisioningState *string `json:"provisioningState,omitempty"` 2036 // CreatedOn - READ-ONLY; The time at which the remediation was created. 2037 CreatedOn *date.Time `json:"createdOn,omitempty"` 2038 // LastUpdatedOn - READ-ONLY; The time at which the remediation was last updated. 2039 LastUpdatedOn *date.Time `json:"lastUpdatedOn,omitempty"` 2040 // Filters - The filters that will be applied to determine which resources to remediate. 2041 Filters *RemediationFilters `json:"filters,omitempty"` 2042 // DeploymentStatus - The deployment status summary for all deployments created by the remediation. 2043 DeploymentStatus *RemediationDeploymentSummary `json:"deploymentStatus,omitempty"` 2044} 2045 2046// MarshalJSON is the custom marshaler for RemediationProperties. 2047func (rp RemediationProperties) MarshalJSON() ([]byte, error) { 2048 objectMap := make(map[string]interface{}) 2049 if rp.PolicyAssignmentID != nil { 2050 objectMap["policyAssignmentId"] = rp.PolicyAssignmentID 2051 } 2052 if rp.PolicyDefinitionReferenceID != nil { 2053 objectMap["policyDefinitionReferenceId"] = rp.PolicyDefinitionReferenceID 2054 } 2055 if rp.Filters != nil { 2056 objectMap["filters"] = rp.Filters 2057 } 2058 if rp.DeploymentStatus != nil { 2059 objectMap["deploymentStatus"] = rp.DeploymentStatus 2060 } 2061 return json.Marshal(objectMap) 2062} 2063 2064// String ... 2065type String struct { 2066 autorest.Response `json:"-"` 2067 Value *string `json:"value,omitempty"` 2068} 2069 2070// SummarizeResults summarize action results. 2071type SummarizeResults struct { 2072 autorest.Response `json:"-"` 2073 // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. 2074 OdataContext *string `json:"@odata.context,omitempty"` 2075 // OdataCount - OData entity count; represents the number of summaries returned; always set to 1. 2076 OdataCount *int32 `json:"@odata.count,omitempty"` 2077 // Value - Summarize action results. 2078 Value *[]Summary `json:"value,omitempty"` 2079} 2080 2081// Summary summary results. 2082type Summary struct { 2083 // OdataID - OData entity ID; always set to null since summaries do not have an entity ID. 2084 OdataID *string `json:"@odata.id,omitempty"` 2085 // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. 2086 OdataContext *string `json:"@odata.context,omitempty"` 2087 // Results - Non-compliance summary for all policy assignments. 2088 Results *SummaryResults `json:"results,omitempty"` 2089 // PolicyAssignments - Policy assignments summary. 2090 PolicyAssignments *[]PolicyAssignmentSummary `json:"policyAssignments,omitempty"` 2091} 2092 2093// SummaryResults non-compliance summary on a particular summary level. 2094type SummaryResults struct { 2095 // QueryResultsURI - HTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the non-compliance summary. 2096 QueryResultsURI *string `json:"queryResultsUri,omitempty"` 2097 // NonCompliantResources - Number of non-compliant resources. 2098 NonCompliantResources *int32 `json:"nonCompliantResources,omitempty"` 2099 // NonCompliantPolicies - Number of non-compliant policies. 2100 NonCompliantPolicies *int32 `json:"nonCompliantPolicies,omitempty"` 2101} 2102 2103// TrackedResourceModificationDetails the details of the policy triggered deployment that created or 2104// modified the tracked resource. 2105type TrackedResourceModificationDetails struct { 2106 // PolicyDetails - READ-ONLY; The details of the policy that created or modified the tracked resource. 2107 PolicyDetails *PolicyDetails `json:"policyDetails,omitempty"` 2108 // DeploymentID - READ-ONLY; The ID of the deployment that created or modified the tracked resource. 2109 DeploymentID *string `json:"deploymentId,omitempty"` 2110 // DeploymentTime - READ-ONLY; Timestamp of the deployment that created or modified the tracked resource. 2111 DeploymentTime *date.Time `json:"deploymentTime,omitempty"` 2112} 2113 2114// MarshalJSON is the custom marshaler for TrackedResourceModificationDetails. 2115func (trmd TrackedResourceModificationDetails) MarshalJSON() ([]byte, error) { 2116 objectMap := make(map[string]interface{}) 2117 return json.Marshal(objectMap) 2118} 2119 2120// TypedErrorInfo scenario specific error details. 2121type TypedErrorInfo struct { 2122 // Type - READ-ONLY; The type of included error details. 2123 Type *string `json:"type,omitempty"` 2124 // Info - READ-ONLY; The scenario specific error details. 2125 Info interface{} `json:"info,omitempty"` 2126} 2127 2128// MarshalJSON is the custom marshaler for TypedErrorInfo. 2129func (tei TypedErrorInfo) MarshalJSON() ([]byte, error) { 2130 objectMap := make(map[string]interface{}) 2131 return json.Marshal(objectMap) 2132} 2133