api.v1.topics.item.WithTopicNameItemRequestBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kafka-instance-sdk Show documentation
Show all versions of kafka-instance-sdk Show documentation
Kafka instance SDK for RHOAS API supports interaction with individual Kafka instances
The newest version!
package com.openshift.cloud.api.kas.auth.api.v1.topics.item;
import com.microsoft.kiota.HttpMethod;
import com.microsoft.kiota.RequestAdapter;
import com.microsoft.kiota.RequestHeaders;
import com.microsoft.kiota.RequestInformation;
import com.microsoft.kiota.RequestOption;
import com.microsoft.kiota.serialization.Parsable;
import com.microsoft.kiota.serialization.ParsableFactory;
import com.openshift.cloud.api.kas.auth.api.v1.topics.item.records.RecordsRequestBuilder;
import com.openshift.cloud.api.kas.auth.models.Error;
import com.openshift.cloud.api.kas.auth.models.Topic;
import com.openshift.cloud.api.kas.auth.models.TopicSettings;
import java.net.URISyntaxException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* Builds and executes requests for operations under /api/v1/topics/{topicName}
*/
public class WithTopicNameItemRequestBuilder {
/** Path parameters for the request */
private HashMap pathParameters;
/** The records property */
@javax.annotation.Nonnull
public RecordsRequestBuilder records() {
return new RecordsRequestBuilder(pathParameters, requestAdapter);
}
/** The request adapter to use to execute the requests. */
private RequestAdapter requestAdapter;
/** Url template to use to build the URL for the current request builder */
private String urlTemplate;
/**
* Instantiates a new WithTopicNameItemRequestBuilder and sets the default values.
* @param pathParameters Path parameters for the request
* @param requestAdapter The request adapter to use to execute the requests.
* @return a void
*/
@javax.annotation.Nullable
public WithTopicNameItemRequestBuilder(@javax.annotation.Nonnull final HashMap pathParameters, @javax.annotation.Nonnull final RequestAdapter requestAdapter) {
Objects.requireNonNull(pathParameters);
Objects.requireNonNull(requestAdapter);
this.urlTemplate = "{+baseurl}/api/v1/topics/{topicName}";
final HashMap urlTplParams = new HashMap(pathParameters);
this.pathParameters = urlTplParams;
this.requestAdapter = requestAdapter;
}
/**
* Instantiates a new WithTopicNameItemRequestBuilder and sets the default values.
* @param rawUrl The raw URL to use for the request builder.
* @param requestAdapter The request adapter to use to execute the requests.
* @return a void
*/
@javax.annotation.Nullable
public WithTopicNameItemRequestBuilder(@javax.annotation.Nonnull final String rawUrl, @javax.annotation.Nonnull final RequestAdapter requestAdapter) {
this.urlTemplate = "{+baseurl}/api/v1/topics/{topicName}";
final HashMap urlTplParams = new HashMap();
urlTplParams.put("request-raw-url", rawUrl);
this.pathParameters = urlTplParams;
this.requestAdapter = requestAdapter;
}
/**
* Deletes the topic with the specified name.
* @return a CompletableFuture of void
*/
@javax.annotation.Nonnull
public java.util.concurrent.CompletableFuture delete() {
try {
final RequestInformation requestInfo = toDeleteRequestInformation(null);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", Error::createFromDiscriminatorValue);
errorMapping.put("404", Error::createFromDiscriminatorValue);
errorMapping.put("500", Error::createFromDiscriminatorValue);
errorMapping.put("503", Error::createFromDiscriminatorValue);
return this.requestAdapter.sendPrimitiveAsync(requestInfo, Void.class, errorMapping);
} catch (URISyntaxException ex) {
final java.util.concurrent.CompletableFuture executionException = new java.util.concurrent.CompletableFuture();
executionException.completeExceptionally(ex);
return executionException;
}
}
/**
* Deletes the topic with the specified name.
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a CompletableFuture of void
*/
@javax.annotation.Nonnull
public java.util.concurrent.CompletableFuture delete(@javax.annotation.Nullable final java.util.function.Consumer requestConfiguration) {
try {
final RequestInformation requestInfo = toDeleteRequestInformation(requestConfiguration);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", Error::createFromDiscriminatorValue);
errorMapping.put("404", Error::createFromDiscriminatorValue);
errorMapping.put("500", Error::createFromDiscriminatorValue);
errorMapping.put("503", Error::createFromDiscriminatorValue);
return this.requestAdapter.sendPrimitiveAsync(requestInfo, Void.class, errorMapping);
} catch (URISyntaxException ex) {
final java.util.concurrent.CompletableFuture executionException = new java.util.concurrent.CompletableFuture();
executionException.completeExceptionally(ex);
return executionException;
}
}
/**
* Topic
* @return a CompletableFuture of Topic
*/
@javax.annotation.Nonnull
public java.util.concurrent.CompletableFuture get() {
try {
final RequestInformation requestInfo = toGetRequestInformation(null);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", Error::createFromDiscriminatorValue);
errorMapping.put("404", Error::createFromDiscriminatorValue);
errorMapping.put("500", Error::createFromDiscriminatorValue);
errorMapping.put("503", Error::createFromDiscriminatorValue);
return this.requestAdapter.sendAsync(requestInfo, Topic::createFromDiscriminatorValue, errorMapping);
} catch (URISyntaxException ex) {
final java.util.concurrent.CompletableFuture executionException = new java.util.concurrent.CompletableFuture();
executionException.completeExceptionally(ex);
return executionException;
}
}
/**
* Topic
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a CompletableFuture of Topic
*/
@javax.annotation.Nonnull
public java.util.concurrent.CompletableFuture get(@javax.annotation.Nullable final java.util.function.Consumer requestConfiguration) {
try {
final RequestInformation requestInfo = toGetRequestInformation(requestConfiguration);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", Error::createFromDiscriminatorValue);
errorMapping.put("404", Error::createFromDiscriminatorValue);
errorMapping.put("500", Error::createFromDiscriminatorValue);
errorMapping.put("503", Error::createFromDiscriminatorValue);
return this.requestAdapter.sendAsync(requestInfo, Topic::createFromDiscriminatorValue, errorMapping);
} catch (URISyntaxException ex) {
final java.util.concurrent.CompletableFuture executionException = new java.util.concurrent.CompletableFuture();
executionException.completeExceptionally(ex);
return executionException;
}
}
/**
* Update the configuration settings for a topic.
* @param body The settings that are applicable to this topic. This includes partitions, configuration information, and number of replicas.
* @return a CompletableFuture of Topic
*/
@javax.annotation.Nonnull
public java.util.concurrent.CompletableFuture patch(@javax.annotation.Nonnull final TopicSettings body) {
try {
final RequestInformation requestInfo = toPatchRequestInformation(body, null);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("400", Error::createFromDiscriminatorValue);
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", Error::createFromDiscriminatorValue);
errorMapping.put("404", Error::createFromDiscriminatorValue);
errorMapping.put("500", Error::createFromDiscriminatorValue);
errorMapping.put("503", Error::createFromDiscriminatorValue);
return this.requestAdapter.sendAsync(requestInfo, Topic::createFromDiscriminatorValue, errorMapping);
} catch (URISyntaxException ex) {
final java.util.concurrent.CompletableFuture executionException = new java.util.concurrent.CompletableFuture();
executionException.completeExceptionally(ex);
return executionException;
}
}
/**
* Update the configuration settings for a topic.
* @param body The settings that are applicable to this topic. This includes partitions, configuration information, and number of replicas.
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a CompletableFuture of Topic
*/
@javax.annotation.Nonnull
public java.util.concurrent.CompletableFuture patch(@javax.annotation.Nonnull final TopicSettings body, @javax.annotation.Nullable final java.util.function.Consumer requestConfiguration) {
Objects.requireNonNull(body);
try {
final RequestInformation requestInfo = toPatchRequestInformation(body, requestConfiguration);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("400", Error::createFromDiscriminatorValue);
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", Error::createFromDiscriminatorValue);
errorMapping.put("404", Error::createFromDiscriminatorValue);
errorMapping.put("500", Error::createFromDiscriminatorValue);
errorMapping.put("503", Error::createFromDiscriminatorValue);
return this.requestAdapter.sendAsync(requestInfo, Topic::createFromDiscriminatorValue, errorMapping);
} catch (URISyntaxException ex) {
final java.util.concurrent.CompletableFuture executionException = new java.util.concurrent.CompletableFuture();
executionException.completeExceptionally(ex);
return executionException;
}
}
/**
* Deletes the topic with the specified name.
* @return a RequestInformation
*/
@javax.annotation.Nonnull
public RequestInformation toDeleteRequestInformation() throws URISyntaxException {
return toDeleteRequestInformation(null);
}
/**
* Deletes the topic with the specified name.
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a RequestInformation
*/
@javax.annotation.Nonnull
public RequestInformation toDeleteRequestInformation(@javax.annotation.Nullable final java.util.function.Consumer requestConfiguration) throws URISyntaxException {
final RequestInformation requestInfo = new RequestInformation();
requestInfo.httpMethod = HttpMethod.DELETE;
requestInfo.urlTemplate = urlTemplate;
requestInfo.pathParameters = pathParameters;
if (requestConfiguration != null) {
final DeleteRequestConfiguration requestConfig = new DeleteRequestConfiguration();
requestConfiguration.accept(requestConfig);
requestInfo.headers.putAll(requestConfig.headers);
requestInfo.addRequestOptions(requestConfig.options);
}
return requestInfo;
}
/**
* Topic
* @return a RequestInformation
*/
@javax.annotation.Nonnull
public RequestInformation toGetRequestInformation() throws URISyntaxException {
return toGetRequestInformation(null);
}
/**
* Topic
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a RequestInformation
*/
@javax.annotation.Nonnull
public RequestInformation toGetRequestInformation(@javax.annotation.Nullable final java.util.function.Consumer requestConfiguration) throws URISyntaxException {
final RequestInformation requestInfo = new RequestInformation();
requestInfo.httpMethod = HttpMethod.GET;
requestInfo.urlTemplate = urlTemplate;
requestInfo.pathParameters = pathParameters;
requestInfo.headers.add("Accept", "application/json");
if (requestConfiguration != null) {
final GetRequestConfiguration requestConfig = new GetRequestConfiguration();
requestConfiguration.accept(requestConfig);
requestInfo.headers.putAll(requestConfig.headers);
requestInfo.addRequestOptions(requestConfig.options);
}
return requestInfo;
}
/**
* Update the configuration settings for a topic.
* @param body The settings that are applicable to this topic. This includes partitions, configuration information, and number of replicas.
* @return a RequestInformation
*/
@javax.annotation.Nonnull
public RequestInformation toPatchRequestInformation(@javax.annotation.Nonnull final TopicSettings body) throws URISyntaxException {
return toPatchRequestInformation(body, null);
}
/**
* Update the configuration settings for a topic.
* @param body The settings that are applicable to this topic. This includes partitions, configuration information, and number of replicas.
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a RequestInformation
*/
@javax.annotation.Nonnull
public RequestInformation toPatchRequestInformation(@javax.annotation.Nonnull final TopicSettings body, @javax.annotation.Nullable final java.util.function.Consumer requestConfiguration) throws URISyntaxException {
Objects.requireNonNull(body);
final RequestInformation requestInfo = new RequestInformation();
requestInfo.httpMethod = HttpMethod.PATCH;
requestInfo.urlTemplate = urlTemplate;
requestInfo.pathParameters = pathParameters;
requestInfo.headers.add("Accept", "application/json");
requestInfo.setContentFromParsable(requestAdapter, "application/json", body);
if (requestConfiguration != null) {
final PatchRequestConfiguration requestConfig = new PatchRequestConfiguration();
requestConfiguration.accept(requestConfig);
requestInfo.headers.putAll(requestConfig.headers);
requestInfo.addRequestOptions(requestConfig.options);
}
return requestInfo;
}
/**
* Configuration for the request such as headers, query parameters, and middleware options.
*/
public class DeleteRequestConfiguration {
/** Request headers */
@javax.annotation.Nullable
public RequestHeaders headers = new RequestHeaders();
/** Request options */
@javax.annotation.Nullable
public java.util.List options = Collections.emptyList();
/**
* Instantiates a new DeleteRequestConfiguration and sets the default values.
* @return a void
*/
@javax.annotation.Nullable
public DeleteRequestConfiguration() {
}
}
/**
* Configuration for the request such as headers, query parameters, and middleware options.
*/
public class GetRequestConfiguration {
/** Request headers */
@javax.annotation.Nullable
public RequestHeaders headers = new RequestHeaders();
/** Request options */
@javax.annotation.Nullable
public java.util.List options = Collections.emptyList();
/**
* Instantiates a new GetRequestConfiguration and sets the default values.
* @return a void
*/
@javax.annotation.Nullable
public GetRequestConfiguration() {
}
}
/**
* Configuration for the request such as headers, query parameters, and middleware options.
*/
public class PatchRequestConfiguration {
/** Request headers */
@javax.annotation.Nullable
public RequestHeaders headers = new RequestHeaders();
/** Request options */
@javax.annotation.Nullable
public java.util.List options = Collections.emptyList();
/**
* Instantiates a new PatchRequestConfiguration and sets the default values.
* @return a void
*/
@javax.annotation.Nullable
public PatchRequestConfiguration() {
}
}
}