Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Refactor: implement bundle.BatchDeleteFederatedBundle #1607

Merged
merged 2 commits into from
Jun 4, 2020

Conversation

MarcosDY
Copy link
Collaborator

@MarcosDY MarcosDY commented Jun 1, 2020

Implements bundle.BatchDeleteFederatedBundle

Which issue this PR fixes
fixes #1556

Copy link
Member

@azdagron azdagron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Thanks @MarcosDY.

return nil, status.Errorf(codes.Unimplemented, "method BatchDeleteFederatedBundle not implemented")
log := rpccontext.Logger(ctx)

if len(req.TrustDomains) == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably just return an empty response here?

Comment on lines 218 to 219
log.Error("Invalid request: no possible to delete server bundle")
return status.Error(codes.InvalidArgument, "no possible to delete server bundle")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Error("Invalid request: no possible to delete server bundle")
return status.Error(codes.InvalidArgument, "no possible to delete server bundle")
log.Error("Invalid request: removing the bundle for the server trust domain is not allowed")
return status.Error(codes.InvalidArgument, "removing the bundle for the server trust domain is not allowed")

_, err = s.ds.DeleteBundle(ctx, &datastore.DeleteBundleRequest{
TrustDomainId: td.String(),
// TODO: what mode must we use here?
Mode: datastore.DeleteBundleRequest_RESTRICT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. This seems like the safest option for now. I'll have to think on this.

Comment on lines 228 to 229
log.WithError(err).Error("Failed to delete Federated Bundle")
return status.Errorf(codes.Internal, "failed to delete Federated Bundle: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.WithError(err).Error("Failed to delete Federated Bundle")
return status.Errorf(codes.Internal, "failed to delete Federated Bundle: %v", err)
log.WithError(err).Error("Failed to delete federated bundle")
return status.Errorf(codes.Internal, "failed to delete federated bundle: %v", err)

@MarcosDY MarcosDY force-pushed the api-refactor-batch-delete-fbundle branch from a3f291d to 40050f6 Compare June 3, 2020 20:42
@@ -511,8 +511,11 @@ func TestAppendBundle(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
test.logHook.Reset()
test.setBundle(t, sb)
// Make sure no error is set to next call
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better thing to do is to initialize a new test for each test case instead of trying to clean up/reset state on the existing test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleaned

azdagron
azdagron previously approved these changes Jun 3, 2020
Copy link
Member

@azdagron azdagron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

Signed-off-by: Marcos Yacob <marcos@scytale.io>
@azdagron azdagron merged commit 616b8b1 into spiffe:master Jun 4, 2020
@MarcosDY MarcosDY deleted the api-refactor-batch-delete-fbundle branch August 2, 2022 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API Refactor: Implement Bundle.BatchDeleteFederatedBundle RPC
2 participants