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

DG-1697: Adding endpoint for linking/unlink policy #3349

Merged
merged 25 commits into from
Aug 5, 2024

Conversation

arpit-at
Copy link

Change description

Created two new endpoints in the metastore:

  1. Unlink Policies
Endpoint: POST alternate/{policy-id}/unlink-business-policy
Body: {"unlinkGuids":["assetId1", "assetId2"]}

2 Link Policies

Endpoint: POST alternate/{policy-id}/link-business-policy
Body: {"linkGuids":["assetId1", "assetId2"]}

These endpoints link or unlink policies from a set of asset IDs with minimal operations:

  1. Verify if the request is from a service account.
  2. Loop through all assets.
  3. Load each asset.
  4. Link or unlink the policy.
  5. Increment or decrement the asset policies count.

Type of change

  • Bug fix (fixes an issue)
  • New feature (adds functionality)

Related issues

Checklists

Development

  • Lint rules pass locally
  • Application changes have been tested thoroughly
  • Automated tests covering modified code pass

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

Code review

  • [ x] Pull request has a descriptive title and context useful to a reviewer. Screenshots or screencasts are attached as necessary
  • "Ready for review" label attached and reviewers assigned
  • Changes have been reviewed by at least one other contributor
  • Pull request linked to task tracker where applicable

@arpit-at arpit-at changed the title Policyendpointsmasterss DG-1697: Adding endpoint for linking/unlink policy Jul 19, 2024
@arpit-at arpit-at marked this pull request as draft July 19, 2024 10:43
EntityMutationResponse entityMutationResponse = new EntityMutationResponse();
for (AtlasVertex vertex : vertices) {
// Convert each vertex to an AtlasEntityHeader and add it to the response
AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeader(vertex);

Choose a reason for hiding this comment

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

Do we need to fetch entire entity and attched tags, meanings all the time , if not optimize the call to fetch only the entity header

Copy link
Author

@arpit-at arpit-at Jul 23, 2024

Choose a reason for hiding this comment

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

Do you mean findByGuid can be avoided?

Copy link

@sumandas0 sumandas0 left a comment

Choose a reason for hiding this comment

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

Added few comments

@arpit-at arpit-at marked this pull request as ready for review July 24, 2024 13:33
@arpit-at arpit-at requested a review from nikhilbonte21 July 24, 2024 13:34
nikhilbonte21
nikhilbonte21 previously approved these changes Jul 29, 2024
@arpit-at arpit-at merged commit e50cc62 into master Aug 5, 2024
4 of 5 checks passed
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.

4 participants