Skip to content

Commit

Permalink
Merge pull request #25956 from hashicorp/bugfix/pim-crashes-and-cleanup
Browse files Browse the repository at this point in the history
bugfix: resolve crashes and read/import bugs in PIM resources
  • Loading branch information
manicminer authored May 15, 2024
2 parents 539ac9f + effd5c5 commit 0457d09
Show file tree
Hide file tree
Showing 8 changed files with 962 additions and 1,158 deletions.
19 changes: 0 additions & 19 deletions internal/services/authorization/parse/pim_role_assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"strings"

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2020-10-01/roleassignmentschedules"
"github.com/hashicorp/go-azure-sdk/resource-manager/authorization/2020-10-01/roleeligibilityschedules"
)

Expand Down Expand Up @@ -61,24 +60,6 @@ func (id PimRoleAssignmentId) ScopeID() commonids.ScopeId {
return commonids.NewScopeID(id.Scope)
}

func RoleAssignmentScheduleID(input string) (*string, error) {
re := regexp.MustCompile(`^.+/providers/Microsoft.Authorization/roleEligibilitySchedules/(.+)`)
matches := re.FindStringSubmatch(input)
if len(matches) != 2 {
return nil, fmt.Errorf("parsing %s", input)
}
return &matches[1], nil
}

func RoleAssignmentScheduleRequestIdFromSchedule(r *roleassignmentschedules.RoleAssignmentSchedule) (*string, error) {
re := regexp.MustCompile(`^.+/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/(.+)`)
matches := re.FindStringSubmatch(*r.Properties.RoleAssignmentScheduleRequestId)
if len(matches) != 2 {
return nil, fmt.Errorf("parsing %s", *r.Properties.RoleAssignmentScheduleRequestId)
}
return &matches[1], nil
}

func RoleEligibilityScheduleRequestIdFromSchedule(r *roleeligibilityschedules.RoleEligibilitySchedule) (*string, error) {
re := regexp.MustCompile(`^.+/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/(.+)`)
matches := re.FindStringSubmatch(*r.Properties.RoleEligibilityScheduleRequestId)
Expand Down
Loading

0 comments on commit 0457d09

Please sign in to comment.