Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve locality type of an API #1226

Open
Vinzius opened this issue Apr 8, 2024 · 0 comments
Open

Improve locality type of an API #1226

Vinzius opened this issue Apr 8, 2024 · 0 comments

Comments

@Vinzius
Copy link
Collaborator

Vinzius commented Apr 8, 2024

Context

At the moment, the locality object of an API (example with Instance) is only providing part of the information.

What information would be useful:

  • API is zonal
  • API is regional
  • API is global (missing)
  • API is missing its locality definition (missing)

Proposition

We could upgrade the object to this:

type ApiLocality = {
  type: 'zone'
  zones: Zone[]
} | {
  type: 'region'
  regions: Region[]
} | {
  type: 'global'
}

Which could lead to this object:

export class API extends ParentAPI {
  // Case 1: zone
  public static readonly LOCALITY: ApiLocality = { type: 'zone', zones: ['fr-par-1', 'fr-par-2'] }

  // Case 2: region
  public static readonly LOCALITY: ApiLocality = { type: 'region', regions: ['fr-par'] }

  // Case 3: global
  public static readonly LOCALITY: ApiLocality = { type: 'global' }

  // Case 4: not defined
}

Migration

Both objects would be supported for a period of time (the former one with a @deprecated).

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

No branches or pull requests

1 participant