Skip to content

Revert "bugfix/AX-62610_short_axon_id_appears_in_exported_get" #310

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions axonius_api_client/api/asset_callbacks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
FIELDS_DETAILS_EXCLUDE,
FIELDS_ENTITY_PASSTHRU,
SCHEMAS_CUSTOM,
EXCLUDED_DEFAULT_FIELDS_MAP,
ALL_FIELDS_KEY,
)
from ...exceptions import ApiError
from ...tools import (
Expand Down Expand Up @@ -268,7 +266,10 @@ def start(self, **kwargs):
)
self.STORE["include_details"] = include_details = True

self._expand_field_excludes(excludes=excludes, include_details=include_details)
if include_details:
missing = [x for x in FIELDS_DETAILS_EXCLUDE if x not in excludes]
self.echo(msg=f"Adding fields {missing} to field_excludes: {excludes}", debug=True)
self.set_arg_value("field_excludes", value=excludes + missing)

cb_args = crjoin(join_kv(obj=self.GETARGS))
self.LOG.debug(f"Get Extra Arguments: {cb_args}")
Expand All @@ -279,21 +280,6 @@ def start(self, **kwargs):
store = crjoin(join_kv(obj=self.STORE))
self.echo(msg=f"Get Arguments: {store}")

def _expand_field_excludes(self, excludes: list, include_details: bool):
# enriches the excluded fields param when necessary
if include_details:
missing = [x for x in FIELDS_DETAILS_EXCLUDE if x not in excludes]
self.echo(msg=f"Adding fields {missing} to field_excludes: {excludes}", debug=True)
self.set_arg_value("field_excludes", value=excludes + missing)

fields = listify(self.STORE.get("fields", []))
should_not_exclude_fields = ALL_FIELDS_KEY in fields
if should_not_exclude_fields:
return
default_fields_to_exclude = [field[1] for field in EXCLUDED_DEFAULT_FIELDS_MAP if field[0] not in fields]
if default_fields_to_exclude:
self.set_arg_value("field_excludes", value=excludes + default_fields_to_exclude)

# noinspection PyUnusedLocal
def echo_columns(self, **kwargs):
"""Echo the columns of the fields selected."""
Expand Down
9 changes: 0 additions & 9 deletions axonius_api_client/constants/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,6 @@ def is_axid(value: t.Any) -> bool:
]
"""Fields that should be excluded when include_details=True"""

EXCLUDED_DEFAULT_FIELDS_MAP: t.List[tuple] = [
("agg:short_axon_id", "short_axon_id"),
("agg:axon_id", "specific_data.data.axon_id"),
]
"""Fields that are manually excluded unless specifically requested"""

ALL_FIELDS_KEY: str = "agg:all"
"""Field that's being used to retrieve all fields from entities"""

FIELDS_ENTITY_PASSTHRU: t.List[str] = [
"adapter_list_length",
"internal_axon_id",
Expand Down
Loading