Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 3e1aae7

Browse files
committed
[client] handle indicator field patch
1 parent acf3ce0 commit 3e1aae7

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

pycti/entities/opencti_indicator.py

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -302,44 +302,42 @@ def create(self, **kwargs):
302302
)
303303

304304

305-
"""
305+
"""
306306
Update an Indicator object field
307307
308308
:param id: the Indicator id
309309
:param input: the input of the field
310310
"""
311-
312-
313-
def update_field(self, **kwargs):
314-
id = kwargs.get("id", None)
315-
input = kwargs.get("input", None)
316-
if id is not None and input is not None:
317-
self.opencti.app_logger.info("Updating Indicator", {"id": id})
318-
query = """
319-
mutation IndicatorFieldPatch($id: ID!, $input: [EditInput]!) {
320-
indicatorFieldPatch(id: $id, input: $input) {
321-
id
322-
standard_id
323-
entity_type
311+
def update_field(self, **kwargs):
312+
id = kwargs.get("id", None)
313+
input = kwargs.get("input", None)
314+
if id is not None and input is not None:
315+
self.opencti.app_logger.info("Updating Indicator", {"id": id})
316+
query = """
317+
mutation IndicatorFieldPatch($id: ID!, $input: [EditInput]!) {
318+
indicatorFieldPatch(id: $id, input: $input) {
319+
id
320+
standard_id
321+
entity_type
322+
}
324323
}
325324
}
326-
}
327-
"""
328-
result = self.opencti.query(
329-
query,
330-
{
331-
"id": id,
332-
"input": input,
333-
},
334-
)
335-
return self.opencti.process_multiple_fields(
336-
result["data"]["indicatorFieldPatch"]
337-
)
338-
else:
339-
self.opencti.app_logger.error(
340-
"[opencti_stix_domain_object] Missing parameters: id and input"
341-
)
342-
return None
325+
"""
326+
result = self.opencti.query(
327+
query,
328+
{
329+
"id": id,
330+
"input": input,
331+
},
332+
)
333+
return self.opencti.process_multiple_fields(
334+
result["data"]["indicatorFieldPatch"]
335+
)
336+
else:
337+
self.opencti.app_logger.error(
338+
"[opencti_stix_domain_object] Missing parameters: id and input"
339+
)
340+
return None
343341

344342
def add_stix_cyber_observable(self, **kwargs):
345343
"""

0 commit comments

Comments
 (0)