mirror of
https://github.com/minio/minio.git
synced 2024-12-26 07:05:55 -05:00
fix: send replication completed event notification (#10902)
This commit is contained in:
parent
598ca0569c
commit
0b766288ef
@ -261,15 +261,16 @@ func replicateObject(ctx context.Context, objInfo ObjectInfo, objectAPI ObjectLa
|
|||||||
// - event.ObjectReplicationNotTracked
|
// - event.ObjectReplicationNotTracked
|
||||||
// - event.ObjectReplicationMissedThreshold
|
// - event.ObjectReplicationMissedThreshold
|
||||||
// - event.ObjectReplicationReplicatedAfterThreshold
|
// - event.ObjectReplicationReplicatedAfterThreshold
|
||||||
|
var eventName = event.ObjectReplicationComplete
|
||||||
if replicationStatus == replication.Failed {
|
if replicationStatus == replication.Failed {
|
||||||
|
eventName = event.ObjectReplicationFailed
|
||||||
|
}
|
||||||
sendEvent(eventArgs{
|
sendEvent(eventArgs{
|
||||||
EventName: event.ObjectReplicationFailed,
|
EventName: eventName,
|
||||||
BucketName: bucket,
|
BucketName: bucket,
|
||||||
Object: objInfo,
|
Object: objInfo,
|
||||||
Host: "Internal: [Replication]",
|
Host: "Internal: [Replication]",
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
objInfo.metadataOnly = true // Perform only metadata updates.
|
objInfo.metadataOnly = true // Perform only metadata updates.
|
||||||
if _, err = objectAPI.CopyObject(ctx, bucket, object, bucket, object, objInfo, ObjectOptions{
|
if _, err = objectAPI.CopyObject(ctx, bucket, object, bucket, object, objInfo, ObjectOptions{
|
||||||
VersionID: objInfo.VersionID,
|
VersionID: objInfo.VersionID,
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
// Name - event type enum.
|
// Name - event type enum.
|
||||||
// Refer http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-event-types-and-destinations
|
// Refer http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-event-types-and-destinations
|
||||||
// for most basic values we have since extend this and its not really much applicable other than a reference point.
|
// for most basic values we have since extend this and its not really much applicable other than a reference point.
|
||||||
|
// "s3:Replication:OperationCompletedReplication" is a MinIO extension.
|
||||||
type Name int
|
type Name int
|
||||||
|
|
||||||
// Values of event Name
|
// Values of event Name
|
||||||
@ -47,6 +48,7 @@ const (
|
|||||||
BucketRemoved
|
BucketRemoved
|
||||||
ObjectReplicationAll
|
ObjectReplicationAll
|
||||||
ObjectReplicationFailed
|
ObjectReplicationFailed
|
||||||
|
ObjectReplicationComplete
|
||||||
ObjectReplicationMissedThreshold
|
ObjectReplicationMissedThreshold
|
||||||
ObjectReplicationReplicatedAfterThreshold
|
ObjectReplicationReplicatedAfterThreshold
|
||||||
ObjectReplicationNotTracked
|
ObjectReplicationNotTracked
|
||||||
@ -69,6 +71,7 @@ func (name Name) Expand() []Name {
|
|||||||
ObjectCreatedCompleteMultipartUpload, ObjectCreatedCopy,
|
ObjectCreatedCompleteMultipartUpload, ObjectCreatedCopy,
|
||||||
ObjectCreatedPost, ObjectCreatedPut,
|
ObjectCreatedPost, ObjectCreatedPut,
|
||||||
ObjectCreatedPutRetention, ObjectCreatedPutLegalHold,
|
ObjectCreatedPutRetention, ObjectCreatedPutLegalHold,
|
||||||
|
ObjectReplicationComplete, ObjectReplicationFailed,
|
||||||
}
|
}
|
||||||
case ObjectRemovedAll:
|
case ObjectRemovedAll:
|
||||||
return []Name{
|
return []Name{
|
||||||
@ -78,6 +81,7 @@ func (name Name) Expand() []Name {
|
|||||||
case ObjectReplicationAll:
|
case ObjectReplicationAll:
|
||||||
return []Name{
|
return []Name{
|
||||||
ObjectReplicationFailed,
|
ObjectReplicationFailed,
|
||||||
|
ObjectReplicationComplete,
|
||||||
ObjectReplicationNotTracked,
|
ObjectReplicationNotTracked,
|
||||||
ObjectReplicationMissedThreshold,
|
ObjectReplicationMissedThreshold,
|
||||||
ObjectReplicationReplicatedAfterThreshold,
|
ObjectReplicationReplicatedAfterThreshold,
|
||||||
@ -124,8 +128,12 @@ func (name Name) String() string {
|
|||||||
return "s3:ObjectRemoved:Delete"
|
return "s3:ObjectRemoved:Delete"
|
||||||
case ObjectRemovedDeleteMarkerCreated:
|
case ObjectRemovedDeleteMarkerCreated:
|
||||||
return "s3:ObjectRemoved:DeleteMarkerCreated"
|
return "s3:ObjectRemoved:DeleteMarkerCreated"
|
||||||
|
case ObjectReplicationAll:
|
||||||
|
return "s3:Replication:*"
|
||||||
case ObjectReplicationFailed:
|
case ObjectReplicationFailed:
|
||||||
return "s3:Replication:OperationFailedReplication"
|
return "s3:Replication:OperationFailedReplication"
|
||||||
|
case ObjectReplicationComplete:
|
||||||
|
return "s3:Replication:OperationCompletedReplication"
|
||||||
case ObjectReplicationNotTracked:
|
case ObjectReplicationNotTracked:
|
||||||
return "s3:Replication:OperationNotTracked"
|
return "s3:Replication:OperationNotTracked"
|
||||||
case ObjectReplicationMissedThreshold:
|
case ObjectReplicationMissedThreshold:
|
||||||
@ -220,6 +228,8 @@ func ParseName(s string) (Name, error) {
|
|||||||
return ObjectReplicationAll, nil
|
return ObjectReplicationAll, nil
|
||||||
case "s3:Replication:OperationFailedReplication":
|
case "s3:Replication:OperationFailedReplication":
|
||||||
return ObjectReplicationFailed, nil
|
return ObjectReplicationFailed, nil
|
||||||
|
case "s3:Replication:OperationCompletedReplication":
|
||||||
|
return ObjectReplicationComplete, nil
|
||||||
case "s3:Replication:OperationMissedThreshold":
|
case "s3:Replication:OperationMissedThreshold":
|
||||||
return ObjectReplicationMissedThreshold, nil
|
return ObjectReplicationMissedThreshold, nil
|
||||||
case "s3:Replication:OperationReplicatedAfterThreshold":
|
case "s3:Replication:OperationReplicatedAfterThreshold":
|
||||||
|
@ -32,7 +32,7 @@ func TestNameExpand(t *testing.T) {
|
|||||||
{BucketRemoved, []Name{BucketRemoved}},
|
{BucketRemoved, []Name{BucketRemoved}},
|
||||||
{ObjectAccessedAll, []Name{ObjectAccessedGet, ObjectAccessedHead, ObjectAccessedGetRetention, ObjectAccessedGetLegalHold}},
|
{ObjectAccessedAll, []Name{ObjectAccessedGet, ObjectAccessedHead, ObjectAccessedGetRetention, ObjectAccessedGetLegalHold}},
|
||||||
{ObjectCreatedAll, []Name{ObjectCreatedCompleteMultipartUpload, ObjectCreatedCopy,
|
{ObjectCreatedAll, []Name{ObjectCreatedCompleteMultipartUpload, ObjectCreatedCopy,
|
||||||
ObjectCreatedPost, ObjectCreatedPut, ObjectCreatedPutRetention, ObjectCreatedPutLegalHold}},
|
ObjectCreatedPost, ObjectCreatedPut, ObjectCreatedPutRetention, ObjectCreatedPutLegalHold, ObjectReplicationComplete, ObjectReplicationFailed}},
|
||||||
{ObjectRemovedAll, []Name{ObjectRemovedDelete, ObjectRemovedDeleteMarkerCreated}},
|
{ObjectRemovedAll, []Name{ObjectRemovedDelete, ObjectRemovedDeleteMarkerCreated}},
|
||||||
{ObjectAccessedHead, []Name{ObjectAccessedHead}},
|
{ObjectAccessedHead, []Name{ObjectAccessedHead}},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user