Skip to content

Issue 51 pcu group methods#52

Merged
toptobes merged 2 commits into
mainfrom
issue-51-pcu-group-methods
Jul 7, 2026
Merged

Issue 51 pcu group methods#52
toptobes merged 2 commits into
mainfrom
issue-51-pcu-group-methods

Conversation

@bdunn313

@bdunn313 bdunn313 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds two missing PCU endpoints to the OpenAPI spec and regenerates the Go client.

New endpoints

  • POST /v2/pcus/types (pcuGetTypes): Returns available PCU types, accepting optional
    region/provider filters via PCUGroupTypesRequest body. Response is an array of PCUGroupTypeResponse.
  • GET /v2/pcus/actions/get/{datacenterUUID} (pcuGroupGetByDatacenterUUID): Returns the PCU
    group for a given datacenter UUID. Response is an array of PCUGroup.

Both endpoints are tagged PCU and match the upstream public spec.

New schemas

Schema Description
PCUGroupTypesRequest Request body for pcuGetTypes — optional provider and region filters
PCUGroupTypeResponse Single item in the pcuGetTypes response
PCUGroupTypeDetails Nested hardware details within PCUGroupTypeResponse (vCPU, memory, disk cache)
PCUGroupType String discriminator for PCU type

Response code format

New PCU endpoints use literal '500' / '400' response codes as required by oapi-codegen.


Usage examples

List PCU types (all providers/regions)

client, _ := astra.NewClientWithResponses("https://api.astra.datastax.com")

resp, err := client.PcuGetTypesWithResponse(ctx, astra.PCUGroupTypesRequest{})
if err != nil {
    return err
}
for _, t := range *resp.JSON200 {
    fmt.Printf("type=%s provider=%s region=%s vCPU=%d\n",
        *t.Type, *t.Provider, *t.Region, *t.Details.VCPU)
}

List PCU types filtered by provider and region

provider := "AWS"
region   := "us-east-1"

resp, err := client.PcuGetTypesWithResponse(ctx, astra.PCUGroupTypesRequest{
    Provider: &provider,
    Region:   &region,
})
if err != nil {
    return err
}
// resp.JSON200 is *[]astra.PCUGroupTypeResponse

Get PCU group for a datacenter

resp, err := client.PcuGroupGetByDatacenterUUIDWithResponse(ctx, datacenterUUID)
if err != nil {
    return err
}
for _, g := range *resp.JSON200 {
    fmt.Printf("uuid=%s region=%s status=%s\n", *g.Uuid, *g.Region, *g.Status)
}

Checklist

  • make generate passes cleanly
  • make build compiles cleanly
  • No existing operationId or schema field changed (backward-compatible)
  • All new fields sourced from upstream public spec — no invented fields

Closes #51

bdunn313 added 2 commits July 2, 2026 17:52
- POST /v2/pcus/types (pcuGetTypes): get available PCU types with optional region/provider filters
- GET /v2/pcus/actions/get/{datacenterUUID} (pcuGroupGetByDatacenterUUID): get PCU group for a given datacenter
- New schemas: PCUGroupTypesRequest, PCUGroupTypeResponse, PCUGroupTypeDetails, PCUGroupType
- Use '500' literal response codes (not 5XX wildcard) consistent with repo convention
- Regenerated astra.gen.go

@toptobes toptobes left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. It's strange that pcuGroupGetByDatacenterUUID returns an array but it seems to be for backwards compatibility from the API so we probably shouldn't do anything about it here since it's just an autogenerated wrapper

@toptobes toptobes merged commit fa3962d into main Jul 7, 2026
1 check passed
@toptobes toptobes deleted the issue-51-pcu-group-methods branch July 7, 2026 00:48
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.

Include new PCU group endpoints in client

2 participants