api.v1.acls.AclsRequestBuilder 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.acls;
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.acls.resourceoperations.ResourceOperationsRequestBuilder;
import com.openshift.cloud.api.kas.auth.models.AclBinding;
import com.openshift.cloud.api.kas.auth.models.AclBindingListPage;
import com.openshift.cloud.api.kas.auth.models.Error;
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/acls
*/
public class AclsRequestBuilder {
/** Path parameters for the request */
private HashMap pathParameters;
/** The request adapter to use to execute the requests. */
private RequestAdapter requestAdapter;
/** The resourceOperations property */
@javax.annotation.Nonnull
public ResourceOperationsRequestBuilder resourceOperations() {
return new ResourceOperationsRequestBuilder(pathParameters, requestAdapter);
}
/** Url template to use to build the URL for the current request builder */
private String urlTemplate;
/**
* Instantiates a new AclsRequestBuilder 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 AclsRequestBuilder(@javax.annotation.Nonnull final HashMap pathParameters, @javax.annotation.Nonnull final RequestAdapter requestAdapter) {
Objects.requireNonNull(pathParameters);
Objects.requireNonNull(requestAdapter);
this.urlTemplate = "{+baseurl}/api/v1/acls{?resourceType*,resourceName*,patternType*,principal*,operation*,permission*,page*,size*,order*,orderKey*,resourceType*,resourceName*,patternType*,principal*,operation*,permission*}";
final HashMap urlTplParams = new HashMap(pathParameters);
this.pathParameters = urlTplParams;
this.requestAdapter = requestAdapter;
}
/**
* Instantiates a new AclsRequestBuilder 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 AclsRequestBuilder(@javax.annotation.Nonnull final String rawUrl, @javax.annotation.Nonnull final RequestAdapter requestAdapter) {
this.urlTemplate = "{+baseurl}/api/v1/acls{?resourceType*,resourceName*,patternType*,principal*,operation*,permission*,page*,size*,order*,orderKey*,resourceType*,resourceName*,patternType*,principal*,operation*,permission*}";
final HashMap urlTplParams = new HashMap();
urlTplParams.put("request-raw-url", rawUrl);
this.pathParameters = urlTplParams;
this.requestAdapter = requestAdapter;
}
/**
* Deletes ACL bindings that match the query parameters.
* @return a CompletableFuture of AclBindingListPage
*/
@javax.annotation.Nonnull
public java.util.concurrent.CompletableFuture delete() {
try {
final RequestInformation requestInfo = toDeleteRequestInformation(null);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("400", Error::createFromDiscriminatorValue);
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", Error::createFromDiscriminatorValue);
errorMapping.put("500", Error::createFromDiscriminatorValue);
errorMapping.put("503", Error::createFromDiscriminatorValue);
return this.requestAdapter.sendAsync(requestInfo, AclBindingListPage::createFromDiscriminatorValue, errorMapping);
} catch (URISyntaxException ex) {
final java.util.concurrent.CompletableFuture executionException = new java.util.concurrent.CompletableFuture();
executionException.completeExceptionally(ex);
return executionException;
}
}
/**
* Deletes ACL bindings that match the query parameters.
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a CompletableFuture of AclBindingListPage
*/
@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("400", Error::createFromDiscriminatorValue);
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", Error::createFromDiscriminatorValue);
errorMapping.put("500", Error::createFromDiscriminatorValue);
errorMapping.put("503", Error::createFromDiscriminatorValue);
return this.requestAdapter.sendAsync(requestInfo, AclBindingListPage::createFromDiscriminatorValue, errorMapping);
} catch (URISyntaxException ex) {
final java.util.concurrent.CompletableFuture executionException = new java.util.concurrent.CompletableFuture();
executionException.completeExceptionally(ex);
return executionException;
}
}
/**
* Returns a list of all of the available ACL bindings, or the list of bindings that meet the user's URL query parameters. If no parameters are specified, all ACL bindings known to the system will be returned (with paging).
* @return a CompletableFuture of AclBindingListPage
*/
@javax.annotation.Nonnull
public java.util.concurrent.CompletableFuture get() {
try {
final RequestInformation requestInfo = toGetRequestInformation(null);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("400", Error::createFromDiscriminatorValue);
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", Error::createFromDiscriminatorValue);
errorMapping.put("500", Error::createFromDiscriminatorValue);
errorMapping.put("503", Error::createFromDiscriminatorValue);
return this.requestAdapter.sendAsync(requestInfo, AclBindingListPage::createFromDiscriminatorValue, errorMapping);
} catch (URISyntaxException ex) {
final java.util.concurrent.CompletableFuture executionException = new java.util.concurrent.CompletableFuture();
executionException.completeExceptionally(ex);
return executionException;
}
}
/**
* Returns a list of all of the available ACL bindings, or the list of bindings that meet the user's URL query parameters. If no parameters are specified, all ACL bindings known to the system will be returned (with paging).
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a CompletableFuture of AclBindingListPage
*/
@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("400", Error::createFromDiscriminatorValue);
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", Error::createFromDiscriminatorValue);
errorMapping.put("500", Error::createFromDiscriminatorValue);
errorMapping.put("503", Error::createFromDiscriminatorValue);
return this.requestAdapter.sendAsync(requestInfo, AclBindingListPage::createFromDiscriminatorValue, errorMapping);
} catch (URISyntaxException ex) {
final java.util.concurrent.CompletableFuture executionException = new java.util.concurrent.CompletableFuture();
executionException.completeExceptionally(ex);
return executionException;
}
}
/**
* Creates a new ACL binding for a Kafka instance.
* @param body The request body
* @return a CompletableFuture of void
*/
@javax.annotation.Nonnull
public java.util.concurrent.CompletableFuture post(@javax.annotation.Nonnull final AclBinding body) {
try {
final RequestInformation requestInfo = toPostRequestInformation(body, null);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("400", Error::createFromDiscriminatorValue);
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", 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;
}
}
/**
* Creates a new ACL binding for a Kafka instance.
* @param body The request body
* @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 post(@javax.annotation.Nonnull final AclBinding body, @javax.annotation.Nullable final java.util.function.Consumer requestConfiguration) {
Objects.requireNonNull(body);
try {
final RequestInformation requestInfo = toPostRequestInformation(body, requestConfiguration);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("400", Error::createFromDiscriminatorValue);
errorMapping.put("401", Error::createFromDiscriminatorValue);
errorMapping.put("403", 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 ACL bindings that match the query parameters.
* @return a RequestInformation
*/
@javax.annotation.Nonnull
public RequestInformation toDeleteRequestInformation() throws URISyntaxException {
return toDeleteRequestInformation(null);
}
/**
* Deletes ACL bindings that match the query parameters.
* @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;
requestInfo.headers.add("Accept", "application/json");
if (requestConfiguration != null) {
final DeleteRequestConfiguration requestConfig = new DeleteRequestConfiguration();
requestConfiguration.accept(requestConfig);
requestInfo.addQueryParameters(requestConfig.queryParameters);
requestInfo.headers.putAll(requestConfig.headers);
requestInfo.addRequestOptions(requestConfig.options);
}
return requestInfo;
}
/**
* Returns a list of all of the available ACL bindings, or the list of bindings that meet the user's URL query parameters. If no parameters are specified, all ACL bindings known to the system will be returned (with paging).
* @return a RequestInformation
*/
@javax.annotation.Nonnull
public RequestInformation toGetRequestInformation() throws URISyntaxException {
return toGetRequestInformation(null);
}
/**
* Returns a list of all of the available ACL bindings, or the list of bindings that meet the user's URL query parameters. If no parameters are specified, all ACL bindings known to the system will be returned (with paging).
* @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.addQueryParameters(requestConfig.queryParameters);
requestInfo.headers.putAll(requestConfig.headers);
requestInfo.addRequestOptions(requestConfig.options);
}
return requestInfo;
}
/**
* Creates a new ACL binding for a Kafka instance.
* @param body The request body
* @return a RequestInformation
*/
@javax.annotation.Nonnull
public RequestInformation toPostRequestInformation(@javax.annotation.Nonnull final AclBinding body) throws URISyntaxException {
return toPostRequestInformation(body, null);
}
/**
* Creates a new ACL binding for a Kafka instance.
* @param body The request body
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a RequestInformation
*/
@javax.annotation.Nonnull
public RequestInformation toPostRequestInformation(@javax.annotation.Nonnull final AclBinding body, @javax.annotation.Nullable final java.util.function.Consumer requestConfiguration) throws URISyntaxException {
Objects.requireNonNull(body);
final RequestInformation requestInfo = new RequestInformation();
requestInfo.httpMethod = HttpMethod.POST;
requestInfo.urlTemplate = urlTemplate;
requestInfo.pathParameters = pathParameters;
requestInfo.setContentFromParsable(requestAdapter, "application/json", body);
if (requestConfiguration != null) {
final PostRequestConfiguration requestConfig = new PostRequestConfiguration();
requestConfiguration.accept(requestConfig);
requestInfo.headers.putAll(requestConfig.headers);
requestInfo.addRequestOptions(requestConfig.options);
}
return requestInfo;
}
/**
* Deletes ACL bindings that match the query parameters.
*/
public class DeleteQueryParameters {
/** ACL Operation Filter. The ACL binding operation provided should be valid for the resource type in the request, if not `ANY`. */
@javax.annotation.Nullable
public String operation;
/** ACL Pattern Type Filter */
@javax.annotation.Nullable
public String patternType;
/** ACL Permission Type Filter */
@javax.annotation.Nullable
public String permission;
/** ACL Principal Filter. Either a specific user or the wildcard user `User:*` may be provided.- When fetching by a specific user, the results will also include ACL bindings that apply to all users.- When deleting, ACL bindings to be delete must match the provided `principal` exactly. */
@javax.annotation.Nullable
public String principal;
/** ACL Resource Name Filter */
@javax.annotation.Nullable
public String resourceName;
/** ACL Resource Type Filter */
@javax.annotation.Nullable
public String resourceType;
}
/**
* 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();
/** Request query parameters */
@javax.annotation.Nullable
public DeleteQueryParameters queryParameters = new DeleteQueryParameters();
/**
* Instantiates a new DeleteRequestConfiguration and sets the default values.
* @return a void
*/
@javax.annotation.Nullable
public DeleteRequestConfiguration() {
}
}
/**
* Returns a list of all of the available ACL bindings, or the list of bindings that meet the user's URL query parameters. If no parameters are specified, all ACL bindings known to the system will be returned (with paging).
*/
public class GetQueryParameters {
/** ACL Operation Filter. The ACL binding operation provided should be valid for the resource type in the request, if not `ANY`. */
@javax.annotation.Nullable
public String operation;
/** Order items are sorted */
@javax.annotation.Nullable
public String order;
@javax.annotation.Nullable
public String orderKey;
/** Page number */
@javax.annotation.Nullable
public Integer page;
/** ACL Pattern Type Filter */
@javax.annotation.Nullable
public String patternType;
/** ACL Permission Type Filter */
@javax.annotation.Nullable
public String permission;
/** ACL Principal Filter. Either a specific user or the wildcard user `User:*` may be provided.- When fetching by a specific user, the results will also include ACL bindings that apply to all users.- When deleting, ACL bindings to be delete must match the provided `principal` exactly. */
@javax.annotation.Nullable
public String principal;
/** ACL Resource Name Filter */
@javax.annotation.Nullable
public String resourceName;
/** ACL Resource Type Filter */
@javax.annotation.Nullable
public String resourceType;
/** Number of records per page */
@javax.annotation.Nullable
public Integer size;
}
/**
* 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();
/** Request query parameters */
@javax.annotation.Nullable
public GetQueryParameters queryParameters = new GetQueryParameters();
/**
* 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 PostRequestConfiguration {
/** 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 PostRequestConfiguration and sets the default values.
* @return a void
*/
@javax.annotation.Nullable
public PostRequestConfiguration() {
}
}
}