* Stores object location, custom headers, version etc. * @param {object} bucketName - bucket in which metadata is stored * @param {array} dataGetInfo - array of objects with information to * retrieve data or null if 0 bytes object * @param {object} cipherBundle - server side encr
(bucketName, dataGetInfo, cipherBundle, params, cb)
| 102 | * @return {function} executes callback with err or ETag as arguments |
| 103 | */ |
| 104 | metadataStoreObject(bucketName, dataGetInfo, cipherBundle, params, cb) { |
| 105 | const { objectKey, authInfo, size, contentMD5, metaHeaders, |
| 106 | contentType, cacheControl, contentDisposition, contentEncoding, |
| 107 | expires, multipart, headers, overrideMetadata, log, |
| 108 | lastModifiedDate, versioning, versionId, uploadId, |
| 109 | tagging, taggingCopy, replicationInfo, defaultRetention, |
| 110 | dataStoreName, creationTime, retentionMode, retentionDate, |
| 111 | legalHold, originOp, updateMicroVersionId, archive, oldReplayId, |
| 112 | deleteNullKey, amzStorageClass, overheadField, needOplogUpdate, |
| 113 | restoredEtag, bucketOwnerId } = params; |
| 114 | log.trace('storing object in metadata'); |
| 115 | assert.strictEqual(typeof bucketName, 'string'); |
| 116 | const md = new ObjectMD(); |
| 117 | |
| 118 | if (config.testingMode && metaHeaders && metaHeaders[constants.lastModifiedHeader]) { |
| 119 | setLastModifiedFromHeader(md, metaHeaders); |
| 120 | } |
| 121 | |
| 122 | // This should be object creator's canonical ID. |
| 123 | md.setOwnerId(authInfo.getCanonicalID()) |
| 124 | .setKey(objectKey) |
| 125 | .setCacheControl(cacheControl) |
| 126 | .setContentDisposition(contentDisposition) |
| 127 | .setContentEncoding(contentEncoding) |
| 128 | .setExpires(expires) |
| 129 | .setContentLength(size) |
| 130 | .setContentType(contentType) |
| 131 | .setContentMd5(contentMD5) |
| 132 | .setLocation(dataGetInfo) |
| 133 | // If an IAM user uploads a resource, the owner should be the parent |
| 134 | // account. http://docs.aws.amazon.com/AmazonS3/ |
| 135 | // latest/dev/access-control-overview.html |
| 136 | .setOwnerDisplayName(authInfo.getAccountDisplayName()) |
| 137 | .setDataStoreName(dataStoreName) |
| 138 | // CreationTime needs to be carried over so that it remains static |
| 139 | .setCreationTime(creationTime) |
| 140 | .setOriginOp(originOp); |
| 141 | // Sending in last modified date in object put copy since need |
| 142 | // to return the exact date in the response |
| 143 | if (lastModifiedDate) { |
| 144 | md.setLastModified(lastModifiedDate); |
| 145 | } |
| 146 | if (cipherBundle) { |
| 147 | md.setAmzServerSideEncryption(cipherBundle.algorithm); |
| 148 | // configuredMasterKeyId takes precedence |
| 149 | if (cipherBundle.configuredMasterKeyId || cipherBundle.masterKeyId) { |
| 150 | md.setAmzEncryptionKeyId(cipherBundle.configuredMasterKeyId || cipherBundle.masterKeyId); |
| 151 | } |
| 152 | } |
| 153 | if (headers && headers['x-amz-website-redirect-location']) { |
| 154 | md.setRedirectLocation(headers['x-amz-website-redirect-location']); |
| 155 | } |
| 156 | if (headers) { |
| 157 | // Stores retention information if object has its own retention |
| 158 | // configuration or default retention configuration from its bucket |
| 159 | const headerMode = headers['x-amz-object-lock-mode']; |
| 160 | const headerDate = headers['x-amz-object-lock-retain-until-date']; |
| 161 | const headerLegalHold = headers['x-amz-object-lock-legal-hold']; |
nothing calls this directly
no test coverage detected