Skip to content

Commit

Permalink
Added additional constructor for AzOpsRoleEligibilityScheduleRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
borondy authored Oct 16, 2024
1 parent c3ad03a commit e71d7a1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/internal/classes/AzOpsRoleEligibilityScheduleRequest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,25 @@
$this.Name = $roleEligibilitySchedule.Name
$this.ResourceType = $roleEligibilityScheduleRequest.Type
}

AzOpsRoleEligibilityScheduleRequest($roleEligibilitySchedule) {
$this.Properties = [ordered]@{
Condition = $roleEligibilitySchedule.Condition
ConditionVersion = $roleEligibilitySchedule.ConditionVersion
PrincipalId = $roleEligibilitySchedule.PrincipalId
RoleDefinitionId = $roleEligibilitySchedule.RoleDefinitionId
RequestType = "AdminAssign"
ScheduleInfo = [ordered]@{
Expiration = [ordered]@{
EndDateTime = $roleEligibilitySchedule.EndDateTime
Duration = $roleEligibilitySchedule.ExpirationDuration
ExpirationType = if ($roleEligibilitySchedule.ExpirationType) {$roleEligibilitySchedule.ExpirationType.ToString()}
}
StartDateTime = $roleEligibilitySchedule.StartDateTime
}
}
$this.Id = $roleEligibilitySchedule.RequestId
$this.Name = $roleEligibilitySchedule.Name
$this.ResourceType = "Microsoft.Authorization/roleEligibilityScheduleRequests"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
Write-AzOpsMessage -LogLevel Debug -LogString 'Get-AzOpsRoleEligibilityScheduleRequest.Assignment' -LogStringValues $roleEligibilitySchedule.Name -Target $ScopeObject
# Construct AzOpsRoleEligibilityScheduleRequest by combining information from roleEligibilitySchedule and roleEligibilityScheduleRequest
[AzOpsRoleEligibilityScheduleRequest]::new($roleEligibilitySchedule, $roleEligibilityScheduleRequest)
else {
Write-AzOpsMessage -LogLevel Important -LogString 'Get-AzOpsRoleEligibilityScheduleRequest.Processing' -LogStringValues "No RoleEligibilityScheduleRequest found for RoleEligibilitySchedule in scope: $($ScopeObject.scope), creating template based on RoleEligibilitySchedule" -Target $ScopeObject
[AzOpsRoleEligibilityScheduleRequest]::new($roleEligibilitySchedule)
}
}
}
Expand Down

0 comments on commit e71d7a1

Please sign in to comment.