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

Use Account ids #852

Merged
merged 9 commits into from
Mar 25, 2021
Merged

Use Account ids #852

merged 9 commits into from
Mar 25, 2021

Conversation

fortuna
Copy link
Collaborator

@fortuna fortuna commented Mar 24, 2021

This PR switches from using isManaged to using account ids.

This should help with the follow up to #848, since you will need to ensure unique server ids.

Things to note:

  • Ids are passed in the Server and Account constructors. This way we can ensure unique ids without server having to know about its Account, and Account knowing its Cloud.
  • Account ID is just 'do' for now. We can use 'gcp', and in the future we can easily extend to actually include an account id (e.g. 'do:xyz1234')
  • Manual servers have account id === null

This approach may simplify your GCP UI PR by allowing the accounts to be handled the same way.
For example, we could fire a "AccountSignOutRequested' with an accountId, which can pull the account and call account.disconnect(). You'd need an Account interface in that case.
Perhaps the app-root dom tree can be done by two nested dom-repeat.

@fortuna fortuna requested a review from mpmcroy March 24, 2021 03:41
@google-cla google-cla bot added the cla: yes label Mar 24, 2021
Copy link
Contributor

@mpmcroy mpmcroy left a comment

Choose a reason for hiding this comment

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

I like this idea!

I have one question in the comments that would help me understand how we want to treat these IDs.

@fortuna fortuna mentioned this pull request Mar 24, 2021
Copy link
Contributor

@mpmcroy mpmcroy left a comment

Choose a reason for hiding this comment

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

I like this change a lot 🔥

@@ -122,8 +122,6 @@ export interface ManagedServerHost {
getRegionId(): RegionId;
// Deletes the server - cannot be undone.
delete(): Promise<void>;
// Returns the virtual host ID.
getHostId(): string;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we update the Server#getId method to mention that this ID is unique across clouds?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator Author

@fortuna fortuna left a comment

Choose a reason for hiding this comment

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

Another look?

@@ -122,8 +122,6 @@ export interface ManagedServerHost {
getRegionId(): RegionId;
// Deletes the server - cannot be undone.
delete(): Promise<void>;
// Returns the virtual host ID.
getHostId(): string;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@fortuna fortuna requested a review from mpmcroy March 25, 2021 17:43
Copy link
Collaborator Author

@fortuna fortuna left a comment

Choose a reason for hiding this comment

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

Oh, I see you approved. I'll submit once the CI is done.

@mpmcroy
Copy link
Contributor

mpmcroy commented Mar 25, 2021

Thanks for this refactor!! I like where this is atm, but if you want to explore it a bit more, let me know and I'll take another look.

@fortuna fortuna merged commit ac0d26a into master Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants