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

Add project tag functionalities in identity v3 #3018

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gebamp
Copy link

@gebamp gebamp commented Mar 31, 2024

With this PR, we add API support for:

  • Adding a tag on a project.
  • Checking if a project has a tag.
  • Deleting a tag from a project.

Partially implements: #3015

Check if project contains tag:
API Docs
Py code

Add tag to project:
API Docs
Py code

Delete a single tag from project:
API Docs
Py code

@github-actions github-actions bot added the semver:minor Backwards-compatible change label Mar 31, 2024
@coveralls
Copy link

coveralls commented Mar 31, 2024

Coverage Status

coverage: 79.039% (+0.02%) from 79.017%
when pulling 713cad7 on gebamp:identity-v3-project-tag
into 543d9fd on gophercloud:master.

@gebamp gebamp changed the title [wip] Add project tag functionalities in identity v3 Add project tag functionalities in identity v3 Mar 31, 2024
@gebamp
Copy link
Author

gebamp commented Apr 2, 2024

Hey, @mandre / @pierreprinetti could you possibly have a look at this? We sort of need it.

@pierreprinetti
Copy link
Contributor

@mandre do we ever use an admin account of devstack in the acceptance tests? This could be a nice candidate

Copy link
Contributor

@mandre mandre left a comment

Choose a reason for hiding this comment

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

I'm not exactly clear on how this differs from tag management via the /v3/projects endpoint, but eh... we're not here to discuss OpenStack API.

I have a few comments about naming, and arguments passed to the functions. It would also be nice if we implemented the ListTags() API call as well.

Could you make sure to add acceptance tests as well so that we're exercising this new code against real OpenStack deployments, for all supported version of OpenStack?

openstack/identity/v3/projects/doc.go Outdated Show resolved Hide resolved
openstack/identity/v3/projects/requests.go Outdated Show resolved Hide resolved
}

// AddProjectTag adds a tag in a project.
func AddProjectTag(ctx context.Context, client *gophercloud.ServiceClient, projectID string, tag string) (r AddProjectTagResult) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should take a list of tags. Also, drop Project from the function name and make this plural. This should then be called AddTags().

Copy link
Author

Choose a reason for hiding this comment

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

Regarding this, we are implementing Add single tag to a project which only takes one tag , and not Modify tag list for a project which takes a list of tags. Therefore, I think the name AddTag() is more suitable and by extension I dont think we need to change the tag argument to a list.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, you're right. I've somehow missed the API call that takes a tag. That being said, it shouldn't be difficult to add the variants that take a list of tags and perhaps it would be worth it to add it there too. Same for the variant of Delete that drops all tags. What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

I agree that it wouldn't be too much of a hustle to add the list and delete all tags API calls. But, I would rather adding the rest of the project tag of the API suite in another PR, because we need the three API calls of this MR kinda quickly.

}

// DeleteProjectTag deletes a tag from a project.
func DeleteProjectTag(ctx context.Context, client *gophercloud.ServiceClient, projectID string, tag string) (r DeleteProjectTagResult) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, make this plural -> DeleteTags().

Also, the API call drops all tags, and should not take a tag argument.

Copy link
Author

@gebamp gebamp Apr 8, 2024

Choose a reason for hiding this comment

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

For this one, we want to implement the Delete a single tag from project API call which takes a single tag and deletes it and not the Remove all tags from a project which drops all tags. Therefore, DeleteTag is a more suitable name, and therefore I think we still need the tag argument.

@github-actions github-actions bot added semver:major Breaking change and removed semver:minor Backwards-compatible change labels Apr 17, 2024
@gebamp
Copy link
Author

gebamp commented Apr 17, 2024

@mandre I did the Fixups, and included the acceptances tests!

@github-actions github-actions bot added semver:major Breaking change and removed semver:major Breaking change labels Apr 19, 2024
@gebamp
Copy link
Author

gebamp commented Apr 30, 2024

@mandre Can you check this out, when you have time?

@mandre
Copy link
Contributor

mandre commented Apr 30, 2024

Apologies @gebamp, I'm traveling and won't be able to do a proper review. @pierreprinetti @EmilienM could you take a look?

@EmilienM
Copy link
Contributor

EmilienM commented May 6, 2024

please rebase and then LGTM

@github-actions github-actions bot added semver:unknown Unable to figure out the semver type and removed semver:major Breaking change semver:unknown Unable to figure out the semver type labels May 6, 2024
@github-actions github-actions bot added semver:unknown Unable to figure out the semver type and removed semver:unknown Unable to figure out the semver type labels May 7, 2024
@github-actions github-actions bot added semver:minor Backwards-compatible change and removed semver:unknown Unable to figure out the semver type labels May 7, 2024
@gebamp
Copy link
Author

gebamp commented May 7, 2024

@EmilienM Done with the rebase, when you have time feel free to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor Backwards-compatible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants