Skip to content

Conversation

@toptobes
Copy link
Collaborator

@toptobes toptobes commented Oct 23, 2025

WIP!!!!

Did my best to follow the conventions of the current code, down to the grammar

Adds three new clients:

  • PcuGroupsClient
    • This serves a similar role to AstraDBOpsClient in that it doesn't work with one specific PCU group, but rather lets you create and find them
  • PcuGroupOpsClient
    • This serves a similar role to DbOpsClient in that it lets you manage a specific group (RUD),
  • PcuGroupDbAssociationsClient
    • This is the black sheep of the family and manages associations between PCU groups and datacenters
      • I'm not very set on the naming of its methods
      • It's coded defensively, in anticipation of potentially other PcuGroup*AssociationsClients
        • Streaming, for example, may have PCU support in the future. It's not very clear to me though.

Three new exceptions too:

  • PcuGroupDbAssociationNotFound
  • PcuGroupNotFoundException
  • PcuGroupsNotFoundException

As well as a bunch of new domain classes.

Example usage:

val pcuGroupsClient = new AstraOpsClient(<token>).pcuGroups()

val pcuGroupEntity = pcuGroupsClient.create(
    PcuGroupCreationRequest.builder()
        .title("pcu_group_32.5")
        .cloudProvider(AWS)
        .cloudRegion("mars-cloud-station-3")
        .minCapacity(1)
        .maxCapacity(3)
        .build()
);

val pcuGroupDao = pcuGroupsCilent.group(pcuGroupEntity.getUuid());

pcuGroupDao.datacenterAssociations().associate(<datacenterId>);

while (!pcuGroupDao.isActive()) {
    Thread.sleep(500);
}

if (pcuGroupDao.datacenterAssociations().exist(<datacenterId>)) {
    System.out.println('yay');
} else {
    cry();
}

Todo:

  • More client-side validations
    • Partially because the server is not great at validating its own requests
  • Some client-side defaults in creations
    • Things that should be defaulted on the server but aren't reliably done so
  • Play with changing PcuGroupDbAssociationsClient around
    • It just has that je ne sais quoi which irks me
  • Potentially rename some things on the client side for consistency/clarity
    • Mainly things like uuid -> id or min -> min_capacity
  • Potentially add 'wait for status' operations

Things can and will change as I get more answers to my questions from the PCU team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants