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

feat: add loggedin user account related entities and API endpoint interactions #52

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

sachin120
Copy link
Contributor

What does this implement

Added user account-related API

  • Create Authorisation Token
  • Delete Authorisation Token
  • List Authorisation Tokens
  • Update Token Name

@sachin120 sachin120 changed the title feat: add loggedin user account related entities and API enpoint interactions feat: add loggedin user account related entities and API endpoint interactions Jan 15, 2024
@sachin120 sachin120 force-pushed the user-accounts branch 3 times, most recently from 4c3359b to c8b36f6 Compare January 15, 2024 13:18
troyanov
troyanov previously approved these changes Jan 16, 2024
Copy link
Member

@troyanov troyanov left a comment

Choose a reason for hiding this comment

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

Hi @sachin120
Thank you for your contribution 👍

LGTM and +1
May I ask you to resolve the conflict at client/client.go? If you don't have time, we can take care of that.

Copy link
Collaborator

@skatsaounis skatsaounis left a comment

Choose a reason for hiding this comment

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

Hi @sachin120,

It seems that you need to create two entities since MAAS returns different response on listing tokens and at create response. Please take a look at the example:

ubuntu@maas-dev:~$ maas admin account create-authorisation-token
Success.
Machine-readable output follows:
{"token_key": "abcabc", "token_secret": "123123", "consumer_key": "!@#!@#", "name": "MAAS consumer"}

ubuntu@maas-dev:~$ maas admin account list-authorisation-tokens
Success.
Machine-readable output follows:
[
    {
        "name": "MAAS consumer",
        "token": "!@#!@#:abcabc:123123"
    }
]

So we need an entity for each one of them. Please update your PR and I will be glad to merge it 🙂

@sachin120
Copy link
Contributor Author

Hi @sachin120,

It seems that you need to create two entities since MAAS returns different response on listing tokens and at create response. Please take a look at the example:

ubuntu@maas-dev:~$ maas admin account create-authorisation-token
Success.
Machine-readable output follows:
{"token_key": "abcabc", "token_secret": "123123", "consumer_key": "!@#!@#", "name": "MAAS consumer"}

ubuntu@maas-dev:~$ maas admin account list-authorisation-tokens
Success.
Machine-readable output follows:
[
    {
        "name": "MAAS consumer",
        "token": "!@#!@#:abcabc:123123"
    }
]

So we need an entity for each one of them. Please update your PR and I will be glad to merge it 🙂

I missed it. Thanks @skatsaounis

troyanov
troyanov previously approved these changes Jan 16, 2024
Copy link
Member

@troyanov troyanov left a comment

Choose a reason for hiding this comment

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

Just a nitpick, I think AuthorisationTokenListItem will be a less confusing name for a variable.

entity/account.go Outdated Show resolved Hide resolved
entity/account.go Outdated Show resolved Hide resolved
api/account.go Outdated Show resolved Hide resolved
client/account.go Outdated Show resolved Hide resolved
client/account.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@skatsaounis skatsaounis left a comment

Choose a reason for hiding this comment

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

LGTM +1 Thanks for yet another contribution 🎉

@skatsaounis skatsaounis merged commit 8b6b593 into canonical:master Jan 16, 2024
3 checks passed
@sachin120 sachin120 deleted the user-accounts branch January 17, 2024 01:37
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.

3 participants