Skip to content

Commit

Permalink
Add delete func AccessPackageResourceRoleScope
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwilcox9 committed Jun 15, 2023
1 parent 9893247 commit e9eaae0
Showing 2 changed files with 28 additions and 1 deletion.
16 changes: 16 additions & 0 deletions msgraph/accesspackageresourcerolescope.go
Original file line number Diff line number Diff line change
@@ -153,3 +153,19 @@ func (c *AccessPackageResourceRoleScopeClient) Get(ctx context.Context, accessPa

return &accessPackageResourceRoleScope, status, nil
}

// Delete removes a AccessPackageResourceRoleScope.
func (c *AccessPackageResourceRoleScopeClient) Delete(ctx context.Context, accessPackageId string, id string) (int, error) {
_, status, _, err := c.BaseClient.Delete(ctx, DeleteHttpRequestInput{
ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc,
ValidStatusCodes: []int{http.StatusOK},
Uri: Uri{
Entity: fmt.Sprintf("/identityGovernance/entitlementManagement/accessPackages/%s/accessPackageResourceRoleScopes/%s", accessPackageId, id),
},
})
if err != nil {
return status, fmt.Errorf("AccessPackageResourceRoleScopeClient.BaseClient.Delete(): %v", err)
}

return status, nil
}
13 changes: 12 additions & 1 deletion msgraph/accesspackageresourcerolescope_test.go
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ func TestAccessPackageResourceRoleScopeClient(t *testing.T) {
testAccessPackageResourceRoleScopeClient_Get(t, c, *accessPackageResourceRoleScope.AccessPackageId, *accessPackageResourceRoleScope.ID)
testAccessPackageResourceRoleScopeResource_Get(t, c, *accessPackageResourceRequest.CatalogId, *accessPackageResourceRequest.AccessPackageResource.OriginId)
testAccessPackageResourceRoleScopeClient_List(t, c, *accessPackageResourceRoleScope.AccessPackageId)
testAccessPackageResourceRoleScopeClient_Delete(t, c, *accessPackageResourceRoleScope.AccessPackageId, *accessPackageResourceRoleScope.ID)

// Force-replacement scenario
testAccessPackageResourceRoleScopeAP_Delete(t, c, *accessPackage.ID)
@@ -93,7 +94,6 @@ func TestAccessPackageResourceRoleScopeClient(t *testing.T) {
},
})

//testAccessPackageResourceRoleScopeClient_Delete(t, c, *accessPackageResourceRoleScope)
//testAccessPackageResourceRequestClient_Delete(t, c, accessPackageResourceRequest)

// Cleanup
@@ -147,6 +147,17 @@ func testAccessPackageResourceRoleScopeClient_List(t *testing.T, c *test.Test, a
return
}

func testAccessPackageResourceRoleScopeClient_Delete(t *testing.T, c *test.Test, accessPackageId string, id string) {
status, err := c.AccessPackageResourceRoleScopeClient.Delete(c.Context, accessPackageId, id)
if err != nil {
t.Fatalf("AccessPackageResourceRequestClient.Delete(): %v", err)
}
if status < 200 || status >= 300 {
t.Fatalf("AccessPackageResourceRequestClient.Delete(): invalid status: %d", status)
}
return
}

// AccessPackageResourceRequest

func testAccessPackageResourceRoleScopeResourceRequest_Create(t *testing.T, c *test.Test, a msgraph.AccessPackageResourceRequest, pollForId bool) (accessPackageResourceRequest *msgraph.AccessPackageResourceRequest) {

0 comments on commit e9eaae0

Please sign in to comment.