-
Notifications
You must be signed in to change notification settings - Fork 116
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
[client] deprecate SCO promote_to_indicator in favor of promote_to_indicator_v2 (#6171) #680
Conversation
pycti/entities/stixCyberObservables/opencti_stix_cyber_observable_latest.py
Outdated
Show resolved
Hide resolved
ac067f5
to
31e76c4
Compare
…teToIndicator * promote incorrectly returns the original observable and is now deprecated * promoteToIndicator returns the newly created indicator
6266de4
to
ea1e330
Compare
19fddfc
to
f39d8af
Compare
11b81e1
to
e3827ba
Compare
@@ -0,0 +1,256 @@ | |||
INDICATOR_PROPERTIES = """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For code clarity, we want to extract the entities properties (used in GQL queries) in dedicated files.
This will 1) make the business code lighter, and 2) allow to use them in several files.
As the new promote_to_indicator_v2
method returns an indicator, I'm already in 2) use-case.
@deprecation.deprecated( | ||
deprecated_in="6.2", | ||
removed_in="6.5", | ||
details="Use promote_to_indicator_v2 instead.", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will print a warning message if the method is used, allowing our users to maintain their scripts more easily, hopefully.
At the graphql API level:
Proposed changes
The method
api.stix_cyber_observable.promoto_to_indicator
that uses gqlpromote
mutation is kept but is now mlarked as deprecated.New method
api.stix_cyber_observable.promoto_to_indicator_v2
is created to use the new gql mutation promoteToIndicator.Related issues
Checklist
Further comments
First implementation of a deprecation strategy at the level of client-python.
We use a mixin so that the
StixCyberObservable
class inherits the deprecated behavior, moved to a dedicated sub module inentities.strix_cyber_observable.StixCyberObservableDeprecatedMixin
The examples are updated to use the new API, while the old API is tested for non-regression in an integration test.
Deprecated code is meant to live for 3 major versions, and then removed from the code base.