Aefr¶
Client¶
-
class
Aefr.
Client
¶ A client object representing ‘Aefr’ Service:
import almdrlib client = almdrlib.client('aefr')
Available methods:
-
create_dlq_replay_request
(**kwargs)¶ Starts Replay of DLQ data for the specified engine
Submits a request to replay limit number of DLQ records for the engine. The API makes a best effort attept to ensure accidentally replay of the same data twice.
Request Syntax
response = client.create_dlq_replay_request( engine='aefr_eng_logmsgs'|'aefr_eng_idsmsgs'|'aefr_eng_auditmsgs'|'aefr_eng_observation'|'aefr_eng_telemetry'|'aetrigger_eng' filter='string' limit='integer' )
- Parameters
engine (string) –
[REQUIRED]
Valid values:
aefr_eng_logmsgs
,aefr_eng_idsmsgs
,aefr_eng_auditmsgs
,aefr_eng_observation
,aefr_eng_telemetry
,aetrigger_eng
filter (string) –
limit (integer) –
- Return type
string
- Returns
Response Syntax
'STARTED'
Response Definitions
-
create_filter
(**kwargs)¶ Creates or updates (overwrites) a filter route rule for specific customer. Generally filters should be defined in Cloud Formation since they require one (or more) kinesis streams to write output on. See cfn-ae-stack repo for examples.
Request Syntax
response = client.create_filter( account_id='string' expression='string' format='plain'|'csv'|'firehose' output=[ 'string' ] path='string' )
- Parameters
account_id (string) –
[REQUIRED]
AIMS Account ID
expression (string) –
format (string) –
Output Format. plain by default. Can be plain(nested JSON), firehose(NLD JSON), csv. Note about CSV: it will rely only on the projections names natural order (not select order), does not support nested jsons and can work with up to 32 projections. Use aliases to control order.’
Valid values:
plain
,csv
,firehose
output (list) –
(string) –
path (string) –
[REQUIRED]
Filter logical path
- Return type
dict
- Returns
Response Syntax
{ 'filter_id': 'string' }
Response Definitions
filter_id (string) –
-
create_global_filter
(**kwargs)¶ Creates or updates (overwrites) a filter route rule. Generally filters should be defined in Cloud Formation since they require one (or more) kinesis streams to write output on. See cfn-ae-stack repo for examples.
Request Syntax
response = client.create_global_filter( expression='string' format='plain'|'csv'|'firehose' output=[ 'dict|string' ] path='string' )
- Parameters
expression (string) –
format (string) –
Output Format. plain by default. Can be plain(nested JSON), firehose(NLD JSON), csv. Note about CSV: it will rely only on the projections names natural order (not select order), does not support nested jsons and can work with up to 32 projections. Use aliases to control order.
Valid values:
plain
,csv
,firehose
output (list) –
(dict) –
path (string) –
[REQUIRED]
Filter logical path
- Return type
dict
- Returns
Response Syntax
{ 'filter_id': 'string' }
Response Definitions
filter_id (string) –
-
create_global_trigger
(**kwargs)¶ Stores Trigger (update or create)
Request Syntax
response = client.create_global_trigger( expression='string' observation={ 'generate': 'string', 'keys': { 'event': 'string' }, 'properties': { 'ids': 'string' }, 'scope': 'string' } path='string' )
- Parameters
expression (string) –
observation (dict) –
[REQUIRED]
generate (string) –
keys (dict) –
event (string) –
properties (dict) –
ids (string) –
scope (string) –
path (string) –
[REQUIRED]
the urlencoded content path of this item
- Return type
dict
- Returns
Response Syntax
{ 'trigger_id': 'string' }
Response Definitions
trigger_id (string) –
-
create_trigger
(**kwargs)¶ Stores Trigger (update or create) for specific customer
Request Syntax
response = client.create_trigger( account_id='string' experssion='string' observation={ 'generate': 'string', 'keys': { 'event': 'string' }, 'properties': { 'ids': 'string' }, 'scope': 'string' } path='string' )
- Parameters
account_id (string) –
[REQUIRED]
AIMS Account ID
experssion (string) –
observation (dict) –
[REQUIRED]
generate (string) –
keys (dict) –
event (string) –
properties (dict) –
ids (string) –
scope (string) –
path (string) –
[REQUIRED]
the urlencoded content path of this item
- Return type
dict
- Returns
Response Syntax
{ 'stored': 'string' }
Response Definitions
stored (string) –
-
delete_filter
(**kwargs)¶ Delete a filter rule.
Request Syntax
response = client.delete_filter( account_id='string' path='string' )
- Parameters
account_id (string) –
[REQUIRED]
AIMS Account ID
path (string) –
[REQUIRED]
Trigger Path
- Return type
dict
- Returns
Response Syntax
{ 'deleted': 'string' }
Response Definitions
deleted (string) –
-
delete_global_filter
(**kwargs)¶ Delete a global filter rule.
Request Syntax
response = client.delete_global_filter( path='string' )
- Parameters
path (string) –
[REQUIRED]
Trigger Path
- Return type
dict
- Returns
Response Syntax
{ 'deleted': 'string' }
Response Definitions
deleted (string) –
-
delete_global_trigger
(**kwargs)¶ Delete a global trigger rule.
Request Syntax
response = client.delete_global_trigger( path='string' )
- Parameters
path (string) –
[REQUIRED]
Trigger Path
- Return type
dict
- Returns
Response Syntax
{ 'deleted': 'string' }
Response Definitions
deleted (string) –
-
delete_trigger
(**kwargs)¶ Delete a trigger rule.
Request Syntax
response = client.delete_trigger( account_id='string' path='string' )
- Parameters
account_id (string) –
[REQUIRED]
AIMS Account ID
path (string) –
[REQUIRED]
Trigger Path
- Return type
dict
- Returns
Response Syntax
{ 'deleted': 'string' }
Response Definitions
deleted (string) –
-
expire_filter
(**kwargs)¶ Set a filter’s expiration timestamp.
Note that setting expiration is effective immediately, just like if it was set up at the filter’s creation time. This means that queries for the filter having an associated timestamp posterior to the expiration time will suddenly not receive the filter. This is by design and is intended as a way to prevent bad filters from being used by the ae system as soon as possible.
If the content_id being expired is not the first version of the filter that was posted, the filter will NOT revert to its previous content_id; it will simply disappear (it IS expired) until the next version of the filter is posted. If you find yourself in need of expiring a bad ontent_id and have a good copy of the filter on hand, you can post it as early as possible: expiring an earlier content_id does not affect newer ones. As to what happen to data that would have been processed by an expired filter, depending if they are processed before or after the expiration is propagated through the AE system, they will see the expired filter or not.
Note that because expiration done after the fact is done outside of regular content updates and because of caching, it may take a few minutes for the expiration to propagate throughout the AE system.
Request Syntax
response = client.expire_filter( data='integer' filter_id='string' )
- Parameters
data (integer) –
filter_id (string) –
[REQUIRED]
FR ID
- Return type
dict
- Returns
Response Syntax
{ 'updated': 'string' }
Response Definitions
updated (string) –
-
expire_trigger
(**kwargs)¶ Set a trigger’s expiration timestamp.
Note that setting expiration is effective immediately, just like if it was set up at the trigger’s creation time. This means that queries for the trigger having an associated timestamp posterior to the expiration time will suddenly not receive the trigger. This is by design and is intended as a way to prevent bad triggers from being used by the ae system as soon as possible.
If the content_id being expired is not the first version of the trigger that was posted, the trigger will NOT revert to its previous content_id; it will simply disappear (it IS expired) until the next version of the trigger is posted. If you find yourself in need of expiring a bad content_id and have a good copy of the trigger on hand, you can post it as early as possible: expiring an earlier content_id does not affect newer ones. As to what happen to data that would have been processed by an expired trigger, depending if they are processed before or after the expiration is propagated through the AE system, they will see the expired trigger or not.
Note that because expiration done after the fact is done outside of regular content updates and because of caching, it may take a few minutes for the expiration to propagate throughout the AE system.
Request Syntax
response = client.expire_trigger( data='integer' trigger_id='string' )
- Parameters
data (integer) –
trigger_id (string) –
[REQUIRED]
Trigger ID
- Return type
dict
- Returns
Response Syntax
{ 'updated': 'string' }
Response Definitions
updated (string) –
-
get_aefr_audit
(**kwargs)¶ Return the set of active content items at the give timestamp (or at current time if no timestamp given). For each item, metadata is provided (about upload user & upload channel; creation, deletion, expiration times; content id, path & type) as well as the content itself. Providing a data_type parameter narrows the audit to the given data type.
Request Syntax
response = client.get_aefr_audit( data_type='string' ts='string' )
- Parameters
data_type (string) –
Which data type to return in the audit. Choices: ‘filter’, ‘trigger’
Default:
all
ts (string) –
A unix epoch timestamp
Default:
now
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_dlq_replay_status
(**kwargs)¶ Status for the current running request
Returns the status for the current running request.
Supported engines See create a replay request
Request Syntax
response = client.get_dlq_replay_status( engine='aefr_eng_logmsgs'|'aefr_eng_idsmsgs'|'aefr_eng_auditmsgs'|'aefr_eng_observation'|'aefr_eng_telemetry'|'aetrigger_eng' )
- Parameters
engine (string) –
[REQUIRED]
Valid values:
aefr_eng_logmsgs
,aefr_eng_idsmsgs
,aefr_eng_auditmsgs
,aefr_eng_observation
,aefr_eng_telemetry
,aetrigger_eng
- Return type
dict
- Returns
Response Syntax
{ 'count': 'integer', 'finished': 'integer', 'in_progress': 'False|True', 'limit': 'integer', 'started': 'integer' }
Response Definitions
count (integer) –
finished (integer) –
in_progress (boolean) –
limit (integer) –
started (integer) –
-
get_filter_by_id
(**kwargs)¶ Get the filter identified by
filter_id
Request Syntax
response = client.get_filter_by_id( filter_id='string' )
- Parameters
filter_id (string) –
[REQUIRED]
FR ID
- Return type
dict
- Returns
Response Syntax
{ 'expression': {}, 'output': [ 'string' ], 'sql': 'string' }
Response Definitions
expression (dict) –
output (list) –
(string) –
sql (string) –
-
get_filter_by_path
(**kwargs)¶ Returns filter definition for specific customer by path
Request Syntax
response = client.get_filter_by_path( account_id='string' epoch='integer' include_parents='False|True' path='string' ts='integer' )
- Parameters
account_id (string) –
[REQUIRED]
AIMS Account ID
epoch (integer) – A positive integer representing an epoch
include_parents (boolean) –
Return triggers applied to this customer from the parent level
Valid values:
true
,false
Default:
true
path (string) –
[REQUIRED]
Trigger Path
ts (integer) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_filter_expiration
(**kwargs)¶ Return a filter’s expiration timestamp
Request Syntax
response = client.get_filter_expiration( filter_id='string' )
- Parameters
filter_id (string) –
[REQUIRED]
FR ID
- Returns
None
-
get_filters
(**kwargs)¶ Return a map of filters rules. Important: Instead of a 404, this endpoint return an empty JSON document (i.e., {})
Request Syntax
response = client.get_filters( account_id='string' epoch='number' include_parents='False|True' ts='number' )
- Parameters
account_id (string) –
[REQUIRED]
AIMS Account ID
epoch (number) – A positive integer representing an epoch
include_parents (boolean) – Include triggers applied from parent account rules
ts (number) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_filters_by_datatype
(**kwargs)¶ Return a map of filter rules by data type. Important: Instead of a 404, this endpoint return an empty JSON document (i.e., {})
Request Syntax
response = client.get_filters_by_datatype( account_id='string' data_type='logmsgs'|'observation'|'telemetry' epoch='integer' include_parents='False|True' ts='integer' )
- Parameters
account_id (string) –
[REQUIRED]
AIMS Account ID
data_type (string) –
[REQUIRED]
One of the data types supported by ingestion (for example logmsgs, telemetry, etc)
Valid values:
logmsgs
,observation
,telemetry
epoch (integer) – A positive integer representing an epoch
include_parents (boolean) – Include parent account analytics applied to this account as well
ts (integer) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_global_filter_by_path
(**kwargs)¶ Returns filter global definition by path
Request Syntax
response = client.get_global_filter_by_path( epoch='integer' path='string' ts='integer' )
- Parameters
epoch (integer) – A positive integer representing an epoch
path (string) –
[REQUIRED]
Trigger Path
ts (integer) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_global_filters
(**kwargs)¶ Return the list of filters defined at the global level. Important: instead of a 404, this endpoint will return an empty JSON document (i.e., {})
Request Syntax
response = client.get_global_filters( epoch='integer' ts='integer' )
- Parameters
epoch (integer) – A positive integer representing an epoch
ts (integer) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_global_filters_by_data_type
(**kwargs)¶ Return the list of filters defined at the global level by data type. Important: instead of a 404, this endpoint will return an empty JSON document (i.e., {})
Request Syntax
response = client.get_global_filters_by_data_type( data_type='logmsgs'|'observations'|'telemetry' epoch='integer' ts='integer' )
- Parameters
data_type (string) –
[REQUIRED]
One of the data types supported by ingestion (for example logmsgs, telemetry, etc)
Valid values:
logmsgs
,observations
,telemetry
epoch (integer) – A positive integer representing an epoch
ts (integer) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_global_trigger_by_path
(**kwargs)¶ Returns trigger global definition by path
Request Syntax
response = client.get_global_trigger_by_path( epoch='integer' path='string' ts='integer' )
- Parameters
epoch (integer) – A positive integer representing an epoch
path (string) –
[REQUIRED]
Trigger Path
ts (integer) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_global_triggers
(**kwargs)¶ Return a map of trigger rules defined at the global level. Important: Instead of a 404, this endpoint return an empty JSON document (i.e., {})
Request Syntax
response = client.get_global_triggers( epoch='integer' ts='integer' )
- Parameters
epoch (integer) – A positive integer representing an epoch
ts (integer) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_global_triggers_by_data_type
(**kwargs)¶ Return a map of trigger rules defined at the global level by data type. Important: Instead of a 404, this endpoint return an empty JSON document (i.e., {})
Request Syntax
response = client.get_global_triggers_by_data_type( data_type='logmsgs'|'observations'|'telemetry' epoch='integer' ts='integer' )
- Parameters
data_type (string) –
[REQUIRED]
One of the data types supported by ingestion (for example logmsgs, telemetry, etc)’
Valid values:
logmsgs
,observations
,telemetry
epoch (integer) – A positive integer representing an epoch
ts (integer) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_trigger_by_id
(**kwargs)¶ Get the trigger identified by
trigger_id
Request Syntax
response = client.get_trigger_by_id( trigger_id='string' )
- Parameters
trigger_id (string) –
[REQUIRED]
Trigger ID
- Return type
dict
- Returns
Response Syntax
{ 'observation': { 'generate': 'string', 'keys': { 'event': 'string' }, 'properties': { 'ids': 'string' }, 'scope': 'string' }, 'path': 'string', 'sql': 'string' }
Response Definitions
observation (dict) – [REQUIRED]
generate (string) –
keys (dict) –
event (string) –
properties (dict) –
ids (string) –
scope (string) –
path (string) –
sql (string) –
-
get_trigger_by_path
(**kwargs)¶ Returns trigger definition for specific customer by path
Request Syntax
response = client.get_trigger_by_path( account_id='string' epoch='integer' include_parents='False|True' path='string' ts='integer' )
- Parameters
account_id (string) –
[REQUIRED]
AIMS Account ID
epoch (integer) – A positive integer representing an epoch
include_parents (boolean) –
Return triggers applied to this customer from the parent level
Valid values:
true
,false
Default:
true
path (string) –
[REQUIRED]
Trigger Path
ts (integer) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_trigger_expiration
(**kwargs)¶ Return a trigger’s expiration timestamp
Request Syntax
response = client.get_trigger_expiration( trigger_id='string' )
- Parameters
trigger_id (string) –
[REQUIRED]
Trigger ID
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_triggers
(**kwargs)¶ Return a map of trigger rules. Important: Instead of a 404, this endpoint return an empty JSON document (i.e., {})
Request Syntax
response = client.get_triggers( account_id='string' epoch='number' include_parents='False|True' ts='number' )
- Parameters
account_id (string) –
[REQUIRED]
AIMS Account ID
epoch (number) – A positive integer representing an epoch
include_parents (boolean) – Include triggers applied from parent account rules
ts (number) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
get_triggers_by_datatype
(**kwargs)¶ Return a map of trigger rules by data type. Important: Instead of a 404, this endpoint return an empty JSON document (i.e., {})
Request Syntax
response = client.get_triggers_by_datatype( account_id='string' data_type='logmsgs'|'observation'|'telemetry' epoch='integer' include_parents='False|True' ts='integer' )
- Parameters
account_id (string) –
[REQUIRED]
AIMS Account ID
data_type (string) –
[REQUIRED]
One of the data types supported by ingestion (for example logmsgs, telemetry, etc)
Valid values:
logmsgs
,observation
,telemetry
epoch (integer) – A positive integer representing an epoch
include_parents (boolean) – Include parent account analytics applied to this account as well
ts (integer) – A unix epoch timestamp
- Return type
dict
- Returns
Response Syntax
{}
Response Definitions
-
regenerate_firehose_data
(**kwargs)¶ Reprocess rta data to regenerate one or many firehose files. Requires Returns the number of successful and erroneous kinesis posts, and the actual paths, cids, and intervals for which replay requests were submitted to kinesis (successfully or not).
Request Syntax
response = client.regenerate_firehose_data( cids=[ 'string' ] data_type='string' dryrun='False|True' end_ts='integer' path='string' start_ts='integer' stream='string' )
- Parameters
cids (list) –
[REQUIRED]
in body: List of cids to replay (as integers), or the string “all” for all active cids
(string) –
data_type (string) –
[REQUIRED]
One of the data types supported by ingestion (for example logmsgs, telemetry, etc)
dryrun (boolean) – if actual action is simulated
end_ts (integer) –
[REQUIRED]
A unix epoch timestamp
path (string) –
[REQUIRED]
in body: List of paths, or string containing a regex expression filtering paths
start_ts (integer) –
[REQUIRED]
A unix epoch timestamp
stream (string) –
[REQUIRED]
in body: Name of the kinesis stream associated with the firehose.
- Return type
dict
- Returns
Response Syntax
{ 'actual_cids': [ 'integer' ], 'actual_intervals': [ 'integer' ], 'actual_paths': [ 'string' ], 'error_count': 'integer', 'success_count': 'integer' }
Response Definitions
actual_cids (list) –
(integer) –
actual_intervals (list) –
(integer) –
actual_paths (list) –
(string) –
error_count (integer) –
success_count (integer) –
-
request_replay
(**kwargs)¶ TODO
Request Syntax
response = client.request_replay( accounts=[ 'string' ] data_type='logmsgs' end_ts='integer' replay_ts='integer' start_ts='integer' )
- Parameters
accounts (list) –
[REQUIRED]
in body: List of accounts ids to replay (as integers), or the string “all” for all active accounts
(string) –
data_type (string) –
[REQUIRED]
TODO - support other types too
Valid values:
logmsgs
end_ts (integer) – [REQUIRED]
replay_ts (integer) – [REQUIRED]
start_ts (integer) – [REQUIRED]
- Return type
dict
- Returns
Response Syntax
{ 'replay_ts': 'string' }
Response Definitions
replay_ts (string) –
-
validate_filter
(**kwargs)¶ Validate a filter
Request Syntax
response = client.validate_filter( expression='string' format='string' output=[ 'string' ] path='string' )
- Parameters
expression (string) –
format (string) –
output (list) –
(string) –
path (string) –
- Returns
None
-
validate_trigger
(**kwargs)¶ Validate a trigger
Request Syntax
response = client.validate_trigger( expression='string' observation={ 'generate': 'string', 'keys': { 'event': 'string' }, 'properties': { 'ids': 'string' }, 'scope': 'string' } )
- Parameters
expression (string) – [REQUIRED]
observation (dict) –
[REQUIRED]
generate (string) –
keys (dict) –
event (string) –
properties (dict) –
ids (string) –
scope (string) –
- Returns
None