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

Implement the "remove_label" function for the "stix_core_relationship" #754

Open
Lhorus6 opened this issue Oct 22, 2024 · 0 comments
Open
Labels
feature use for describing a new feature to develop needs triage use to identify issue needing triage from Filigran Product team

Comments

@Lhorus6
Copy link

Lhorus6 commented Oct 22, 2024

Problem to Solve

stix_core_relationship does not have any remove_label function as there is for stix_cyber_observable and stix_domain_object despite having the same add_label function.

Current Workaround

Use GraphQL query

Proposed Solution

Implement the function in the python client. This is what the function could be:

if label_name is not None: label = self.client.label.read( filters={ "mode": "and", "filters": [{"key": "value", "values": [label_name]}], "filterGroups": [], } ) if label: label_id = label["id"] if rel_id is not None and label_id is not None: self.client.app_logger.info( "Removing label from Stix-Core-Relationship", {"label_id": label_id, "id": id}, ) query = """ mutation StixCoreRelationshipLabelsViewRelationDeleteMutation($id: ID!, $toId: StixRef!, $relationship_type: String!) { stixCoreRelationshipEdit(id: $id) { relationDelete(toId: $toId, relationship_type: $relationship_type) { objectLabel { id value color } id } } } """ self.client.query( query, { "id": id, "toId": label_id, "relationship_type": "object-label", }, ) else: self.client.app_logger.error("Missing parameters: id and label_id")

@Lhorus6 Lhorus6 added feature use for describing a new feature to develop needs triage use to identify issue needing triage from Filigran Product team labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature use for describing a new feature to develop needs triage use to identify issue needing triage from Filigran Product team
Projects
None yet
Development

No branches or pull requests

1 participant