Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
dev.bf2.ffm.ams.client.api.DefaultApi Maven / Gradle / Ivy
/*
* Account Management Service API
* Manage user subscriptions and clusters
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package dev.bf2.ffm.ams.client.api;
import dev.bf2.ffm.ams.client.ApiClient;
import dev.bf2.ffm.ams.client.ApiException;
import dev.bf2.ffm.ams.client.ApiResponse;
import dev.bf2.ffm.ams.client.Pair;
import dev.bf2.ffm.ams.client.models.AccessReview;
import dev.bf2.ffm.ams.client.models.AccessReviewResponse;
import dev.bf2.ffm.ams.client.models.AccessTokenCfg;
import dev.bf2.ffm.ams.client.models.Account;
import dev.bf2.ffm.ams.client.models.AccountGroup;
import dev.bf2.ffm.ams.client.models.AccountGroupAssignment;
import dev.bf2.ffm.ams.client.models.AccountGroupAssignmentList;
import dev.bf2.ffm.ams.client.models.AccountGroupList;
import dev.bf2.ffm.ams.client.models.AccountGroupRequest;
import dev.bf2.ffm.ams.client.models.AccountList;
import dev.bf2.ffm.ams.client.models.AccountPatchRequest;
import dev.bf2.ffm.ams.client.models.CapabilityReview;
import dev.bf2.ffm.ams.client.models.CapabilityReviewRequest;
import dev.bf2.ffm.ams.client.models.Certificate;
import dev.bf2.ffm.ams.client.models.CertificatesRequest;
import dev.bf2.ffm.ams.client.models.CloudResource;
import dev.bf2.ffm.ams.client.models.CloudResourceList;
import dev.bf2.ffm.ams.client.models.ClusterAuthorizationRequest;
import dev.bf2.ffm.ams.client.models.ClusterAuthorizationResponse;
import dev.bf2.ffm.ams.client.models.ClusterRegistrationRequest;
import dev.bf2.ffm.ams.client.models.ClusterRegistrationResponse;
import dev.bf2.ffm.ams.client.models.ClusterTransfer;
import dev.bf2.ffm.ams.client.models.ClusterTransferList;
import dev.bf2.ffm.ams.client.models.ClusterTransferPatchRequest;
import dev.bf2.ffm.ams.client.models.ClusterTransferRequest;
import dev.bf2.ffm.ams.client.models.ConsumedQuotaList;
import dev.bf2.ffm.ams.client.models.DeletedSubscriptionList;
import dev.bf2.ffm.ams.client.models.Error;
import dev.bf2.ffm.ams.client.models.ErrorList;
import dev.bf2.ffm.ams.client.models.ExportControlReview;
import dev.bf2.ffm.ams.client.models.ExportControlReviewRequest;
import dev.bf2.ffm.ams.client.models.FeatureReview;
import dev.bf2.ffm.ams.client.models.FeatureReviewResponse;
import dev.bf2.ffm.ams.client.models.FeatureToggle;
import dev.bf2.ffm.ams.client.models.FeatureToggleQueryRequest;
import dev.bf2.ffm.ams.client.models.Label;
import dev.bf2.ffm.ams.client.models.LabelList;
import dev.bf2.ffm.ams.client.models.MetricsList;
import dev.bf2.ffm.ams.client.models.NotificationContactCreateRequest;
import dev.bf2.ffm.ams.client.models.NotificationRequest;
import dev.bf2.ffm.ams.client.models.Organization;
import dev.bf2.ffm.ams.client.models.OrganizationList;
import dev.bf2.ffm.ams.client.models.OrganizationPatchRequest;
import dev.bf2.ffm.ams.client.models.Plan;
import dev.bf2.ffm.ams.client.models.PlanList;
import dev.bf2.ffm.ams.client.models.PullSecretRequest;
import dev.bf2.ffm.ams.client.models.Quota;
import dev.bf2.ffm.ams.client.models.QuotaCostList;
import dev.bf2.ffm.ams.client.models.QuotaList;
import dev.bf2.ffm.ams.client.models.QuotaRulesList;
import dev.bf2.ffm.ams.client.models.Registry;
import dev.bf2.ffm.ams.client.models.RegistryCredential;
import dev.bf2.ffm.ams.client.models.RegistryCredentialList;
import dev.bf2.ffm.ams.client.models.RegistryCredentialPatchRequest;
import dev.bf2.ffm.ams.client.models.RegistryList;
import dev.bf2.ffm.ams.client.models.ReservedResource;
import dev.bf2.ffm.ams.client.models.ReservedResourceList;
import dev.bf2.ffm.ams.client.models.ReservedResourcePatchRequest;
import dev.bf2.ffm.ams.client.models.ResourceQuota;
import dev.bf2.ffm.ams.client.models.ResourceQuotaList;
import dev.bf2.ffm.ams.client.models.ResourceQuotaRequest;
import dev.bf2.ffm.ams.client.models.ResourceReview;
import dev.bf2.ffm.ams.client.models.ResourceReviewRequest;
import dev.bf2.ffm.ams.client.models.Role;
import dev.bf2.ffm.ams.client.models.RoleBinding;
import dev.bf2.ffm.ams.client.models.RoleBindingCreateRequest;
import dev.bf2.ffm.ams.client.models.RoleBindingList;
import dev.bf2.ffm.ams.client.models.RoleBindingRequest;
import dev.bf2.ffm.ams.client.models.RoleList;
import dev.bf2.ffm.ams.client.models.SKU;
import dev.bf2.ffm.ams.client.models.SelfAccessReview;
import dev.bf2.ffm.ams.client.models.SelfEntitlementStatus;
import dev.bf2.ffm.ams.client.models.SelfFeatureReview;
import dev.bf2.ffm.ams.client.models.SelfResourceReview;
import dev.bf2.ffm.ams.client.models.SelfResourceReviewRequest;
import dev.bf2.ffm.ams.client.models.SelfServiceLandingPageSchema;
import dev.bf2.ffm.ams.client.models.SelfTermsReview;
import dev.bf2.ffm.ams.client.models.SkuList;
import dev.bf2.ffm.ams.client.models.SkuRules;
import dev.bf2.ffm.ams.client.models.SkuRulesList;
import dev.bf2.ffm.ams.client.models.Subscription;
import dev.bf2.ffm.ams.client.models.SubscriptionCreateRequest;
import dev.bf2.ffm.ams.client.models.SubscriptionList;
import dev.bf2.ffm.ams.client.models.SubscriptionMetricList;
import dev.bf2.ffm.ams.client.models.SubscriptionPatchRequest;
import dev.bf2.ffm.ams.client.models.SubscriptionRoleBinding;
import dev.bf2.ffm.ams.client.models.SubscriptionRoleBindingCreateRequest;
import dev.bf2.ffm.ams.client.models.SubscriptionRoleBindingList;
import dev.bf2.ffm.ams.client.models.Summary;
import dev.bf2.ffm.ams.client.models.SupportCasesCreatedResponse;
import dev.bf2.ffm.ams.client.models.SupportCasesRequest;
import dev.bf2.ffm.ams.client.models.TermsReview;
import dev.bf2.ffm.ams.client.models.TermsReviewResponse;
import dev.bf2.ffm.ams.client.models.TokenAuthorizationRequest;
import dev.bf2.ffm.ams.client.models.TokenAuthorizationResponse;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.ArrayList;
import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.concurrent.CompletableFuture;
@javax.annotation.processing.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class DefaultApi {
private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri;
private final Consumer memberVarInterceptor;
private final Duration memberVarReadTimeout;
private final Consumer> memberVarResponseInterceptor;
private final Consumer> memberVarAsyncResponseInterceptor;
public DefaultApi() {
this(new ApiClient());
}
public DefaultApi(ApiClient apiClient) {
memberVarHttpClient = apiClient.getHttpClient();
memberVarObjectMapper = apiClient.getObjectMapper();
memberVarBaseUri = apiClient.getBaseUri();
memberVarInterceptor = apiClient.getRequestInterceptor();
memberVarReadTimeout = apiClient.getReadTimeout();
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body());
}
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
}
return operationId + " call failed with: " + statusCode + " - " + body;
}
/**
* Return access token generated from registries in docker format
*
* @return CompletableFuture<AccessTokenCfg>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1AccessTokenPost() throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccessTokenPostRequestBuilder();
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccessTokenPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Return access token generated from registries in docker format
*
* @return CompletableFuture<ApiResponse<AccessTokenCfg>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1AccessTokenPostWithHttpInfo() throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccessTokenPostRequestBuilder();
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccessTokenPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1AccessTokenPostRequestBuilder() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/access_token";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of accounts
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @param fields Supplies a comma-separated list of fields to be returned. Fields of sub-structures and of arrays use <structure>.<field> notation. <stucture>.* means all field of a structure Example: For each Subscription to get id, href, plan(id and kind) and labels (all fields) ``` ocm get subscriptions --parameter fields=id,href,plan.id,plan.kind,labels.* --parameter fetchLabels=true ``` (optional)
* @param fetchLabels If true, includes the labels on a subscription/organization/account in the output. Could slow request response time. (optional)
* @param fetchCapabilities If true, includes the capabilities on a subscription in the output. Could slow request response time. (optional)
* @return CompletableFuture<AccountList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1AccountsGet(Integer page, Integer size, String search, String orderBy, String fields, Boolean fetchLabels, Boolean fetchCapabilities) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsGetRequestBuilder(page, size, search, orderBy, fields, fetchLabels, fetchCapabilities);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of accounts
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @param fields Supplies a comma-separated list of fields to be returned. Fields of sub-structures and of arrays use <structure>.<field> notation. <stucture>.* means all field of a structure Example: For each Subscription to get id, href, plan(id and kind) and labels (all fields) ``` ocm get subscriptions --parameter fields=id,href,plan.id,plan.kind,labels.* --parameter fetchLabels=true ``` (optional)
* @param fetchLabels If true, includes the labels on a subscription/organization/account in the output. Could slow request response time. (optional)
* @param fetchCapabilities If true, includes the capabilities on a subscription in the output. Could slow request response time. (optional)
* @return CompletableFuture<ApiResponse<AccountList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1AccountsGetWithHttpInfo(Integer page, Integer size, String search, String orderBy, String fields, Boolean fetchLabels, Boolean fetchCapabilities) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsGetRequestBuilder(page, size, search, orderBy, fields, fetchLabels, fetchCapabilities);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1AccountsGetRequestBuilder(Integer page, Integer size, String search, String orderBy, String fields, Boolean fetchLabels, Boolean fetchCapabilities) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/accounts";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
localVarQueryParams.addAll(ApiClient.parameterToPairs("orderBy", orderBy));
localVarQueryParams.addAll(ApiClient.parameterToPairs("fields", fields));
localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchLabels", fetchLabels));
localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchCapabilities", fetchCapabilities));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get an account by id
*
* @param id The id of record (required)
* @param fetchLabels If true, includes the labels on a subscription/organization/account in the output. Could slow request response time. (optional)
* @param fetchCapabilities If true, includes the capabilities on a subscription in the output. Could slow request response time. (optional)
* @param fetchRhit If true, includes the RHIT account_id in the output. Could slow request response time. (optional)
* @return CompletableFuture<Account>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1AccountsIdGet(String id, Boolean fetchLabels, Boolean fetchCapabilities, Boolean fetchRhit) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdGetRequestBuilder(id, fetchLabels, fetchCapabilities, fetchRhit);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Get an account by id
*
* @param id The id of record (required)
* @param fetchLabels If true, includes the labels on a subscription/organization/account in the output. Could slow request response time. (optional)
* @param fetchCapabilities If true, includes the capabilities on a subscription in the output. Could slow request response time. (optional)
* @param fetchRhit If true, includes the RHIT account_id in the output. Could slow request response time. (optional)
* @return CompletableFuture<ApiResponse<Account>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1AccountsIdGetWithHttpInfo(String id, Boolean fetchLabels, Boolean fetchCapabilities, Boolean fetchRhit) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdGetRequestBuilder(id, fetchLabels, fetchCapabilities, fetchRhit);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1AccountsIdGetRequestBuilder(String id, Boolean fetchLabels, Boolean fetchCapabilities, Boolean fetchRhit) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1AccountsIdGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/accounts/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchLabels", fetchLabels));
localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchCapabilities", fetchCapabilities));
localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchRhit", fetchRhit));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of labels
*
* @param id The id of record (required)
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<LabelList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1AccountsIdLabelsGet(String id, Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdLabelsGetRequestBuilder(id, page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdLabelsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of labels
*
* @param id The id of record (required)
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<ApiResponse<LabelList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1AccountsIdLabelsGetWithHttpInfo(String id, Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdLabelsGetRequestBuilder(id, page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdLabelsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1AccountsIdLabelsGetRequestBuilder(String id, Integer page, Integer size, String search, String orderBy) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1AccountsIdLabelsGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/accounts/{id}/labels"
.replace("{id}", ApiClient.urlEncode(id.toString()));
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
localVarQueryParams.addAll(ApiClient.parameterToPairs("orderBy", orderBy));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Delete a label
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @return CompletableFuture<Void>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1AccountsIdLabelsKeyDelete(String id, String key) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdLabelsKeyDeleteRequestBuilder(id, key);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdLabelsKeyDelete", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Delete a label
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @return CompletableFuture<ApiResponse<Void>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1AccountsIdLabelsKeyDeleteWithHttpInfo(String id, String key) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdLabelsKeyDeleteRequestBuilder(id, key);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdLabelsKeyDelete", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1AccountsIdLabelsKeyDeleteRequestBuilder(String id, String key) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1AccountsIdLabelsKeyDelete");
}
// verify the required parameter 'key' is set
if (key == null) {
throw new ApiException(400, "Missing the required parameter 'key' when calling apiAccountsMgmtV1AccountsIdLabelsKeyDelete");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/accounts/{id}/labels/{key}"
.replace("{id}", ApiClient.urlEncode(id.toString()))
.replace("{key}", ApiClient.urlEncode(key.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get subscription labels by label key
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @return CompletableFuture<Label>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1AccountsIdLabelsKeyGet(String id, String key) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdLabelsKeyGetRequestBuilder(id, key);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdLabelsKeyGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Get subscription labels by label key
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @return CompletableFuture<ApiResponse<Label>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1AccountsIdLabelsKeyGetWithHttpInfo(String id, String key) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdLabelsKeyGetRequestBuilder(id, key);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdLabelsKeyGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1AccountsIdLabelsKeyGetRequestBuilder(String id, String key) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1AccountsIdLabelsKeyGet");
}
// verify the required parameter 'key' is set
if (key == null) {
throw new ApiException(400, "Missing the required parameter 'key' when calling apiAccountsMgmtV1AccountsIdLabelsKeyGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/accounts/{id}/labels/{key}"
.replace("{id}", ApiClient.urlEncode(id.toString()))
.replace("{key}", ApiClient.urlEncode(key.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Create a new label or update an existing label
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @param label Label data (required)
* @return CompletableFuture<Label>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1AccountsIdLabelsKeyPatch(String id, String key, Label label) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdLabelsKeyPatchRequestBuilder(id, key, label);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdLabelsKeyPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Create a new label or update an existing label
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @param label Label data (required)
* @return CompletableFuture<ApiResponse<Label>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1AccountsIdLabelsKeyPatchWithHttpInfo(String id, String key, Label label) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdLabelsKeyPatchRequestBuilder(id, key, label);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdLabelsKeyPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1AccountsIdLabelsKeyPatchRequestBuilder(String id, String key, Label label) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1AccountsIdLabelsKeyPatch");
}
// verify the required parameter 'key' is set
if (key == null) {
throw new ApiException(400, "Missing the required parameter 'key' when calling apiAccountsMgmtV1AccountsIdLabelsKeyPatch");
}
// verify the required parameter 'label' is set
if (label == null) {
throw new ApiException(400, "Missing the required parameter 'label' when calling apiAccountsMgmtV1AccountsIdLabelsKeyPatch");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/accounts/{id}/labels/{key}"
.replace("{id}", ApiClient.urlEncode(id.toString()))
.replace("{key}", ApiClient.urlEncode(key.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(label);
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Create a new label or update an existing label
*
* @param id The id of record (required)
* @param label Label data (required)
* @return CompletableFuture<Label>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1AccountsIdLabelsPost(String id, Label label) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdLabelsPostRequestBuilder(id, label);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdLabelsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Create a new label or update an existing label
*
* @param id The id of record (required)
* @param label Label data (required)
* @return CompletableFuture<ApiResponse<Label>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1AccountsIdLabelsPostWithHttpInfo(String id, Label label) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdLabelsPostRequestBuilder(id, label);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdLabelsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1AccountsIdLabelsPostRequestBuilder(String id, Label label) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1AccountsIdLabelsPost");
}
// verify the required parameter 'label' is set
if (label == null) {
throw new ApiException(400, "Missing the required parameter 'label' when calling apiAccountsMgmtV1AccountsIdLabelsPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/accounts/{id}/labels"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(label);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Update an account
*
* @param id The id of record (required)
* @param accountPatchRequest Updated account data (required)
* @return CompletableFuture<Account>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1AccountsIdPatch(String id, AccountPatchRequest accountPatchRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdPatchRequestBuilder(id, accountPatchRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Update an account
*
* @param id The id of record (required)
* @param accountPatchRequest Updated account data (required)
* @return CompletableFuture<ApiResponse<Account>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1AccountsIdPatchWithHttpInfo(String id, AccountPatchRequest accountPatchRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsIdPatchRequestBuilder(id, accountPatchRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsIdPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1AccountsIdPatchRequestBuilder(String id, AccountPatchRequest accountPatchRequest) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1AccountsIdPatch");
}
// verify the required parameter 'accountPatchRequest' is set
if (accountPatchRequest == null) {
throw new ApiException(400, "Missing the required parameter 'accountPatchRequest' when calling apiAccountsMgmtV1AccountsIdPatch");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/accounts/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(accountPatchRequest);
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Create a new account
*
* @param account Account data (required)
* @param dryRun If true, instructs API to avoid making any changes, but rather run through validations only. (optional)
* @return CompletableFuture<Account>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1AccountsPost(Account account, Boolean dryRun) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsPostRequestBuilder(account, dryRun);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Create a new account
*
* @param account Account data (required)
* @param dryRun If true, instructs API to avoid making any changes, but rather run through validations only. (optional)
* @return CompletableFuture<ApiResponse<Account>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1AccountsPostWithHttpInfo(Account account, Boolean dryRun) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1AccountsPostRequestBuilder(account, dryRun);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1AccountsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1AccountsPostRequestBuilder(Account account, Boolean dryRun) throws ApiException {
// verify the required parameter 'account' is set
if (account == null) {
throw new ApiException(400, "Missing the required parameter 'account' when calling apiAccountsMgmtV1AccountsPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/accounts";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("dryRun", dryRun));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(account);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Fetch certificates of a particular type
*
* @param certificatesRequest # The payload depends on the type of the requested certificate The examples for supported types: * {\"type\": \"sca\", \"arch\": \"x86_64\"} (required)
* @return CompletableFuture<Certificate>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1CertificatesPost(CertificatesRequest certificatesRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CertificatesPostRequestBuilder(certificatesRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CertificatesPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Fetch certificates of a particular type
*
* @param certificatesRequest # The payload depends on the type of the requested certificate The examples for supported types: * {\"type\": \"sca\", \"arch\": \"x86_64\"} (required)
* @return CompletableFuture<ApiResponse<Certificate>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1CertificatesPostWithHttpInfo(CertificatesRequest certificatesRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CertificatesPostRequestBuilder(certificatesRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CertificatesPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1CertificatesPostRequestBuilder(CertificatesRequest certificatesRequest) throws ApiException {
// verify the required parameter 'certificatesRequest' is set
if (certificatesRequest == null) {
throw new ApiException(400, "Missing the required parameter 'certificatesRequest' when calling apiAccountsMgmtV1CertificatesPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/certificates";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(certificatesRequest);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of cloud resources
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @return CompletableFuture<CloudResourceList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1CloudResourcesGet(Integer page, Integer size, String search) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CloudResourcesGetRequestBuilder(page, size, search);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CloudResourcesGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of cloud resources
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @return CompletableFuture<ApiResponse<CloudResourceList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1CloudResourcesGetWithHttpInfo(Integer page, Integer size, String search) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CloudResourcesGetRequestBuilder(page, size, search);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CloudResourcesGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1CloudResourcesGetRequestBuilder(Integer page, Integer size, String search) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/cloud_resources";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Delete a cloud resource
*
* @param id The id of record (required)
* @return CompletableFuture<Void>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1CloudResourcesIdDelete(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CloudResourcesIdDeleteRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CloudResourcesIdDelete", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Delete a cloud resource
*
* @param id The id of record (required)
* @return CompletableFuture<ApiResponse<Void>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1CloudResourcesIdDeleteWithHttpInfo(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CloudResourcesIdDeleteRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CloudResourcesIdDelete", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1CloudResourcesIdDeleteRequestBuilder(String id) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1CloudResourcesIdDelete");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/cloud_resources/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get a cloud resource
*
* @param id The id of record (required)
* @return CompletableFuture<CloudResource>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1CloudResourcesIdGet(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CloudResourcesIdGetRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CloudResourcesIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Get a cloud resource
*
* @param id The id of record (required)
* @return CompletableFuture<ApiResponse<CloudResource>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1CloudResourcesIdGetWithHttpInfo(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CloudResourcesIdGetRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CloudResourcesIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1CloudResourcesIdGetRequestBuilder(String id) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1CloudResourcesIdGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/cloud_resources/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Update a cloud resource
*
* @param id The id of record (required)
* @param cloudResource Updated cloud resource data (required)
* @return CompletableFuture<CloudResource>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1CloudResourcesIdPatch(String id, CloudResource cloudResource) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CloudResourcesIdPatchRequestBuilder(id, cloudResource);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CloudResourcesIdPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Update a cloud resource
*
* @param id The id of record (required)
* @param cloudResource Updated cloud resource data (required)
* @return CompletableFuture<ApiResponse<CloudResource>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1CloudResourcesIdPatchWithHttpInfo(String id, CloudResource cloudResource) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CloudResourcesIdPatchRequestBuilder(id, cloudResource);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CloudResourcesIdPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1CloudResourcesIdPatchRequestBuilder(String id, CloudResource cloudResource) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1CloudResourcesIdPatch");
}
// verify the required parameter 'cloudResource' is set
if (cloudResource == null) {
throw new ApiException(400, "Missing the required parameter 'cloudResource' when calling apiAccountsMgmtV1CloudResourcesIdPatch");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/cloud_resources/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(cloudResource);
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Create a new cloud resource
*
* @param cloudResource Cloud resource data (required)
* @return CompletableFuture<CloudResource>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1CloudResourcesPost(CloudResource cloudResource) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CloudResourcesPostRequestBuilder(cloudResource);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CloudResourcesPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Create a new cloud resource
*
* @param cloudResource Cloud resource data (required)
* @return CompletableFuture<ApiResponse<CloudResource>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1CloudResourcesPostWithHttpInfo(CloudResource cloudResource) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CloudResourcesPostRequestBuilder(cloudResource);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CloudResourcesPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1CloudResourcesPostRequestBuilder(CloudResource cloudResource) throws ApiException {
// verify the required parameter 'cloudResource' is set
if (cloudResource == null) {
throw new ApiException(400, "Missing the required parameter 'cloudResource' when calling apiAccountsMgmtV1CloudResourcesPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/cloud_resources";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(cloudResource);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Authorizes new cluster creation against an exsiting RH Subscription.
*
* @param clusterAuthorizationRequest Cluster and authorization data (required)
* @return CompletableFuture<ClusterAuthorizationResponse>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ClusterAuthorizationsPost(ClusterAuthorizationRequest clusterAuthorizationRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ClusterAuthorizationsPostRequestBuilder(clusterAuthorizationRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ClusterAuthorizationsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Authorizes new cluster creation against an exsiting RH Subscription.
*
* @param clusterAuthorizationRequest Cluster and authorization data (required)
* @return CompletableFuture<ApiResponse<ClusterAuthorizationResponse>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ClusterAuthorizationsPostWithHttpInfo(ClusterAuthorizationRequest clusterAuthorizationRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ClusterAuthorizationsPostRequestBuilder(clusterAuthorizationRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ClusterAuthorizationsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ClusterAuthorizationsPostRequestBuilder(ClusterAuthorizationRequest clusterAuthorizationRequest) throws ApiException {
// verify the required parameter 'clusterAuthorizationRequest' is set
if (clusterAuthorizationRequest == null) {
throw new ApiException(400, "Missing the required parameter 'clusterAuthorizationRequest' when calling apiAccountsMgmtV1ClusterAuthorizationsPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/cluster_authorizations";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(clusterAuthorizationRequest);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Finds or creates a cluster registration with a registy credential token and cluster ID
*
* @param clusterRegistrationRequest Cluster and authorization data (required)
* @return CompletableFuture<ClusterRegistrationResponse>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ClusterRegistrationsPost(ClusterRegistrationRequest clusterRegistrationRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ClusterRegistrationsPostRequestBuilder(clusterRegistrationRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ClusterRegistrationsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Finds or creates a cluster registration with a registy credential token and cluster ID
*
* @param clusterRegistrationRequest Cluster and authorization data (required)
* @return CompletableFuture<ApiResponse<ClusterRegistrationResponse>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ClusterRegistrationsPostWithHttpInfo(ClusterRegistrationRequest clusterRegistrationRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ClusterRegistrationsPostRequestBuilder(clusterRegistrationRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ClusterRegistrationsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ClusterRegistrationsPostRequestBuilder(ClusterRegistrationRequest clusterRegistrationRequest) throws ApiException {
// verify the required parameter 'clusterRegistrationRequest' is set
if (clusterRegistrationRequest == null) {
throw new ApiException(400, "Missing the required parameter 'clusterRegistrationRequest' when calling apiAccountsMgmtV1ClusterRegistrationsPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/cluster_registrations";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(clusterRegistrationRequest);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* List cluster transfers - returns either an empty result set or a valid ClusterTransfer instance that is within a valid transfer window.
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<ClusterTransferList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ClusterTransfersGet(Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ClusterTransfersGetRequestBuilder(page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ClusterTransfersGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* List cluster transfers - returns either an empty result set or a valid ClusterTransfer instance that is within a valid transfer window.
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<ApiResponse<ClusterTransferList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ClusterTransfersGetWithHttpInfo(Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ClusterTransfersGetRequestBuilder(page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ClusterTransfersGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ClusterTransfersGetRequestBuilder(Integer page, Integer size, String search, String orderBy) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/cluster_transfers";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
localVarQueryParams.addAll(ApiClient.parameterToPairs("orderBy", orderBy));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Update specific cluster transfer
*
* @param id The id of record (required)
* @param clusterTransferPatchRequest Updated cluster transfer (required)
* @return CompletableFuture<ClusterTransfer>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ClusterTransfersIdPatch(String id, ClusterTransferPatchRequest clusterTransferPatchRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ClusterTransfersIdPatchRequestBuilder(id, clusterTransferPatchRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ClusterTransfersIdPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Update specific cluster transfer
*
* @param id The id of record (required)
* @param clusterTransferPatchRequest Updated cluster transfer (required)
* @return CompletableFuture<ApiResponse<ClusterTransfer>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ClusterTransfersIdPatchWithHttpInfo(String id, ClusterTransferPatchRequest clusterTransferPatchRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ClusterTransfersIdPatchRequestBuilder(id, clusterTransferPatchRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ClusterTransfersIdPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ClusterTransfersIdPatchRequestBuilder(String id, ClusterTransferPatchRequest clusterTransferPatchRequest) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1ClusterTransfersIdPatch");
}
// verify the required parameter 'clusterTransferPatchRequest' is set
if (clusterTransferPatchRequest == null) {
throw new ApiException(400, "Missing the required parameter 'clusterTransferPatchRequest' when calling apiAccountsMgmtV1ClusterTransfersIdPatch");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/cluster_transfers/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(clusterTransferPatchRequest);
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Initiate cluster transfer.
*
* @param clusterTransferRequest The contents of the cluster transfer creation request (required)
* @return CompletableFuture<ClusterTransfer>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ClusterTransfersPost(ClusterTransferRequest clusterTransferRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ClusterTransfersPostRequestBuilder(clusterTransferRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ClusterTransfersPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Initiate cluster transfer.
*
* @param clusterTransferRequest The contents of the cluster transfer creation request (required)
* @return CompletableFuture<ApiResponse<ClusterTransfer>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ClusterTransfersPostWithHttpInfo(ClusterTransferRequest clusterTransferRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ClusterTransfersPostRequestBuilder(clusterTransferRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ClusterTransfersPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ClusterTransfersPostRequestBuilder(ClusterTransferRequest clusterTransferRequest) throws ApiException {
// verify the required parameter 'clusterTransferRequest' is set
if (clusterTransferRequest == null) {
throw new ApiException(400, "Missing the required parameter 'clusterTransferRequest' when calling apiAccountsMgmtV1ClusterTransfersPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/cluster_transfers";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(clusterTransferRequest);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of skus
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @return CompletableFuture<SkuList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ConfigSkusGet(Integer page, Integer size, String search) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ConfigSkusGetRequestBuilder(page, size, search);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ConfigSkusGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of skus
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @return CompletableFuture<ApiResponse<SkuList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ConfigSkusGetWithHttpInfo(Integer page, Integer size, String search) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ConfigSkusGetRequestBuilder(page, size, search);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ConfigSkusGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ConfigSkusGetRequestBuilder(Integer page, Integer size, String search) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/config/skus";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Delete a sku
*
* @param id The id of record (required)
* @return CompletableFuture<Void>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ConfigSkusIdDelete(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ConfigSkusIdDeleteRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ConfigSkusIdDelete", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Delete a sku
*
* @param id The id of record (required)
* @return CompletableFuture<ApiResponse<Void>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ConfigSkusIdDeleteWithHttpInfo(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ConfigSkusIdDeleteRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ConfigSkusIdDelete", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ConfigSkusIdDeleteRequestBuilder(String id) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1ConfigSkusIdDelete");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/config/skus/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get a sku
*
* @param id The id of record (required)
* @return CompletableFuture<SKU>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ConfigSkusIdGet(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ConfigSkusIdGetRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ConfigSkusIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Get a sku
*
* @param id The id of record (required)
* @return CompletableFuture<ApiResponse<SKU>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ConfigSkusIdGetWithHttpInfo(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ConfigSkusIdGetRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ConfigSkusIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ConfigSkusIdGetRequestBuilder(String id) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1ConfigSkusIdGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/config/skus/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Update a Sku
*
* @param id The id of record (required)
* @param SKU Updated sku data (required)
* @return CompletableFuture<SKU>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ConfigSkusIdPatch(String id, SKU SKU) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ConfigSkusIdPatchRequestBuilder(id, SKU);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ConfigSkusIdPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Update a Sku
*
* @param id The id of record (required)
* @param SKU Updated sku data (required)
* @return CompletableFuture<ApiResponse<SKU>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ConfigSkusIdPatchWithHttpInfo(String id, SKU SKU) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ConfigSkusIdPatchRequestBuilder(id, SKU);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ConfigSkusIdPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ConfigSkusIdPatchRequestBuilder(String id, SKU SKU) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1ConfigSkusIdPatch");
}
// verify the required parameter 'SKU' is set
if (SKU == null) {
throw new ApiException(400, "Missing the required parameter 'SKU' when calling apiAccountsMgmtV1ConfigSkusIdPatch");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/config/skus/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(SKU);
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Create a new sku
*
* @param SKU Sku data (required)
* @return CompletableFuture<SKU>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ConfigSkusPost(SKU SKU) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ConfigSkusPostRequestBuilder(SKU);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ConfigSkusPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Create a new sku
*
* @param SKU Sku data (required)
* @return CompletableFuture<ApiResponse<SKU>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ConfigSkusPostWithHttpInfo(SKU SKU) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ConfigSkusPostRequestBuilder(SKU);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ConfigSkusPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ConfigSkusPostRequestBuilder(SKU SKU) throws ApiException {
// verify the required parameter 'SKU' is set
if (SKU == null) {
throw new ApiException(400, "Missing the required parameter 'SKU' when calling apiAccountsMgmtV1ConfigSkusPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/config/skus";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(SKU);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get the authenticated account
*
* @param fetchLabels If true, includes the labels on a subscription/organization/account in the output. Could slow request response time. (optional)
* @return CompletableFuture<Account>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1CurrentAccountGet(Boolean fetchLabels) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CurrentAccountGetRequestBuilder(fetchLabels);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CurrentAccountGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Get the authenticated account
*
* @param fetchLabels If true, includes the labels on a subscription/organization/account in the output. Could slow request response time. (optional)
* @return CompletableFuture<ApiResponse<Account>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1CurrentAccountGetWithHttpInfo(Boolean fetchLabels) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1CurrentAccountGetRequestBuilder(fetchLabels);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1CurrentAccountGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1CurrentAccountGetRequestBuilder(Boolean fetchLabels) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/current_account";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchLabels", fetchLabels));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of deleted subscriptions
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<DeletedSubscriptionList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1DeletedSubscriptionsGet(Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1DeletedSubscriptionsGetRequestBuilder(page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1DeletedSubscriptionsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of deleted subscriptions
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<ApiResponse<DeletedSubscriptionList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1DeletedSubscriptionsGetWithHttpInfo(Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1DeletedSubscriptionsGetRequestBuilder(page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1DeletedSubscriptionsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1DeletedSubscriptionsGetRequestBuilder(Integer page, Integer size, String search, String orderBy) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/deleted_subscriptions";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
localVarQueryParams.addAll(ApiClient.parameterToPairs("orderBy", orderBy));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of errors
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @return CompletableFuture<ErrorList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ErrorsGet(Integer page, Integer size, String search) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ErrorsGetRequestBuilder(page, size, search);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ErrorsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of errors
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @return CompletableFuture<ApiResponse<ErrorList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ErrorsGetWithHttpInfo(Integer page, Integer size, String search) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ErrorsGetRequestBuilder(page, size, search);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ErrorsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ErrorsGetRequestBuilder(Integer page, Integer size, String search) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/errors";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get an error by id
*
* @param id The id of record (required)
* @return CompletableFuture<Error>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1ErrorsIdGet(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ErrorsIdGetRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ErrorsIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Get an error by id
*
* @param id The id of record (required)
* @return CompletableFuture<ApiResponse<Error>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1ErrorsIdGetWithHttpInfo(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ErrorsIdGetRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ErrorsIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1ErrorsIdGetRequestBuilder(String id) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1ErrorsIdGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/errors/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Query a feature toggle by id
*
* @param id The id of record (required)
* @param featureToggleQueryRequest The context of the query (required)
* @return CompletableFuture<FeatureToggle>
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public CompletableFuture apiAccountsMgmtV1FeatureTogglesIdQueryPost(String id, FeatureToggleQueryRequest featureToggleQueryRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1FeatureTogglesIdQueryPostRequestBuilder(id, featureToggleQueryRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1FeatureTogglesIdQueryPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Query a feature toggle by id
*
* @param id The id of record (required)
* @param featureToggleQueryRequest The context of the query (required)
* @return CompletableFuture<ApiResponse<FeatureToggle>>
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public CompletableFuture> apiAccountsMgmtV1FeatureTogglesIdQueryPostWithHttpInfo(String id, FeatureToggleQueryRequest featureToggleQueryRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1FeatureTogglesIdQueryPostRequestBuilder(id, featureToggleQueryRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1FeatureTogglesIdQueryPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1FeatureTogglesIdQueryPostRequestBuilder(String id, FeatureToggleQueryRequest featureToggleQueryRequest) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1FeatureTogglesIdQueryPost");
}
// verify the required parameter 'featureToggleQueryRequest' is set
if (featureToggleQueryRequest == null) {
throw new ApiException(400, "Missing the required parameter 'featureToggleQueryRequest' when calling apiAccountsMgmtV1FeatureTogglesIdQueryPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/feature_toggles/{id}/query"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(featureToggleQueryRequest);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of labels
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<LabelList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1LabelsGet(Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1LabelsGetRequestBuilder(page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1LabelsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of labels
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<ApiResponse<LabelList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1LabelsGetWithHttpInfo(Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1LabelsGetRequestBuilder(page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1LabelsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1LabelsGetRequestBuilder(Integer page, Integer size, String search, String orderBy) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/labels";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
localVarQueryParams.addAll(ApiClient.parameterToPairs("orderBy", orderBy));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get a console.redhat.com landing page content JSON schema
*
* @return CompletableFuture<SelfServiceLandingPageSchema>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1LandingPageSelfServiceGet() throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1LandingPageSelfServiceGetRequestBuilder();
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1LandingPageSelfServiceGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Get a console.redhat.com landing page content JSON schema
*
* @return CompletableFuture<ApiResponse<SelfServiceLandingPageSchema>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1LandingPageSelfServiceGetWithHttpInfo() throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1LandingPageSelfServiceGetRequestBuilder();
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1LandingPageSelfServiceGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1LandingPageSelfServiceGetRequestBuilder() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/landing_page/self_service";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of metrics
*
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @return CompletableFuture<MetricsList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1MetricsGet(String search) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1MetricsGetRequestBuilder(search);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1MetricsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of metrics
*
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @return CompletableFuture<ApiResponse<MetricsList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1MetricsGetWithHttpInfo(String search) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1MetricsGetRequestBuilder(search);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1MetricsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1MetricsGetRequestBuilder(String search) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/metrics";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Notify the owner of cluster/subscription
*
* @param notificationRequest The contents of the notification to send to the owner of a cluster/subscription in addition to the set of template parameters which are sent automatically ACCOUNT_USERNAME, FIRST_NAME, LAST_NAME, ORGANIZATION_NAME, ORGANIZATION_EXTERNAL_ID (required)
* @return CompletableFuture<Void>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1NotifyPost(NotificationRequest notificationRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1NotifyPostRequestBuilder(notificationRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1NotifyPost", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Notify the owner of cluster/subscription
*
* @param notificationRequest The contents of the notification to send to the owner of a cluster/subscription in addition to the set of template parameters which are sent automatically ACCOUNT_USERNAME, FIRST_NAME, LAST_NAME, ORGANIZATION_NAME, ORGANIZATION_EXTERNAL_ID (required)
* @return CompletableFuture<ApiResponse<Void>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1NotifyPostWithHttpInfo(NotificationRequest notificationRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1NotifyPostRequestBuilder(notificationRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1NotifyPost", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1NotifyPostRequestBuilder(NotificationRequest notificationRequest) throws ApiException {
// verify the required parameter 'notificationRequest' is set
if (notificationRequest == null) {
throw new ApiException(400, "Missing the required parameter 'notificationRequest' when calling apiAccountsMgmtV1NotifyPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/notify";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(notificationRequest);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of organizations
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @param fetchLabels If true, includes the labels on a subscription/organization/account in the output. Could slow request response time. (optional)
* @param fetchCapabilities If true, includes the capabilities on a subscription in the output. Could slow request response time. (optional)
* @param fields Supplies a comma-separated list of fields to be returned. Fields of sub-structures and of arrays use <structure>.<field> notation. <stucture>.* means all field of a structure Example: For each Subscription to get id, href, plan(id and kind) and labels (all fields) ``` ocm get subscriptions --parameter fields=id,href,plan.id,plan.kind,labels.* --parameter fetchLabels=true ``` (optional)
* @return CompletableFuture<OrganizationList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsGet(Integer page, Integer size, String search, String orderBy, Boolean fetchLabels, Boolean fetchCapabilities, String fields) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsGetRequestBuilder(page, size, search, orderBy, fetchLabels, fetchCapabilities, fields);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of organizations
*
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @param fetchLabels If true, includes the labels on a subscription/organization/account in the output. Could slow request response time. (optional)
* @param fetchCapabilities If true, includes the capabilities on a subscription in the output. Could slow request response time. (optional)
* @param fields Supplies a comma-separated list of fields to be returned. Fields of sub-structures and of arrays use <structure>.<field> notation. <stucture>.* means all field of a structure Example: For each Subscription to get id, href, plan(id and kind) and labels (all fields) ``` ocm get subscriptions --parameter fields=id,href,plan.id,plan.kind,labels.* --parameter fetchLabels=true ``` (optional)
* @return CompletableFuture<ApiResponse<OrganizationList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsGetWithHttpInfo(Integer page, Integer size, String search, String orderBy, Boolean fetchLabels, Boolean fetchCapabilities, String fields) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsGetRequestBuilder(page, size, search, orderBy, fetchLabels, fetchCapabilities, fields);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsGetRequestBuilder(Integer page, Integer size, String search, String orderBy, Boolean fetchLabels, Boolean fetchCapabilities, String fields) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations";
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
localVarQueryParams.addAll(ApiClient.parameterToPairs("orderBy", orderBy));
localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchLabels", fetchLabels));
localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchCapabilities", fetchCapabilities));
localVarQueryParams.addAll(ApiClient.parameterToPairs("fields", fields));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get an organization by id
*
* @param id The id of record (required)
* @param fetchLabels If true, includes the labels on a subscription/organization/account in the output. Could slow request response time. (optional)
* @param fetchCapabilities If true, includes the capabilities on a subscription in the output. Could slow request response time. (optional)
* @return CompletableFuture<Organization>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsIdGet(String id, Boolean fetchLabels, Boolean fetchCapabilities) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdGetRequestBuilder(id, fetchLabels, fetchCapabilities);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Get an organization by id
*
* @param id The id of record (required)
* @param fetchLabels If true, includes the labels on a subscription/organization/account in the output. Could slow request response time. (optional)
* @param fetchCapabilities If true, includes the capabilities on a subscription in the output. Could slow request response time. (optional)
* @return CompletableFuture<ApiResponse<Organization>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsIdGetWithHttpInfo(String id, Boolean fetchLabels, Boolean fetchCapabilities) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdGetRequestBuilder(id, fetchLabels, fetchCapabilities);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsIdGetRequestBuilder(String id, Boolean fetchLabels, Boolean fetchCapabilities) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1OrganizationsIdGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchLabels", fetchLabels));
localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchCapabilities", fetchCapabilities));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of labels
*
* @param id The id of record (required)
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<LabelList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsIdLabelsGet(String id, Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdLabelsGetRequestBuilder(id, page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdLabelsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of labels
*
* @param id The id of record (required)
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<ApiResponse<LabelList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsIdLabelsGetWithHttpInfo(String id, Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdLabelsGetRequestBuilder(id, page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdLabelsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsIdLabelsGetRequestBuilder(String id, Integer page, Integer size, String search, String orderBy) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1OrganizationsIdLabelsGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{id}/labels"
.replace("{id}", ApiClient.urlEncode(id.toString()));
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
localVarQueryParams.addAll(ApiClient.parameterToPairs("orderBy", orderBy));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Delete a label
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @return CompletableFuture<Void>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsIdLabelsKeyDelete(String id, String key) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdLabelsKeyDeleteRequestBuilder(id, key);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdLabelsKeyDelete", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Delete a label
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @return CompletableFuture<ApiResponse<Void>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsIdLabelsKeyDeleteWithHttpInfo(String id, String key) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdLabelsKeyDeleteRequestBuilder(id, key);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdLabelsKeyDelete", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsIdLabelsKeyDeleteRequestBuilder(String id, String key) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1OrganizationsIdLabelsKeyDelete");
}
// verify the required parameter 'key' is set
if (key == null) {
throw new ApiException(400, "Missing the required parameter 'key' when calling apiAccountsMgmtV1OrganizationsIdLabelsKeyDelete");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{id}/labels/{key}"
.replace("{id}", ApiClient.urlEncode(id.toString()))
.replace("{key}", ApiClient.urlEncode(key.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get subscription labels by label key
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @return CompletableFuture<Label>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsIdLabelsKeyGet(String id, String key) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdLabelsKeyGetRequestBuilder(id, key);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdLabelsKeyGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Get subscription labels by label key
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @return CompletableFuture<ApiResponse<Label>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsIdLabelsKeyGetWithHttpInfo(String id, String key) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdLabelsKeyGetRequestBuilder(id, key);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdLabelsKeyGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsIdLabelsKeyGetRequestBuilder(String id, String key) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1OrganizationsIdLabelsKeyGet");
}
// verify the required parameter 'key' is set
if (key == null) {
throw new ApiException(400, "Missing the required parameter 'key' when calling apiAccountsMgmtV1OrganizationsIdLabelsKeyGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{id}/labels/{key}"
.replace("{id}", ApiClient.urlEncode(id.toString()))
.replace("{key}", ApiClient.urlEncode(key.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Create a new label or update an existing label
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @param label Label data (required)
* @return CompletableFuture<Label>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsIdLabelsKeyPatch(String id, String key, Label label) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdLabelsKeyPatchRequestBuilder(id, key, label);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdLabelsKeyPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Create a new label or update an existing label
*
* @param id The id of record (required)
* @param key The key of the label (required)
* @param label Label data (required)
* @return CompletableFuture<ApiResponse<Label>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsIdLabelsKeyPatchWithHttpInfo(String id, String key, Label label) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdLabelsKeyPatchRequestBuilder(id, key, label);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdLabelsKeyPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsIdLabelsKeyPatchRequestBuilder(String id, String key, Label label) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1OrganizationsIdLabelsKeyPatch");
}
// verify the required parameter 'key' is set
if (key == null) {
throw new ApiException(400, "Missing the required parameter 'key' when calling apiAccountsMgmtV1OrganizationsIdLabelsKeyPatch");
}
// verify the required parameter 'label' is set
if (label == null) {
throw new ApiException(400, "Missing the required parameter 'label' when calling apiAccountsMgmtV1OrganizationsIdLabelsKeyPatch");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{id}/labels/{key}"
.replace("{id}", ApiClient.urlEncode(id.toString()))
.replace("{key}", ApiClient.urlEncode(key.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(label);
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Create a new label or update an existing label
*
* @param id The id of record (required)
* @param label Label data (required)
* @return CompletableFuture<Label>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsIdLabelsPost(String id, Label label) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdLabelsPostRequestBuilder(id, label);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdLabelsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Create a new label or update an existing label
*
* @param id The id of record (required)
* @param label Label data (required)
* @return CompletableFuture<ApiResponse<Label>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsIdLabelsPostWithHttpInfo(String id, Label label) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdLabelsPostRequestBuilder(id, label);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdLabelsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsIdLabelsPostRequestBuilder(String id, Label label) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1OrganizationsIdLabelsPost");
}
// verify the required parameter 'label' is set
if (label == null) {
throw new ApiException(400, "Missing the required parameter 'label' when calling apiAccountsMgmtV1OrganizationsIdLabelsPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{id}/labels"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(label);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Update an organization
*
* @param id The id of record (required)
* @param organizationPatchRequest Updated organization data (required)
* @return CompletableFuture<Organization>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsIdPatch(String id, OrganizationPatchRequest organizationPatchRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdPatchRequestBuilder(id, organizationPatchRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Update an organization
*
* @param id The id of record (required)
* @param organizationPatchRequest Updated organization data (required)
* @return CompletableFuture<ApiResponse<Organization>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsIdPatchWithHttpInfo(String id, OrganizationPatchRequest organizationPatchRequest) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdPatchRequestBuilder(id, organizationPatchRequest);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdPatch", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsIdPatchRequestBuilder(String id, OrganizationPatchRequest organizationPatchRequest) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1OrganizationsIdPatch");
}
// verify the required parameter 'organizationPatchRequest' is set
if (organizationPatchRequest == null) {
throw new ApiException(400, "Missing the required parameter 'organizationPatchRequest' when calling apiAccountsMgmtV1OrganizationsIdPatch");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{id}"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(organizationPatchRequest);
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a summary of organizations clusters based on metrics
*
* @param id The id of record (required)
* @return CompletableFuture<Summary>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsIdSummaryDashboardGet(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdSummaryDashboardGetRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdSummaryDashboardGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a summary of organizations clusters based on metrics
*
* @param id The id of record (required)
* @return CompletableFuture<ApiResponse<Summary>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsIdSummaryDashboardGetWithHttpInfo(String id) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsIdSummaryDashboardGetRequestBuilder(id);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsIdSummaryDashboardGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsIdSummaryDashboardGetRequestBuilder(String id) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1OrganizationsIdSummaryDashboardGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{id}/summary_dashboard"
.replace("{id}", ApiClient.urlEncode(id.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Delete an account group assignment
*
* @param orgId The id of organization (required)
* @param acctGrpAsgnId The id of account group assignment (required)
* @return CompletableFuture<Void>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdDelete(String orgId, String acctGrpAsgnId) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdDeleteRequestBuilder(orgId, acctGrpAsgnId);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdDelete", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Delete an account group assignment
*
* @param orgId The id of organization (required)
* @param acctGrpAsgnId The id of account group assignment (required)
* @return CompletableFuture<ApiResponse<Void>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdDeleteWithHttpInfo(String orgId, String acctGrpAsgnId) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdDeleteRequestBuilder(orgId, acctGrpAsgnId);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdDelete", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdDeleteRequestBuilder(String orgId, String acctGrpAsgnId) throws ApiException {
// verify the required parameter 'orgId' is set
if (orgId == null) {
throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdDelete");
}
// verify the required parameter 'acctGrpAsgnId' is set
if (acctGrpAsgnId == null) {
throw new ApiException(400, "Missing the required parameter 'acctGrpAsgnId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdDelete");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/account_group_assignments/{acctGrpAsgnId}"
.replace("{orgId}", ApiClient.urlEncode(orgId.toString()))
.replace("{acctGrpAsgnId}", ApiClient.urlEncode(acctGrpAsgnId.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get account group assignment by id
*
* @param orgId The id of organization (required)
* @param acctGrpAsgnId The id of account group assignment (required)
* @return CompletableFuture<AccountGroupAssignment>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdGet(String orgId, String acctGrpAsgnId) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdGetRequestBuilder(orgId, acctGrpAsgnId);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Get account group assignment by id
*
* @param orgId The id of organization (required)
* @param acctGrpAsgnId The id of account group assignment (required)
* @return CompletableFuture<ApiResponse<AccountGroupAssignment>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdGetWithHttpInfo(String orgId, String acctGrpAsgnId) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdGetRequestBuilder(orgId, acctGrpAsgnId);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdGetRequestBuilder(String orgId, String acctGrpAsgnId) throws ApiException {
// verify the required parameter 'orgId' is set
if (orgId == null) {
throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdGet");
}
// verify the required parameter 'acctGrpAsgnId' is set
if (acctGrpAsgnId == null) {
throw new ApiException(400, "Missing the required parameter 'acctGrpAsgnId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsAcctGrpAsgnIdGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/account_group_assignments/{acctGrpAsgnId}"
.replace("{orgId}", ApiClient.urlEncode(orgId.toString()))
.replace("{acctGrpAsgnId}", ApiClient.urlEncode(acctGrpAsgnId.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns a list of account group assignments for the given org
*
* @param orgId The id of organization (required)
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<AccountGroupAssignmentList>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsGet(String orgId, Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsGetRequestBuilder(orgId, page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Returns a list of account group assignments for the given org
*
* @param orgId The id of organization (required)
* @param page Page number of record list when record list exceeds specified page size (optional, default to 1)
* @param size Maximum number of records to return (optional, default to 100)
* @param search Specifies the search criteria. The syntax of this parameter is similar to the syntax of the _where_ clause of an SQL statement, using the names of the json attributes / column names of the account. For example, in order to retrieve all the accounts with a username starting with `my`: ```sql username like 'my%' ``` The search criteria can also be applied on related resource. For example, in order to retrieve all the subscriptions labeled by `foo=bar`, ```sql labels.key = 'foo' and labels.value = 'bar' ``` If the parameter isn't provided, or if the value is empty, then all the accounts that the user has permission to see will be returned. (optional)
* @param orderBy Specifies the order by criteria. The syntax of this parameter is similar to the syntax of the _order by_ clause of an SQL statement, but using the names of the json attributes / column of the account. For example, in order to retrieve all accounts ordered by username: ```sql username asc ``` Or in order to retrieve all accounts ordered by username _and_ first name: ```sql username asc, firstName asc ``` If the parameter isn't provided, or if the value is empty, then no explicit ordering will be applied. (optional)
* @return CompletableFuture<ApiResponse<AccountGroupAssignmentList>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsGetWithHttpInfo(String orgId, Integer page, Integer size, String search, String orderBy) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsGetRequestBuilder(orgId, page, size, search, orderBy);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsGet", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsGetRequestBuilder(String orgId, Integer page, Integer size, String search, String orderBy) throws ApiException {
// verify the required parameter 'orgId' is set
if (orgId == null) {
throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsGet");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/account_group_assignments"
.replace("{orgId}", ApiClient.urlEncode(orgId.toString()));
List localVarQueryParams = new ArrayList<>();
localVarQueryParams.addAll(ApiClient.parameterToPairs("page", page));
localVarQueryParams.addAll(ApiClient.parameterToPairs("size", size));
localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
localVarQueryParams.addAll(ApiClient.parameterToPairs("orderBy", orderBy));
if (!localVarQueryParams.isEmpty()) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Create a new AccountGroupAssignment
*
* @param orgId The id of organization (required)
* @param accountGroupAssignment New AccountGroup data (required)
* @return CompletableFuture<AccountGroupAssignment>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsPost(String orgId, AccountGroupAssignment accountGroupAssignment) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsPostRequestBuilder(orgId, accountGroupAssignment);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {})
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Create a new AccountGroupAssignment
*
* @param orgId The id of organization (required)
* @param accountGroupAssignment New AccountGroup data (required)
* @return CompletableFuture<ApiResponse<AccountGroupAssignment>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsPostWithHttpInfo(String orgId, AccountGroupAssignment accountGroupAssignment) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsPostRequestBuilder(orgId, accountGroupAssignment);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsPost", localVarResponse));
}
try {
return CompletableFuture.completedFuture(
new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}))
);
} catch (IOException e) {
return CompletableFuture.failedFuture(new ApiException(e));
}
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsPostRequestBuilder(String orgId, AccountGroupAssignment accountGroupAssignment) throws ApiException {
// verify the required parameter 'orgId' is set
if (orgId == null) {
throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsPost");
}
// verify the required parameter 'accountGroupAssignment' is set
if (accountGroupAssignment == null) {
throw new ApiException(400, "Missing the required parameter 'accountGroupAssignment' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupAssignmentsPost");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/account_group_assignments"
.replace("{orgId}", ApiClient.urlEncode(orgId.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(accountGroupAssignment);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Delete an account group
*
* @param orgId The id of organization (required)
* @param acctGrpId The id of account group (required)
* @return CompletableFuture<Void>
* @throws ApiException if fails to make API call
*/
public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdDelete(String orgId, String acctGrpId) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdDeleteRequestBuilder(orgId, acctGrpId);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdDelete", localVarResponse));
}
return CompletableFuture.completedFuture(null);
});
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
/**
* Delete an account group
*
* @param orgId The id of organization (required)
* @param acctGrpId The id of account group (required)
* @return CompletableFuture<ApiResponse<Void>>
* @throws ApiException if fails to make API call
*/
public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdDeleteWithHttpInfo(String orgId, String acctGrpId) throws ApiException {
try {
HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdDeleteRequestBuilder(orgId, acctGrpId);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
if (memberVarAsyncResponseInterceptor != null) {
memberVarAsyncResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdDelete", localVarResponse));
}
return CompletableFuture.completedFuture(
new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
);
}
);
}
catch (ApiException e) {
return CompletableFuture.failedFuture(e);
}
}
private HttpRequest.Builder apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdDeleteRequestBuilder(String orgId, String acctGrpId) throws ApiException {
// verify the required parameter 'orgId' is set
if (orgId == null) {
throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdDelete");
}
// verify the required parameter 'acctGrpId' is set
if (acctGrpId == null) {
throw new ApiException(400, "Missing the required parameter 'acctGrpId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdDelete");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/account_groups/{acctGrpId}"
.replace("{orgId}", ApiClient.urlEncode(orgId.toString()))
.replace("{acctGrpId}", ApiClient.urlEncode(acctGrpId.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get account group by id
*
* @param orgId The id of organization (required)
* @param acctGrpId The id of account group (required)
* @return CompletableFuture<AccountGroup>
* @throws ApiException if fails to make API call
*/
public CompletableFuture