com.oracle.bmc.logging.internal.http.ChangeUnifiedAgentConfigurationCompartmentConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of oci-java-sdk-logging Show documentation
Show all versions of oci-java-sdk-logging Show documentation
This project contains the SDK used for Oracle Cloud Infrastructure Logging
/**
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/
package com.oracle.bmc.logging.internal.http;
import com.oracle.bmc.http.internal.ResponseHelper;
import com.oracle.bmc.logging.model.*;
import com.oracle.bmc.logging.requests.*;
import com.oracle.bmc.logging.responses.*;
import org.apache.commons.lang3.Validate;
@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20200531")
@lombok.extern.slf4j.Slf4j
public class ChangeUnifiedAgentConfigurationCompartmentConverter {
private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory
RESPONSE_CONVERSION_FACTORY =
new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory();
public static com.oracle.bmc.logging.requests.ChangeUnifiedAgentConfigurationCompartmentRequest
interceptRequest(
com.oracle.bmc.logging.requests
.ChangeUnifiedAgentConfigurationCompartmentRequest
request) {
return request;
}
public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest(
com.oracle.bmc.http.internal.RestClient client,
com.oracle.bmc.logging.requests.ChangeUnifiedAgentConfigurationCompartmentRequest
request) {
Validate.notNull(request, "request instance is required");
Validate.notBlank(
request.getUnifiedAgentConfigurationId(),
"unifiedAgentConfigurationId must not be blank");
Validate.notNull(
request.getChangeUnifiedAgentConfigurationCompartmentDetails(),
"changeUnifiedAgentConfigurationCompartmentDetails is required");
com.oracle.bmc.http.internal.WrappedWebTarget target =
client.getBaseTarget()
.path("/20200531")
.path("unifiedAgentConfigurations")
.path(
com.oracle.bmc.util.internal.HttpUtils.encodePathSegment(
request.getUnifiedAgentConfigurationId()))
.path("actions")
.path("changeCompartment");
com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request();
ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON);
if (request.getOpcRetryToken() != null) {
ib.header("opc-retry-token", request.getOpcRetryToken());
}
if (request.getIfMatch() != null) {
ib.header("if-match", request.getIfMatch());
}
if (request.getOpcRequestId() != null) {
ib.header("opc-request-id", request.getOpcRequestId());
}
return ib;
}
public static com.google.common.base.Function<
javax.ws.rs.core.Response,
com.oracle.bmc.logging.responses
.ChangeUnifiedAgentConfigurationCompartmentResponse>
fromResponse() {
final com.google.common.base.Function<
javax.ws.rs.core.Response,
com.oracle.bmc.logging.responses
.ChangeUnifiedAgentConfigurationCompartmentResponse>
transformer =
new com.google.common.base.Function<
javax.ws.rs.core.Response,
com.oracle.bmc.logging.responses
.ChangeUnifiedAgentConfigurationCompartmentResponse>() {
@Override
public com.oracle.bmc.logging.responses
.ChangeUnifiedAgentConfigurationCompartmentResponse
apply(javax.ws.rs.core.Response rawResponse) {
LOG.trace(
"Transform function invoked for com.oracle.bmc.logging.responses.ChangeUnifiedAgentConfigurationCompartmentResponse");
com.google.common.base.Function<
javax.ws.rs.core.Response,
com.oracle.bmc.http.internal.WithHeaders>
responseFn = RESPONSE_CONVERSION_FACTORY.create();
com.oracle.bmc.http.internal.WithHeaders response =
responseFn.apply(rawResponse);
javax.ws.rs.core.MultivaluedMap headers =
response.getHeaders();
com.oracle.bmc.logging.responses
.ChangeUnifiedAgentConfigurationCompartmentResponse
.Builder
builder =
com.oracle.bmc.logging.responses
.ChangeUnifiedAgentConfigurationCompartmentResponse
.builder()
.__httpStatusCode__(
rawResponse.getStatus());
com.google.common.base.Optional>
opcWorkRequestIdHeader =
com.oracle.bmc.http.internal.HeaderUtils.get(
headers, "opc-work-request-id");
if (opcWorkRequestIdHeader.isPresent()) {
builder.opcWorkRequestId(
com.oracle.bmc.http.internal.HeaderUtils.toValue(
"opc-work-request-id",
opcWorkRequestIdHeader.get().get(0),
String.class));
}
com.google.common.base.Optional>
opcRequestIdHeader =
com.oracle.bmc.http.internal.HeaderUtils.get(
headers, "opc-request-id");
if (opcRequestIdHeader.isPresent()) {
builder.opcRequestId(
com.oracle.bmc.http.internal.HeaderUtils.toValue(
"opc-request-id",
opcRequestIdHeader.get().get(0),
String.class));
}
com.oracle.bmc.logging.responses
.ChangeUnifiedAgentConfigurationCompartmentResponse
responseWrapper = builder.build();
ResponseHelper.closeResponseSilentlyIfNotBuffered(rawResponse);
return responseWrapper;
}
};
return transformer;
}
}