/** * Copy method to populate the builder with values from the given instance. * @return this builder instance */ public Builder copy(CreateLoadBalancerRequest o) { createLoadBalancerDetails(o.getCreateLoadBalancerDetails()); opcRequestId(o.getOpcRequestId()); opcRetryToken(o.getOpcRetryToken()); invocationCallback(o.getInvocationCallback()); return this; }
/** * Build the instance of CreateLoadBalancerRequest 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 CreateLoadBalancerRequest */ public CreateLoadBalancerRequest build() { CreateLoadBalancerRequest request = buildWithoutInvocationCallback(); request.setInvocationCallback(invocationCallback); return request; } }
public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( com.oracle.bmc.http.internal.RestClient client, CreateLoadBalancerRequest request) { Validate.notNull(request, "request instance is required"); Validate.notNull( request.getCreateLoadBalancerDetails(), "createLoadBalancerDetails is required"); com.oracle.bmc.http.internal.WrappedWebTarget target = client.getBaseTarget().path("/20170115").path("loadBalancers"); com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); if (request.getOpcRequestId() != null) { ib.header("opc-request-id", request.getOpcRequestId()); } if (request.getOpcRetryToken() != null) { ib.header("opc-retry-token", request.getOpcRetryToken()); } return ib; }
@Override public CreateLoadBalancerResponse createLoadBalancer(CreateLoadBalancerRequest request) { LOG.trace("Called createLoadBalancer"); request = CreateLoadBalancerConverter.interceptRequest(request); com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = CreateLoadBalancerConverter.fromRequest(client, request); com.google.common.base.Function<javax.ws.rs.core.Response, CreateLoadBalancerResponse> transformer = CreateLoadBalancerConverter.fromResponse(); int attempts = 0; while (true) { try { javax.ws.rs.core.Response response = client.post(ib, request.getCreateLoadBalancerDetails(), 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; } } } }
void create(Task task) { String clusterName = description.qualifiedName(); task.updateStatus(CREATE, "Create LB: ${description.qualifiedName()}"); CreateLoadBalancerDetails.Builder lbDetails = CreateLoadBalancerDetails.builder() .displayName(clusterName) .compartmentId(description.getCredentials().getCompartmentId()) .shapeName(description.getShape()) .subnetIds(description.getSubnetIds()); if (description.getIsPrivate()) { lbDetails.isPrivate(description.getIsPrivate()); } if (description.getCertificates() != null) { lbDetails.certificates(description.getCertificates()); } if (description.getBackendSets() != null) { lbDetails.backendSets(description.getBackendSets()); } if (description.getListeners() != null) { lbDetails.listeners(description.getListeners()); } CreateLoadBalancerResponse res = description.getCredentials().getLoadBalancerClient().createLoadBalancer( CreateLoadBalancerRequest.builder().createLoadBalancerDetails(lbDetails.build()).build()); task.updateStatus(CREATE, "Create LB rq submitted - work request id: ${rs.getOpcWorkRequestId()}"); OracleWorkRequestPoller.poll(res.getOpcWorkRequestId(), CREATE, task, description.getCredentials().getLoadBalancerClient()); }
client.post( ib, interceptedRequest.getCreateLoadBalancerDetails(), interceptedRequest, onSuccess,