All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.bf2.ffm.ams.client.api.DefaultApi Maven / Gradle / Ivy

There is a newer version: 0.0.2
Show newest version
/*
 * 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 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 apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdGet(String orgId, String acctGrpId) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdGetRequestBuilder(orgId, acctGrpId);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdGet", 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 by id
   * 
   * @param orgId The id of organization (required)
   * @param acctGrpId The id of account group (required)
   * @return CompletableFuture<ApiResponse<AccountGroup>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdGetWithHttpInfo(String orgId, String acctGrpId) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdGetRequestBuilder(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("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdGet", 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 apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdGetRequestBuilder(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 apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdGet");
    }
    // verify the required parameter 'acctGrpId' is set
    if (acctGrpId == null) {
      throw new ApiException(400, "Missing the required parameter 'acctGrpId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdGet");
    }

    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("GET", HttpRequest.BodyPublishers.noBody());
    if (memberVarReadTimeout != null) {
      localVarRequestBuilder.timeout(memberVarReadTimeout);
    }
    if (memberVarInterceptor != null) {
      memberVarInterceptor.accept(localVarRequestBuilder);
    }
    return localVarRequestBuilder;
  }
  /**
   * Update an account group
   * 
   * @param orgId The id of organization (required)
   * @param acctGrpId The id of account group (required)
   * @param accountGroupRequest Updated account group data (required)
   * @return CompletableFuture<AccountGroup>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdPatch(String orgId, String acctGrpId, AccountGroupRequest accountGroupRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdPatchRequestBuilder(orgId, acctGrpId, accountGroupRequest);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdPatch", 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 group
   * 
   * @param orgId The id of organization (required)
   * @param acctGrpId The id of account group (required)
   * @param accountGroupRequest Updated account group data (required)
   * @return CompletableFuture<ApiResponse<AccountGroup>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdPatchWithHttpInfo(String orgId, String acctGrpId, AccountGroupRequest accountGroupRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdPatchRequestBuilder(orgId, acctGrpId, accountGroupRequest);
      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("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdPatch", 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 apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdPatchRequestBuilder(String orgId, String acctGrpId, AccountGroupRequest accountGroupRequest) throws ApiException {
    // verify the required parameter 'orgId' is set
    if (orgId == null) {
      throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdPatch");
    }
    // verify the required parameter 'acctGrpId' is set
    if (acctGrpId == null) {
      throw new ApiException(400, "Missing the required parameter 'acctGrpId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdPatch");
    }
    // verify the required parameter 'accountGroupRequest' is set
    if (accountGroupRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'accountGroupRequest' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsAcctGrpIdPatch");
    }

    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("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(accountGroupRequest);
      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 list of account groups 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<AccountGroupList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsGet(String orgId, Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsGetRequestBuilder(orgId, page, size, search, orderBy);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsGet", 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 groups 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<AccountGroupList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsGetWithHttpInfo(String orgId, Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsGetRequestBuilder(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("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsGet", 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 apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsGetRequestBuilder(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 apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/account_groups"
        .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 AccountGroup
   * 
   * @param orgId The id of organization (required)
   * @param accountGroupRequest New AccountGroup data (required)
   * @return CompletableFuture<AccountGroup>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsPost(String orgId, AccountGroupRequest accountGroupRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsPostRequestBuilder(orgId, accountGroupRequest);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsPost", 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 AccountGroup
   * 
   * @param orgId The id of organization (required)
   * @param accountGroupRequest New AccountGroup data (required)
   * @return CompletableFuture<ApiResponse<AccountGroup>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsPostWithHttpInfo(String orgId, AccountGroupRequest accountGroupRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsPostRequestBuilder(orgId, accountGroupRequest);
      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("apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsPost", 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 apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsPostRequestBuilder(String orgId, AccountGroupRequest accountGroupRequest) throws ApiException {
    // verify the required parameter 'orgId' is set
    if (orgId == null) {
      throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsPost");
    }
    // verify the required parameter 'accountGroupRequest' is set
    if (accountGroupRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'accountGroupRequest' when calling apiAccountsMgmtV1OrganizationsOrgIdAccountGroupsPost");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/account_groups"
        .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(accountGroupRequest);
      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 consumed quota for an organization
   * 
   * @param orgId The id of organization (required)
   * @param forceRecalc If true, includes that ConsumedQuota should be recalculated. (optional)
   * @return CompletableFuture<ConsumedQuotaList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdConsumedQuotaGet(String orgId, Boolean forceRecalc) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdConsumedQuotaGetRequestBuilder(orgId, forceRecalc);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdConsumedQuotaGet", 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 consumed quota for an organization
   * 
   * @param orgId The id of organization (required)
   * @param forceRecalc If true, includes that ConsumedQuota should be recalculated. (optional)
   * @return CompletableFuture<ApiResponse<ConsumedQuotaList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdConsumedQuotaGetWithHttpInfo(String orgId, Boolean forceRecalc) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdConsumedQuotaGetRequestBuilder(orgId, forceRecalc);
      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("apiAccountsMgmtV1OrganizationsOrgIdConsumedQuotaGet", 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 apiAccountsMgmtV1OrganizationsOrgIdConsumedQuotaGetRequestBuilder(String orgId, Boolean forceRecalc) throws ApiException {
    // verify the required parameter 'orgId' is set
    if (orgId == null) {
      throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdConsumedQuotaGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/consumed_quota"
        .replace("{orgId}", ApiClient.urlEncode(orgId.toString()));

    List localVarQueryParams = new ArrayList<>();
    localVarQueryParams.addAll(ApiClient.parameterToPairs("forceRecalc", forceRecalc));

    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 summary of quota cost
   * 
   * @param orgId The id of organization (required)
   * @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 fetchRelatedResources If true, includes the related resources in the output. Could slow request response time. (optional)
   * @param forceRecalc If true, includes that ConsumedQuota should be recalculated. (optional)
   * @param fetchCloudAccounts If true, includes the marketplace cloud accounts in the output. Could slow request response time. (optional)
   * @return CompletableFuture<QuotaCostList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdQuotaCostGet(String orgId, String search, Boolean fetchRelatedResources, Boolean forceRecalc, Boolean fetchCloudAccounts) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdQuotaCostGetRequestBuilder(orgId, search, fetchRelatedResources, forceRecalc, fetchCloudAccounts);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdQuotaCostGet", 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 quota cost
   * 
   * @param orgId The id of organization (required)
   * @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 fetchRelatedResources If true, includes the related resources in the output. Could slow request response time. (optional)
   * @param forceRecalc If true, includes that ConsumedQuota should be recalculated. (optional)
   * @param fetchCloudAccounts If true, includes the marketplace cloud accounts in the output. Could slow request response time. (optional)
   * @return CompletableFuture<ApiResponse<QuotaCostList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdQuotaCostGetWithHttpInfo(String orgId, String search, Boolean fetchRelatedResources, Boolean forceRecalc, Boolean fetchCloudAccounts) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdQuotaCostGetRequestBuilder(orgId, search, fetchRelatedResources, forceRecalc, fetchCloudAccounts);
      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("apiAccountsMgmtV1OrganizationsOrgIdQuotaCostGet", 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 apiAccountsMgmtV1OrganizationsOrgIdQuotaCostGetRequestBuilder(String orgId, String search, Boolean fetchRelatedResources, Boolean forceRecalc, Boolean fetchCloudAccounts) throws ApiException {
    // verify the required parameter 'orgId' is set
    if (orgId == null) {
      throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdQuotaCostGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/quota_cost"
        .replace("{orgId}", ApiClient.urlEncode(orgId.toString()));

    List localVarQueryParams = new ArrayList<>();
    localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchRelatedResources", fetchRelatedResources));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("forceRecalc", forceRecalc));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchCloudAccounts", fetchCloudAccounts));

    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 resource quota objects
   * 
   * @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<ResourceQuotaList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaGet(String orgId, Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaGetRequestBuilder(orgId, page, size, search, orderBy);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaGet", 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 resource quota objects
   * 
   * @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<ResourceQuotaList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaGetWithHttpInfo(String orgId, Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaGetRequestBuilder(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("apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaGet", 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 apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaGetRequestBuilder(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 apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/resource_quota"
        .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 resource quota
   * 
   * @param orgId The id of organization (required)
   * @param resourceQuotaRequest Resource quota data (required)
   * @return CompletableFuture<ResourceQuota>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaPost(String orgId, ResourceQuotaRequest resourceQuotaRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaPostRequestBuilder(orgId, resourceQuotaRequest);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaPost", 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 resource quota
   * 
   * @param orgId The id of organization (required)
   * @param resourceQuotaRequest Resource quota data (required)
   * @return CompletableFuture<ApiResponse<ResourceQuota>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaPostWithHttpInfo(String orgId, ResourceQuotaRequest resourceQuotaRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaPostRequestBuilder(orgId, resourceQuotaRequest);
      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("apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaPost", 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 apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaPostRequestBuilder(String orgId, ResourceQuotaRequest resourceQuotaRequest) throws ApiException {
    // verify the required parameter 'orgId' is set
    if (orgId == null) {
      throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaPost");
    }
    // verify the required parameter 'resourceQuotaRequest' is set
    if (resourceQuotaRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'resourceQuotaRequest' when calling apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaPost");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/resource_quota"
        .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(resourceQuotaRequest);
      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 a resource quota
   * 
   * @param orgId The id of organization (required)
   * @param quotaId The id of quota (required)
   * @return CompletableFuture<Void>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdDelete(String orgId, String quotaId) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdDeleteRequestBuilder(orgId, quotaId);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(null);
      });
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  /**
   * Delete a resource quota
   * 
   * @param orgId The id of organization (required)
   * @param quotaId The id of quota (required)
   * @return CompletableFuture<ApiResponse<Void>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdDeleteWithHttpInfo(String orgId, String quotaId) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdDeleteRequestBuilder(orgId, quotaId);
      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("apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(
                new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
            );
        }
      );
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  private HttpRequest.Builder apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdDeleteRequestBuilder(String orgId, String quotaId) throws ApiException {
    // verify the required parameter 'orgId' is set
    if (orgId == null) {
      throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdDelete");
    }
    // verify the required parameter 'quotaId' is set
    if (quotaId == null) {
      throw new ApiException(400, "Missing the required parameter 'quotaId' when calling apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdDelete");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/resource_quota/{quotaId}"
        .replace("{orgId}", ApiClient.urlEncode(orgId.toString()))
        .replace("{quotaId}", ApiClient.urlEncode(quotaId.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 resource quota by id
   * 
   * @param orgId The id of organization (required)
   * @param quotaId The id of quota (required)
   * @return CompletableFuture<ResourceQuota>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdGet(String orgId, String quotaId) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdGetRequestBuilder(orgId, quotaId);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdGet", 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 resource quota by id
   * 
   * @param orgId The id of organization (required)
   * @param quotaId The id of quota (required)
   * @return CompletableFuture<ApiResponse<ResourceQuota>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdGetWithHttpInfo(String orgId, String quotaId) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdGetRequestBuilder(orgId, quotaId);
      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("apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdGet", 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 apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdGetRequestBuilder(String orgId, String quotaId) throws ApiException {
    // verify the required parameter 'orgId' is set
    if (orgId == null) {
      throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdGet");
    }
    // verify the required parameter 'quotaId' is set
    if (quotaId == null) {
      throw new ApiException(400, "Missing the required parameter 'quotaId' when calling apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/resource_quota/{quotaId}"
        .replace("{orgId}", ApiClient.urlEncode(orgId.toString()))
        .replace("{quotaId}", ApiClient.urlEncode(quotaId.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 resource quota
   * 
   * @param orgId The id of organization (required)
   * @param quotaId The id of quota (required)
   * @param resourceQuotaRequest Updated resource quota data (required)
   * @return CompletableFuture<ResourceQuota>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdPatch(String orgId, String quotaId, ResourceQuotaRequest resourceQuotaRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdPatchRequestBuilder(orgId, quotaId, resourceQuotaRequest);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdPatch", 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 resource quota
   * 
   * @param orgId The id of organization (required)
   * @param quotaId The id of quota (required)
   * @param resourceQuotaRequest Updated resource quota data (required)
   * @return CompletableFuture<ApiResponse<ResourceQuota>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdPatchWithHttpInfo(String orgId, String quotaId, ResourceQuotaRequest resourceQuotaRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdPatchRequestBuilder(orgId, quotaId, resourceQuotaRequest);
      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("apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdPatch", 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 apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdPatchRequestBuilder(String orgId, String quotaId, ResourceQuotaRequest resourceQuotaRequest) throws ApiException {
    // verify the required parameter 'orgId' is set
    if (orgId == null) {
      throw new ApiException(400, "Missing the required parameter 'orgId' when calling apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdPatch");
    }
    // verify the required parameter 'quotaId' is set
    if (quotaId == null) {
      throw new ApiException(400, "Missing the required parameter 'quotaId' when calling apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdPatch");
    }
    // verify the required parameter 'resourceQuotaRequest' is set
    if (resourceQuotaRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'resourceQuotaRequest' when calling apiAccountsMgmtV1OrganizationsOrgIdResourceQuotaQuotaIdPatch");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/organizations/{orgId}/resource_quota/{quotaId}"
        .replace("{orgId}", ApiClient.urlEncode(orgId.toString()))
        .replace("{quotaId}", ApiClient.urlEncode(quotaId.toString()));

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(resourceQuotaRequest);
      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 organization
   * 
   * @param organization Organization data (required)
   * @return CompletableFuture<Organization>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1OrganizationsPost(Organization organization) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsPostRequestBuilder(organization);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1OrganizationsPost", 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 organization
   * 
   * @param organization Organization data (required)
   * @return CompletableFuture<ApiResponse<Organization>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1OrganizationsPostWithHttpInfo(Organization organization) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1OrganizationsPostRequestBuilder(organization);
      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("apiAccountsMgmtV1OrganizationsPost", 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 apiAccountsMgmtV1OrganizationsPostRequestBuilder(Organization organization) throws ApiException {
    // verify the required parameter 'organization' is set
    if (organization == null) {
      throw new ApiException(400, "Missing the required parameter 'organization' when calling apiAccountsMgmtV1OrganizationsPost");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/organizations";

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(organization);
      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 all plans
   * 
   * @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<PlanList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1PlansGet(Integer page, Integer size, String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1PlansGetRequestBuilder(page, size, search);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1PlansGet", 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 all plans
   * 
   * @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<PlanList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1PlansGetWithHttpInfo(Integer page, Integer size, String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1PlansGetRequestBuilder(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("apiAccountsMgmtV1PlansGet", 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 apiAccountsMgmtV1PlansGetRequestBuilder(Integer page, Integer size, String search) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/plans";

    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 a plan by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<Plan>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1PlansIdGet(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1PlansIdGetRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1PlansIdGet", 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 plan by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<Plan>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1PlansIdGetWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1PlansIdGetRequestBuilder(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("apiAccountsMgmtV1PlansIdGet", 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 apiAccountsMgmtV1PlansIdGetRequestBuilder(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 apiAccountsMgmtV1PlansIdGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/plans/{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;
  }
  /**
   * Delete a pull secret
   * 
   * @param externalResourceId The external resource id of record (required)
   * @return CompletableFuture<Void>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1PullSecretsExternalResourceIdDelete(String externalResourceId) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1PullSecretsExternalResourceIdDeleteRequestBuilder(externalResourceId);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1PullSecretsExternalResourceIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(null);
      });
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  /**
   * Delete a pull secret
   * 
   * @param externalResourceId The external resource id of record (required)
   * @return CompletableFuture<ApiResponse<Void>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1PullSecretsExternalResourceIdDeleteWithHttpInfo(String externalResourceId) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1PullSecretsExternalResourceIdDeleteRequestBuilder(externalResourceId);
      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("apiAccountsMgmtV1PullSecretsExternalResourceIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(
                new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
            );
        }
      );
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  private HttpRequest.Builder apiAccountsMgmtV1PullSecretsExternalResourceIdDeleteRequestBuilder(String externalResourceId) throws ApiException {
    // verify the required parameter 'externalResourceId' is set
    if (externalResourceId == null) {
      throw new ApiException(400, "Missing the required parameter 'externalResourceId' when calling apiAccountsMgmtV1PullSecretsExternalResourceIdDelete");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/pull_secrets/{externalResourceId}"
        .replace("{externalResourceId}", ApiClient.urlEncode(externalResourceId.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;
  }
  /**
   * Return access token generated from registries in docker format
   * 
   * @param pullSecretRequest Identifier of the resource in the external service that this pull secret relates to (required)
   * @return CompletableFuture<AccessTokenCfg>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1PullSecretsPost(PullSecretRequest pullSecretRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1PullSecretsPostRequestBuilder(pullSecretRequest);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1PullSecretsPost", 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
   * 
   * @param pullSecretRequest Identifier of the resource in the external service that this pull secret relates to (required)
   * @return CompletableFuture<ApiResponse<AccessTokenCfg>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1PullSecretsPostWithHttpInfo(PullSecretRequest pullSecretRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1PullSecretsPostRequestBuilder(pullSecretRequest);
      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("apiAccountsMgmtV1PullSecretsPost", 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 apiAccountsMgmtV1PullSecretsPostRequestBuilder(PullSecretRequest pullSecretRequest) throws ApiException {
    // verify the required parameter 'pullSecretRequest' is set
    if (pullSecretRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'pullSecretRequest' when calling apiAccountsMgmtV1PullSecretsPost");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/pull_secrets";

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pullSecretRequest);
      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 summary of quota cost for the authenticated user
   * 
   * @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 fetchRelatedResources If true, includes the related resources in the output. Could slow request response time. (optional)
   * @param fetchCloudAccounts If true, includes the marketplace cloud accounts in the output. Could slow request response time. (optional)
   * @return CompletableFuture<QuotaCostList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1QuotaCostGet(String search, Boolean fetchRelatedResources, Boolean fetchCloudAccounts) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotaCostGetRequestBuilder(search, fetchRelatedResources, fetchCloudAccounts);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1QuotaCostGet", 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 quota cost for the authenticated user
   * 
   * @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 fetchRelatedResources If true, includes the related resources in the output. Could slow request response time. (optional)
   * @param fetchCloudAccounts If true, includes the marketplace cloud accounts in the output. Could slow request response time. (optional)
   * @return CompletableFuture<ApiResponse<QuotaCostList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1QuotaCostGetWithHttpInfo(String search, Boolean fetchRelatedResources, Boolean fetchCloudAccounts) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotaCostGetRequestBuilder(search, fetchRelatedResources, fetchCloudAccounts);
      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("apiAccountsMgmtV1QuotaCostGet", 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 apiAccountsMgmtV1QuotaCostGetRequestBuilder(String search, Boolean fetchRelatedResources, Boolean fetchCloudAccounts) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/quota_cost";

    List localVarQueryParams = new ArrayList<>();
    localVarQueryParams.addAll(ApiClient.parameterToPairs("search", search));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchRelatedResources", fetchRelatedResources));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchCloudAccounts", fetchCloudAccounts));

    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 UHC product Quota Rules
   * 
   * @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<QuotaRulesList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1QuotaRulesGet(Integer page, Integer size, String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotaRulesGetRequestBuilder(page, size, search);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1QuotaRulesGet", 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 UHC product Quota Rules
   * 
   * @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<QuotaRulesList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1QuotaRulesGetWithHttpInfo(Integer page, Integer size, String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotaRulesGetRequestBuilder(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("apiAccountsMgmtV1QuotaRulesGet", 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 apiAccountsMgmtV1QuotaRulesGetRequestBuilder(Integer page, Integer size, String search) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/quota_rules";

    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;
  }
  /**
   * Returns a list of quotas
   * 
   * @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<QuotaList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1QuotasGet(Integer page, Integer size, String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotasGetRequestBuilder(page, size, search);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1QuotasGet", 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 quotas
   * 
   * @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<QuotaList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1QuotasGetWithHttpInfo(Integer page, Integer size, String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotasGetRequestBuilder(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("apiAccountsMgmtV1QuotasGet", 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 apiAccountsMgmtV1QuotasGetRequestBuilder(Integer page, Integer size, String search) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/quotas";

    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 quota
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<Void>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1QuotasIdDelete(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotasIdDeleteRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1QuotasIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(null);
      });
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  /**
   * Delete a quota
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<Void>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1QuotasIdDeleteWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotasIdDeleteRequestBuilder(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("apiAccountsMgmtV1QuotasIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(
                new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
            );
        }
      );
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  private HttpRequest.Builder apiAccountsMgmtV1QuotasIdDeleteRequestBuilder(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 apiAccountsMgmtV1QuotasIdDelete");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/quotas/{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 quota
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<Quota>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1QuotasIdGet(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotasIdGetRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1QuotasIdGet", 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 quota
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<Quota>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1QuotasIdGetWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotasIdGetRequestBuilder(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("apiAccountsMgmtV1QuotasIdGet", 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 apiAccountsMgmtV1QuotasIdGetRequestBuilder(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 apiAccountsMgmtV1QuotasIdGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/quotas/{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 quota
   * 
   * @param id The id of record (required)
   * @param quota Updated quota data (required)
   * @return CompletableFuture<Quota>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1QuotasIdPatch(String id, Quota quota) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotasIdPatchRequestBuilder(id, quota);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1QuotasIdPatch", 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 quota
   * 
   * @param id The id of record (required)
   * @param quota Updated quota data (required)
   * @return CompletableFuture<ApiResponse<Quota>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1QuotasIdPatchWithHttpInfo(String id, Quota quota) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotasIdPatchRequestBuilder(id, quota);
      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("apiAccountsMgmtV1QuotasIdPatch", 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 apiAccountsMgmtV1QuotasIdPatchRequestBuilder(String id, Quota quota) throws ApiException {
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1QuotasIdPatch");
    }
    // verify the required parameter 'quota' is set
    if (quota == null) {
      throw new ApiException(400, "Missing the required parameter 'quota' when calling apiAccountsMgmtV1QuotasIdPatch");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/quotas/{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(quota);
      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 quota
   * 
   * @param quota Quota data (required)
   * @return CompletableFuture<Quota>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1QuotasPost(Quota quota) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotasPostRequestBuilder(quota);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1QuotasPost", 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 quota
   * 
   * @param quota Quota data (required)
   * @return CompletableFuture<ApiResponse<Quota>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1QuotasPostWithHttpInfo(Quota quota) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1QuotasPostRequestBuilder(quota);
      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("apiAccountsMgmtV1QuotasPost", 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 apiAccountsMgmtV1QuotasPostRequestBuilder(Quota quota) throws ApiException {
    // verify the required parameter 'quota' is set
    if (quota == null) {
      throw new ApiException(400, "Missing the required parameter 'quota' when calling apiAccountsMgmtV1QuotasPost");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/quotas";

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(quota);
      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 registries
   * 
   * @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<RegistryList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RegistriesGet(Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistriesGetRequestBuilder(page, size, search, orderBy);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RegistriesGet", 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 registries
   * 
   * @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<RegistryList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RegistriesGetWithHttpInfo(Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistriesGetRequestBuilder(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("apiAccountsMgmtV1RegistriesGet", 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 apiAccountsMgmtV1RegistriesGetRequestBuilder(Integer page, Integer size, String search, String orderBy) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/registries";

    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 an registry by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<Registry>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RegistriesIdGet(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistriesIdGetRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RegistriesIdGet", 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 registry by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<Registry>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RegistriesIdGetWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistriesIdGetRequestBuilder(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("apiAccountsMgmtV1RegistriesIdGet", 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 apiAccountsMgmtV1RegistriesIdGetRequestBuilder(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 apiAccountsMgmtV1RegistriesIdGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/registries/{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;
  }
  /**
   * 
   * List Registry Credentials
   * @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<RegistryCredentialList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RegistryCredentialsGet(Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistryCredentialsGetRequestBuilder(page, size, search, orderBy);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RegistryCredentialsGet", 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 Registry Credentials
   * @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<RegistryCredentialList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RegistryCredentialsGetWithHttpInfo(Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistryCredentialsGetRequestBuilder(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("apiAccountsMgmtV1RegistryCredentialsGet", 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 apiAccountsMgmtV1RegistryCredentialsGetRequestBuilder(Integer page, Integer size, String search, String orderBy) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/registry_credentials";

    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 registry credential by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<Void>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RegistryCredentialsIdDelete(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistryCredentialsIdDeleteRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RegistryCredentialsIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(null);
      });
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  /**
   * Delete a registry credential by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<Void>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RegistryCredentialsIdDeleteWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistryCredentialsIdDeleteRequestBuilder(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("apiAccountsMgmtV1RegistryCredentialsIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(
                new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
            );
        }
      );
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  private HttpRequest.Builder apiAccountsMgmtV1RegistryCredentialsIdDeleteRequestBuilder(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 apiAccountsMgmtV1RegistryCredentialsIdDelete");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/registry_credentials/{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 registry credentials by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<RegistryCredential>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RegistryCredentialsIdGet(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistryCredentialsIdGetRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RegistryCredentialsIdGet", 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 registry credentials by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<RegistryCredential>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RegistryCredentialsIdGetWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistryCredentialsIdGetRequestBuilder(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("apiAccountsMgmtV1RegistryCredentialsIdGet", 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 apiAccountsMgmtV1RegistryCredentialsIdGetRequestBuilder(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 apiAccountsMgmtV1RegistryCredentialsIdGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/registry_credentials/{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 registry credential
   * 
   * @param id The id of record (required)
   * @param registryCredentialPatchRequest Updated registry credential data (required)
   * @return CompletableFuture<RegistryCredential>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RegistryCredentialsIdPatch(String id, RegistryCredentialPatchRequest registryCredentialPatchRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistryCredentialsIdPatchRequestBuilder(id, registryCredentialPatchRequest);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RegistryCredentialsIdPatch", 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 registry credential
   * 
   * @param id The id of record (required)
   * @param registryCredentialPatchRequest Updated registry credential data (required)
   * @return CompletableFuture<ApiResponse<RegistryCredential>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RegistryCredentialsIdPatchWithHttpInfo(String id, RegistryCredentialPatchRequest registryCredentialPatchRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistryCredentialsIdPatchRequestBuilder(id, registryCredentialPatchRequest);
      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("apiAccountsMgmtV1RegistryCredentialsIdPatch", 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 apiAccountsMgmtV1RegistryCredentialsIdPatchRequestBuilder(String id, RegistryCredentialPatchRequest registryCredentialPatchRequest) throws ApiException {
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1RegistryCredentialsIdPatch");
    }
    // verify the required parameter 'registryCredentialPatchRequest' is set
    if (registryCredentialPatchRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'registryCredentialPatchRequest' when calling apiAccountsMgmtV1RegistryCredentialsIdPatch");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/registry_credentials/{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(registryCredentialPatchRequest);
      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;
  }
  /**
   * Request the creation of a registry credential
   * 
   * @param registryCredential Registry credential data (required)
   * @return CompletableFuture<RegistryCredential>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RegistryCredentialsPost(RegistryCredential registryCredential) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistryCredentialsPostRequestBuilder(registryCredential);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RegistryCredentialsPost", 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);
    }
  }

  /**
   * Request the creation of a registry credential
   * 
   * @param registryCredential Registry credential data (required)
   * @return CompletableFuture<ApiResponse<RegistryCredential>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RegistryCredentialsPostWithHttpInfo(RegistryCredential registryCredential) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RegistryCredentialsPostRequestBuilder(registryCredential);
      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("apiAccountsMgmtV1RegistryCredentialsPost", 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 apiAccountsMgmtV1RegistryCredentialsPostRequestBuilder(RegistryCredential registryCredential) throws ApiException {
    // verify the required parameter 'registryCredential' is set
    if (registryCredential == null) {
      throw new ApiException(400, "Missing the required parameter 'registryCredential' when calling apiAccountsMgmtV1RegistryCredentialsPost");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/registry_credentials";

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(registryCredential);
      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 reserved 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)
   * @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<ReservedResourceList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1ReservedResourcesGet(Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ReservedResourcesGetRequestBuilder(page, size, search, orderBy);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ReservedResourcesGet", 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 reserved 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)
   * @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<ReservedResourceList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1ReservedResourcesGetWithHttpInfo(Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ReservedResourcesGetRequestBuilder(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("apiAccountsMgmtV1ReservedResourcesGet", 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 apiAccountsMgmtV1ReservedResourcesGetRequestBuilder(Integer page, Integer size, String search, String orderBy) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/reserved_resources";

    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 resource quota objects
   * 
   * @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<ResourceQuotaList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1ResourceQuotaGet(Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ResourceQuotaGetRequestBuilder(page, size, search, orderBy);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1ResourceQuotaGet", 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 resource quota objects
   * 
   * @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<ResourceQuotaList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1ResourceQuotaGetWithHttpInfo(Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1ResourceQuotaGetRequestBuilder(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("apiAccountsMgmtV1ResourceQuotaGet", 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 apiAccountsMgmtV1ResourceQuotaGetRequestBuilder(Integer page, Integer size, String search, String orderBy) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/resource_quota";

    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 role bindings
   * 
   * @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<RoleBindingList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RoleBindingsGet(Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RoleBindingsGetRequestBuilder(page, size, search, orderBy);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RoleBindingsGet", 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 role bindings
   * 
   * @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<RoleBindingList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RoleBindingsGetWithHttpInfo(Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RoleBindingsGetRequestBuilder(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("apiAccountsMgmtV1RoleBindingsGet", 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 apiAccountsMgmtV1RoleBindingsGetRequestBuilder(Integer page, Integer size, String search, String orderBy) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/role_bindings";

    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 role binding
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<Void>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RoleBindingsIdDelete(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RoleBindingsIdDeleteRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RoleBindingsIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(null);
      });
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  /**
   * Delete a role binding
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<Void>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RoleBindingsIdDeleteWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RoleBindingsIdDeleteRequestBuilder(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("apiAccountsMgmtV1RoleBindingsIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(
                new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
            );
        }
      );
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  private HttpRequest.Builder apiAccountsMgmtV1RoleBindingsIdDeleteRequestBuilder(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 apiAccountsMgmtV1RoleBindingsIdDelete");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/role_bindings/{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 role binding
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<RoleBinding>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RoleBindingsIdGet(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RoleBindingsIdGetRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RoleBindingsIdGet", 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 role binding
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<RoleBinding>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RoleBindingsIdGetWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RoleBindingsIdGetRequestBuilder(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("apiAccountsMgmtV1RoleBindingsIdGet", 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 apiAccountsMgmtV1RoleBindingsIdGetRequestBuilder(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 apiAccountsMgmtV1RoleBindingsIdGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/role_bindings/{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 role binding
   * 
   * @param id The id of record (required)
   * @param roleBindingRequest Updated role binding data (required)
   * @return CompletableFuture<RoleBinding>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RoleBindingsIdPatch(String id, RoleBindingRequest roleBindingRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RoleBindingsIdPatchRequestBuilder(id, roleBindingRequest);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RoleBindingsIdPatch", 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 role binding
   * 
   * @param id The id of record (required)
   * @param roleBindingRequest Updated role binding data (required)
   * @return CompletableFuture<ApiResponse<RoleBinding>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RoleBindingsIdPatchWithHttpInfo(String id, RoleBindingRequest roleBindingRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RoleBindingsIdPatchRequestBuilder(id, roleBindingRequest);
      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("apiAccountsMgmtV1RoleBindingsIdPatch", 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 apiAccountsMgmtV1RoleBindingsIdPatchRequestBuilder(String id, RoleBindingRequest roleBindingRequest) throws ApiException {
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1RoleBindingsIdPatch");
    }
    // verify the required parameter 'roleBindingRequest' is set
    if (roleBindingRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'roleBindingRequest' when calling apiAccountsMgmtV1RoleBindingsIdPatch");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/role_bindings/{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(roleBindingRequest);
      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 role binding
   * 
   * @param roleBindingCreateRequest Role binding data (required)
   * @return CompletableFuture<RoleBinding>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RoleBindingsPost(RoleBindingCreateRequest roleBindingCreateRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RoleBindingsPostRequestBuilder(roleBindingCreateRequest);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RoleBindingsPost", 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 role binding
   * 
   * @param roleBindingCreateRequest Role binding data (required)
   * @return CompletableFuture<ApiResponse<RoleBinding>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RoleBindingsPostWithHttpInfo(RoleBindingCreateRequest roleBindingCreateRequest) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RoleBindingsPostRequestBuilder(roleBindingCreateRequest);
      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("apiAccountsMgmtV1RoleBindingsPost", 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 apiAccountsMgmtV1RoleBindingsPostRequestBuilder(RoleBindingCreateRequest roleBindingCreateRequest) throws ApiException {
    // verify the required parameter 'roleBindingCreateRequest' is set
    if (roleBindingCreateRequest == null) {
      throw new ApiException(400, "Missing the required parameter 'roleBindingCreateRequest' when calling apiAccountsMgmtV1RoleBindingsPost");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/role_bindings";

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(roleBindingCreateRequest);
      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 roles
   * 
   * @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<RoleList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RolesGet(Integer page, Integer size, String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RolesGetRequestBuilder(page, size, search);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RolesGet", 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 roles
   * 
   * @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<RoleList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RolesGetWithHttpInfo(Integer page, Integer size, String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RolesGetRequestBuilder(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("apiAccountsMgmtV1RolesGet", 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 apiAccountsMgmtV1RolesGetRequestBuilder(Integer page, Integer size, String search) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/roles";

    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 a role by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<Role>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1RolesIdGet(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RolesIdGetRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1RolesIdGet", 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 role by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<Role>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1RolesIdGetWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1RolesIdGetRequestBuilder(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("apiAccountsMgmtV1RolesIdGet", 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 apiAccountsMgmtV1RolesIdGetRequestBuilder(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 apiAccountsMgmtV1RolesIdGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/roles/{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;
  }
  /**
   * Create or renew the entitlement to support a product for the user's organization.
   * 
   * @param product The product for self_entitlement. The supported products are [rosa]. (required)
   * @return CompletableFuture<SelfEntitlementStatus>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1SelfEntitlementProductPost(String product) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SelfEntitlementProductPostRequestBuilder(product);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SelfEntitlementProductPost", 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 or renew the entitlement to support a product for the user's organization.
   * 
   * @param product The product for self_entitlement. The supported products are [rosa]. (required)
   * @return CompletableFuture<ApiResponse<SelfEntitlementStatus>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1SelfEntitlementProductPostWithHttpInfo(String product) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SelfEntitlementProductPostRequestBuilder(product);
      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("apiAccountsMgmtV1SelfEntitlementProductPost", 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 apiAccountsMgmtV1SelfEntitlementProductPostRequestBuilder(String product) throws ApiException {
    // verify the required parameter 'product' is set
    if (product == null) {
      throw new ApiException(400, "Missing the required parameter 'product' when calling apiAccountsMgmtV1SelfEntitlementProductPost");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/self_entitlement/{product}"
        .replace("{product}", ApiClient.urlEncode(product.toString()));

    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 UHC product SKU Rules
   * 
   * @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<SkuRulesList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1SkuRulesGet(String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkuRulesGetRequestBuilder(search);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SkuRulesGet", 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 UHC product SKU Rules
   * 
   * @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<SkuRulesList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1SkuRulesGetWithHttpInfo(String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkuRulesGetRequestBuilder(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("apiAccountsMgmtV1SkuRulesGet", 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 apiAccountsMgmtV1SkuRulesGetRequestBuilder(String search) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/sku_rules";

    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;
  }
  /**
   * Delete a sku rule
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<Void>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1SkuRulesIdDelete(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkuRulesIdDeleteRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SkuRulesIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(null);
      });
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  /**
   * Delete a sku rule
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<Void>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1SkuRulesIdDeleteWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkuRulesIdDeleteRequestBuilder(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("apiAccountsMgmtV1SkuRulesIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(
                new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
            );
        }
      );
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  private HttpRequest.Builder apiAccountsMgmtV1SkuRulesIdDeleteRequestBuilder(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 apiAccountsMgmtV1SkuRulesIdDelete");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/sku_rules/{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 rules by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<SkuRules>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1SkuRulesIdGet(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkuRulesIdGetRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SkuRulesIdGet", 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 rules by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<SkuRules>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1SkuRulesIdGetWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkuRulesIdGetRequestBuilder(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("apiAccountsMgmtV1SkuRulesIdGet", 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 apiAccountsMgmtV1SkuRulesIdGetRequestBuilder(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 apiAccountsMgmtV1SkuRulesIdGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/sku_rules/{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 rule
   * 
   * @param id The id of record (required)
   * @param skuRules Updated sku rule data (required)
   * @return CompletableFuture<SkuRules>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1SkuRulesIdPatch(String id, SkuRules skuRules) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkuRulesIdPatchRequestBuilder(id, skuRules);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SkuRulesIdPatch", 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 rule
   * 
   * @param id The id of record (required)
   * @param skuRules Updated sku rule data (required)
   * @return CompletableFuture<ApiResponse<SkuRules>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1SkuRulesIdPatchWithHttpInfo(String id, SkuRules skuRules) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkuRulesIdPatchRequestBuilder(id, skuRules);
      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("apiAccountsMgmtV1SkuRulesIdPatch", 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 apiAccountsMgmtV1SkuRulesIdPatchRequestBuilder(String id, SkuRules skuRules) throws ApiException {
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1SkuRulesIdPatch");
    }
    // verify the required parameter 'skuRules' is set
    if (skuRules == null) {
      throw new ApiException(400, "Missing the required parameter 'skuRules' when calling apiAccountsMgmtV1SkuRulesIdPatch");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/sku_rules/{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(skuRules);
      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 rule
   * 
   * @param skuRules Sku rule data (required)
   * @return CompletableFuture<SkuRules>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1SkuRulesPost(SkuRules skuRules) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkuRulesPostRequestBuilder(skuRules);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SkuRulesPost", 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 rule
   * 
   * @param skuRules Sku rule data (required)
   * @return CompletableFuture<ApiResponse<SkuRules>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1SkuRulesPostWithHttpInfo(SkuRules skuRules) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkuRulesPostRequestBuilder(skuRules);
      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("apiAccountsMgmtV1SkuRulesPost", 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 apiAccountsMgmtV1SkuRulesPostRequestBuilder(SkuRules skuRules) throws ApiException {
    // verify the required parameter 'skuRules' is set
    if (skuRules == null) {
      throw new ApiException(400, "Missing the required parameter 'skuRules' when calling apiAccountsMgmtV1SkuRulesPost");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/sku_rules";

    localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));

    localVarRequestBuilder.header("Content-Type", "application/json");
    localVarRequestBuilder.header("Accept", "application/json");

    try {
      byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(skuRules);
      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 UHC product SKUs
   * 
   * @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
   * @deprecated
   */
  @Deprecated
  public CompletableFuture apiAccountsMgmtV1SkusGet(String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkusGetRequestBuilder(search);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SkusGet", 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 UHC product SKUs
   * 
   * @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
   * @deprecated
   */
  @Deprecated
  public CompletableFuture> apiAccountsMgmtV1SkusGetWithHttpInfo(String search) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkusGetRequestBuilder(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("apiAccountsMgmtV1SkusGet", 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 apiAccountsMgmtV1SkusGetRequestBuilder(String search) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/skus";

    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;
  }
  /**
   * Get a sku by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<SKU>
   * @throws ApiException if fails to make API call
   * @deprecated
   */
  @Deprecated
  public CompletableFuture apiAccountsMgmtV1SkusIdGet(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkusIdGetRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SkusIdGet", 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 by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<SKU>>
   * @throws ApiException if fails to make API call
   * @deprecated
   */
  @Deprecated
  public CompletableFuture> apiAccountsMgmtV1SkusIdGetWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SkusIdGetRequestBuilder(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("apiAccountsMgmtV1SkusIdGet", 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 apiAccountsMgmtV1SkusIdGetRequestBuilder(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 apiAccountsMgmtV1SkusIdGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/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;
  }
  /**
   * Returns a list of 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 fetchAccounts If true, includes the account reference information in the output. Could slow request response time. (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)
   * @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 labels Specifies the criteria to filter the subscription resource based on their labels. A label is represented as a `key=value` pair,  ``` labels = \"foo=bar\" ```  and multiple labels are separated by comma,  ``` labels = \"foo=bar,fooz=barz\" ``` (optional)
   * @return CompletableFuture<SubscriptionList>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1SubscriptionsGet(Integer page, Integer size, String search, Boolean fetchAccounts, Boolean fetchLabels, Boolean fetchCapabilities, String fields, String orderBy, String labels) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SubscriptionsGetRequestBuilder(page, size, search, fetchAccounts, fetchLabels, fetchCapabilities, fields, orderBy, labels);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SubscriptionsGet", 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 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 fetchAccounts If true, includes the account reference information in the output. Could slow request response time. (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)
   * @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 labels Specifies the criteria to filter the subscription resource based on their labels. A label is represented as a `key=value` pair,  ``` labels = \"foo=bar\" ```  and multiple labels are separated by comma,  ``` labels = \"foo=bar,fooz=barz\" ``` (optional)
   * @return CompletableFuture<ApiResponse<SubscriptionList>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1SubscriptionsGetWithHttpInfo(Integer page, Integer size, String search, Boolean fetchAccounts, Boolean fetchLabels, Boolean fetchCapabilities, String fields, String orderBy, String labels) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SubscriptionsGetRequestBuilder(page, size, search, fetchAccounts, fetchLabels, fetchCapabilities, fields, orderBy, labels);
      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("apiAccountsMgmtV1SubscriptionsGet", 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 apiAccountsMgmtV1SubscriptionsGetRequestBuilder(Integer page, Integer size, String search, Boolean fetchAccounts, Boolean fetchLabels, Boolean fetchCapabilities, String fields, String orderBy, String labels) throws ApiException {

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/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("fetchAccounts", fetchAccounts));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchLabels", fetchLabels));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchCapabilities", fetchCapabilities));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fields", fields));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("orderBy", orderBy));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("labels", labels));

    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;
  }
  /**
   * Deletes a subscription by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<Void>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1SubscriptionsIdDelete(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SubscriptionsIdDeleteRequestBuilder(id);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SubscriptionsIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(null);
      });
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  /**
   * Deletes a subscription by id
   * 
   * @param id The id of record (required)
   * @return CompletableFuture<ApiResponse<Void>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1SubscriptionsIdDeleteWithHttpInfo(String id) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SubscriptionsIdDeleteRequestBuilder(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("apiAccountsMgmtV1SubscriptionsIdDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(
                new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
            );
        }
      );
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  private HttpRequest.Builder apiAccountsMgmtV1SubscriptionsIdDeleteRequestBuilder(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 apiAccountsMgmtV1SubscriptionsIdDelete");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/subscriptions/{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 subscription by id
   * 
   * @param id The id of record (required)
   * @param fetchAccounts If true, includes the account reference information in the output. Could slow request response time. (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 fetchCpuAndSocket If true, fetches, from the clusters service, the total numbers of CPU's and sockets under an obligation, and includes in the output. Could slow request response time. (optional)
   * @return CompletableFuture<Subscription>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture apiAccountsMgmtV1SubscriptionsIdGet(String id, Boolean fetchAccounts, Boolean fetchLabels, Boolean fetchCapabilities, Boolean fetchCpuAndSocket) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SubscriptionsIdGetRequestBuilder(id, fetchAccounts, fetchLabels, fetchCapabilities, fetchCpuAndSocket);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SubscriptionsIdGet", 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 subscription by id
   * 
   * @param id The id of record (required)
   * @param fetchAccounts If true, includes the account reference information in the output. Could slow request response time. (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 fetchCpuAndSocket If true, fetches, from the clusters service, the total numbers of CPU's and sockets under an obligation, and includes in the output. Could slow request response time. (optional)
   * @return CompletableFuture<ApiResponse<Subscription>>
   * @throws ApiException if fails to make API call
   */
  public CompletableFuture> apiAccountsMgmtV1SubscriptionsIdGetWithHttpInfo(String id, Boolean fetchAccounts, Boolean fetchLabels, Boolean fetchCapabilities, Boolean fetchCpuAndSocket) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SubscriptionsIdGetRequestBuilder(id, fetchAccounts, fetchLabels, fetchCapabilities, fetchCpuAndSocket);
      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("apiAccountsMgmtV1SubscriptionsIdGet", 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 apiAccountsMgmtV1SubscriptionsIdGetRequestBuilder(String id, Boolean fetchAccounts, Boolean fetchLabels, Boolean fetchCapabilities, Boolean fetchCpuAndSocket) throws ApiException {
    // verify the required parameter 'id' is set
    if (id == null) {
      throw new ApiException(400, "Missing the required parameter 'id' when calling apiAccountsMgmtV1SubscriptionsIdGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/subscriptions/{id}"
        .replace("{id}", ApiClient.urlEncode(id.toString()));

    List localVarQueryParams = new ArrayList<>();
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchAccounts", fetchAccounts));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchLabels", fetchLabels));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchCapabilities", fetchCapabilities));
    localVarQueryParams.addAll(ApiClient.parameterToPairs("fetchCpuAndSocket", fetchCpuAndSocket));

    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 apiAccountsMgmtV1SubscriptionsIdLabelsGet(String id, Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SubscriptionsIdLabelsGetRequestBuilder(id, page, size, search, orderBy);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SubscriptionsIdLabelsGet", 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> apiAccountsMgmtV1SubscriptionsIdLabelsGetWithHttpInfo(String id, Integer page, Integer size, String search, String orderBy) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SubscriptionsIdLabelsGetRequestBuilder(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("apiAccountsMgmtV1SubscriptionsIdLabelsGet", 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 apiAccountsMgmtV1SubscriptionsIdLabelsGetRequestBuilder(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 apiAccountsMgmtV1SubscriptionsIdLabelsGet");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/subscriptions/{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 apiAccountsMgmtV1SubscriptionsIdLabelsKeyDelete(String id, String key) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SubscriptionsIdLabelsKeyDeleteRequestBuilder(id, key);
      return memberVarHttpClient.sendAsync(
          localVarRequestBuilder.build(),
          HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
            if (localVarResponse.statusCode()/ 100 != 2) {
              return CompletableFuture.failedFuture(getApiException("apiAccountsMgmtV1SubscriptionsIdLabelsKeyDelete", 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> apiAccountsMgmtV1SubscriptionsIdLabelsKeyDeleteWithHttpInfo(String id, String key) throws ApiException {
    try {
      HttpRequest.Builder localVarRequestBuilder = apiAccountsMgmtV1SubscriptionsIdLabelsKeyDeleteRequestBuilder(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("apiAccountsMgmtV1SubscriptionsIdLabelsKeyDelete", localVarResponse));
            }
            return CompletableFuture.completedFuture(
                new ApiResponse(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
            );
        }
      );
    }
    catch (ApiException e) {
      return CompletableFuture.failedFuture(e);
    }
  }

  private HttpRequest.Builder apiAccountsMgmtV1SubscriptionsIdLabelsKeyDeleteRequestBuilder(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 apiAccountsMgmtV1SubscriptionsIdLabelsKeyDelete");
    }
    // verify the required parameter 'key' is set
    if (key == null) {
      throw new ApiException(400, "Missing the required parameter 'key' when calling apiAccountsMgmtV1SubscriptionsIdLabelsKeyDelete");
    }

    HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();

    String localVarPath = "/api/accounts_mgmt/v1/subscriptions/{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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy