Add transition event notification (#11047)

This is a MinIO specific extension to allow monitoring of transition events.
This commit is contained in:
Poorna Krishnamoorthy
2020-12-07 13:53:28 -08:00
committed by GitHub
parent 038bcd9079
commit 934bed47fa
3 changed files with 40 additions and 4 deletions

View File

@@ -356,11 +356,23 @@ func transitionObject(ctx context.Context, objectAPI ObjectLayer, objInfo Object
opts.Versioned = globalBucketVersioningSys.Enabled(oi.Bucket)
opts.VersionID = oi.VersionID
opts.TransitionStatus = lifecycle.TransitionComplete
eventName := event.ObjectTransitionComplete
if _, err = objectAPI.DeleteObject(ctx, oi.Bucket, oi.Name, opts); err != nil {
return err
_, err = objectAPI.DeleteObject(ctx, oi.Bucket, oi.Name, opts)
if err != nil {
eventName = event.ObjectTransitionFailed
}
return nil
// Notify object deleted event.
sendEvent(eventArgs{
EventName: eventName,
BucketName: oi.Bucket,
Object: ObjectInfo{
Name: oi.Name,
VersionID: opts.VersionID,
},
Host: "Internal: [ILM-Transition]",
})
return err
}
// getLifecycleTransitionTargetArn returns transition ARN for storage class specified in the config.