mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
add missing x-amz-id-2 to event notification date (#16646)
This commit is contained in:
parent
eebdd2b31d
commit
b66d7dc708
@ -672,8 +672,9 @@ func (a adminAPIHandlers) AddServiceAccount(w http.ResponseWriter, r *http.Reque
|
|||||||
// It could be a regular user account or the root account.
|
// It could be a regular user account or the root account.
|
||||||
_, isRegularUser := globalIAMSys.GetUser(ctx, targetUser)
|
_, isRegularUser := globalIAMSys.GetUser(ctx, targetUser)
|
||||||
if !isRegularUser && targetUser != globalActiveCred.AccessKey {
|
if !isRegularUser && targetUser != globalActiveCred.AccessKey {
|
||||||
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx,
|
apiErr := toAdminAPIErr(ctx, errNoSuchUser)
|
||||||
fmt.Errorf("parent user %s does not exist. Cannot create service account", targetUser)), r.URL)
|
apiErr.Description = fmt.Sprintf("Specified target user %s does not exist", targetUser)
|
||||||
|
writeErrorResponseJSON(ctx, w, apiErr, r.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ func expireTransitionedObject(ctx context.Context, objectAPI ObjectLayer, oi *Ob
|
|||||||
EventName: eventName,
|
EventName: eventName,
|
||||||
BucketName: oi.Bucket,
|
BucketName: oi.Bucket,
|
||||||
Object: objInfo,
|
Object: objInfo,
|
||||||
Host: "Internal: [ILM-EXPIRY]",
|
Host: "Internal: [ILM-Expiry]",
|
||||||
})
|
})
|
||||||
|
|
||||||
case expireRestoredObj:
|
case expireRestoredObj:
|
||||||
|
@ -1203,7 +1203,7 @@ func applyExpiryOnNonTransitionedObjects(ctx context.Context, objLayer ObjectLay
|
|||||||
EventName: eventName,
|
EventName: eventName,
|
||||||
BucketName: obj.Bucket,
|
BucketName: obj.Bucket,
|
||||||
Object: obj,
|
Object: obj,
|
||||||
Host: "Internal: [ILM-EXPIRY]",
|
Host: "Internal: [ILM-Expiry]",
|
||||||
})
|
})
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -248,6 +248,7 @@ func (args eventArgs) ToEvent(escape bool) event.Event {
|
|||||||
|
|
||||||
respElements := map[string]string{
|
respElements := map[string]string{
|
||||||
"x-amz-request-id": args.RespElements["requestId"],
|
"x-amz-request-id": args.RespElements["requestId"],
|
||||||
|
"x-amz-id-2": args.RespElements["nodeId"],
|
||||||
"x-minio-origin-endpoint": func() string {
|
"x-minio-origin-endpoint": func() string {
|
||||||
if globalMinioEndpoint != "" {
|
if globalMinioEndpoint != "" {
|
||||||
return globalMinioEndpoint
|
return globalMinioEndpoint
|
||||||
@ -255,17 +256,18 @@ func (args eventArgs) ToEvent(escape bool) event.Event {
|
|||||||
return getAPIEndpoints()[0]
|
return getAPIEndpoints()[0]
|
||||||
}(), // MinIO specific custom elements.
|
}(), // MinIO specific custom elements.
|
||||||
}
|
}
|
||||||
// Add deployment as part of
|
|
||||||
if globalDeploymentID != "" {
|
// Add deployment as part of response elements.
|
||||||
respElements["x-minio-deployment-id"] = globalDeploymentID
|
respElements["x-minio-deployment-id"] = globalDeploymentID
|
||||||
}
|
|
||||||
if args.RespElements["content-length"] != "" {
|
if args.RespElements["content-length"] != "" {
|
||||||
respElements["content-length"] = args.RespElements["content-length"]
|
respElements["content-length"] = args.RespElements["content-length"]
|
||||||
}
|
}
|
||||||
|
|
||||||
keyName := args.Object.Name
|
keyName := args.Object.Name
|
||||||
if escape {
|
if escape {
|
||||||
keyName = url.QueryEscape(args.Object.Name)
|
keyName = url.QueryEscape(args.Object.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
newEvent := event.Event{
|
newEvent := event.Event{
|
||||||
EventVersion: "2.0",
|
EventVersion: "2.0",
|
||||||
EventSource: "minio:s3",
|
EventSource: "minio:s3",
|
||||||
@ -312,12 +314,13 @@ func (args eventArgs) ToEvent(escape bool) event.Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sendEvent(args eventArgs) {
|
func sendEvent(args eventArgs) {
|
||||||
args.Object.Size, _ = args.Object.GetActualSize()
|
|
||||||
|
|
||||||
// avoid generating a notification for REPLICA creation event.
|
// avoid generating a notification for REPLICA creation event.
|
||||||
if _, ok := args.ReqParams[xhttp.MinIOSourceReplicationRequest]; ok {
|
if _, ok := args.ReqParams[xhttp.MinIOSourceReplicationRequest]; ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
args.Object.Size, _ = args.Object.GetActualSize()
|
||||||
|
|
||||||
// remove sensitive encryption entries in metadata.
|
// remove sensitive encryption entries in metadata.
|
||||||
crypto.RemoveSensitiveEntries(args.Object.UserDefined)
|
crypto.RemoveSensitiveEntries(args.Object.UserDefined)
|
||||||
crypto.RemoveInternalEntries(args.Object.UserDefined)
|
crypto.RemoveInternalEntries(args.Object.UserDefined)
|
||||||
|
@ -242,6 +242,7 @@ func extractRespElements(w http.ResponseWriter) map[string]string {
|
|||||||
}
|
}
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
"requestId": w.Header().Get(xhttp.AmzRequestID),
|
"requestId": w.Header().Get(xhttp.AmzRequestID),
|
||||||
|
"nodeId": w.Header().Get(xhttp.AmzRequestNodeID),
|
||||||
"content-length": w.Header().Get(xhttp.ContentLength),
|
"content-length": w.Header().Get(xhttp.ContentLength),
|
||||||
// Add more fields here.
|
// Add more fields here.
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ func deleteObjectVersions(ctx context.Context, o ObjectLayer, bucket string, toD
|
|||||||
Name: dobj.ObjectName,
|
Name: dobj.ObjectName,
|
||||||
VersionID: dobj.VersionID,
|
VersionID: dobj.VersionID,
|
||||||
},
|
},
|
||||||
Host: "Internal: [ILM-EXPIRY]",
|
Host: "Internal: [ILM-Expiry]",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user