/** * Commits the multi-part upload after all in-progress uploads have * completed. * <p> * This is a blocking call, and throws IllegalStateException if you try to commit an upload * in which the Manifest reports it is not successful ({@link MultipartManifest#isUploadSuccessful}). * @return The commit response. */ public CommitMultipartUploadResponse commit() { validateState(); transferManager.awaitCompletion(); if (!manifest.isUploadSuccessful()) { throw new IllegalStateException( "One or more parts were have not completed upload successfully"); } return service.commitMultipartUpload( CommitMultipartUploadRequest.builder() .namespaceName(namespaceName) .bucketName(bucketName) .objectName(objectName) .uploadId(manifest.getUploadId()) .commitMultipartUploadDetails( CommitMultipartUploadDetails.builder() .partsToCommit(manifest.listCompletedParts()) .partsToExclude( new ArrayList<Integer>(0)) // nothing to exclude .build()) .opcClientRequestId(createClientRequestId("-commit")) .build()); }
/** * Build the instance of CommitMultipartUploadRequest as configured by this builder * * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account, * while the method {@link Builder#buildWithoutInvocationCallback} does not. * * This is the preferred method to build an instance. * * @return instance of CommitMultipartUploadRequest */ public CommitMultipartUploadRequest build() { CommitMultipartUploadRequest request = buildWithoutInvocationCallback(); request.setInvocationCallback(invocationCallback); return request; } }
/** * Copy method to populate the builder with values from the given instance. * @return this builder instance */ public Builder copy(CommitMultipartUploadRequest o) { namespaceName(o.getNamespaceName()); bucketName(o.getBucketName()); objectName(o.getObjectName()); uploadId(o.getUploadId()); commitMultipartUploadDetails(o.getCommitMultipartUploadDetails()); ifMatch(o.getIfMatch()); ifNoneMatch(o.getIfNoneMatch()); opcClientRequestId(o.getOpcClientRequestId()); invocationCallback(o.getInvocationCallback()); return this; }