@Override public CopyObjectResponse copyObject(CopyObjectRequest request) { LOG.trace("Called copyObject"); request = CopyObjectConverter.interceptRequest(request); com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = CopyObjectConverter.fromRequest(client, request); com.google.common.base.Function<javax.ws.rs.core.Response, CopyObjectResponse> transformer = CopyObjectConverter.fromResponse(); int attempts = 0; while (true) { try { javax.ws.rs.core.Response response = client.post(ib, request.getCopyObjectDetails(), request); return transformer.apply(response); } catch (com.oracle.bmc.model.BmcException e) { if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS && canRetryRequestIfRefreshableAuthTokenUsed(e)) { continue; } else { throw e; } } } }
public static CopyObjectRequest intercept(CopyObjectRequest request) { Map<String, String> newMetadata = toServiceMeta(request.getCopyObjectDetails().getDestinationObjectMetadata()); CopyObjectDetails newDetails = CopyObjectDetails.builder() .copy(request.getCopyObjectDetails()) .destinationObjectMetadata(newMetadata) .build(); return CopyObjectRequest.builder().copy(request).copyObjectDetails(newDetails).build(); }
/** * Copy method to populate the builder with values from the given instance. * @return this builder instance */ public Builder copy(CopyObjectRequest o) { namespaceName(o.getNamespaceName()); bucketName(o.getBucketName()); copyObjectDetails(o.getCopyObjectDetails()); opcClientRequestId(o.getOpcClientRequestId()); invocationCallback(o.getInvocationCallback()); return this; }
public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( com.oracle.bmc.http.internal.RestClient client, CopyObjectRequest request) { Validate.notNull(request, "request instance is required"); Validate.notBlank(request.getNamespaceName(), "namespaceName must not be blank"); Validate.notBlank(request.getBucketName(), "bucketName must not be blank"); Validate.notNull(request.getCopyObjectDetails(), "copyObjectDetails is required"); com.oracle.bmc.http.internal.WrappedWebTarget target = client.getBaseTarget() .path("/") .path("n") .path( com.oracle.bmc.util.internal.HttpUtils.encodePathSegment( request.getNamespaceName())) .path("b") .path( com.oracle.bmc.util.internal.HttpUtils.encodePathSegment( request.getBucketName())) .path("actions") .path("copyObject"); com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); if (request.getOpcClientRequestId() != null) { ib.header("opc-client-request-id", request.getOpcClientRequestId()); } return ib; }
client.post( ib, interceptedRequest.getCopyObjectDetails(), interceptedRequest, onSuccess,