Skip to content

Commit dff5844

Browse files
author
cibot
committed
Definitions Update assets_query
1 parent 70e1ae4 commit dff5844

File tree

2 files changed

+38
-12
lines changed

2 files changed

+38
-12
lines changed

alsdkdefs/apis/assets_query/assets_query.v1.yaml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,19 @@ info:
104104
Assets supports queries with filters more complex than equality. The operator (special
105105
character(s)) is placed immediately after the equals sign in the query string parameter.
106106
107-
| Operation | Character(s) | Format | Example |
108-
|-----------------------|--------------|----------------------|------------------------------|
109-
| Greater than | `>` | String or number | `x.y=>5`, `x.y=>Gryffindor` |
110-
| Less than | `<` | String or number | `x.y=<5`, `x.y=<Slytherin` |
111-
| Not equal | `!` | Scalar | `x.name=!Draco` |
112-
| Is not | `!!` | Scalar | `x.name=!!Draco` |
113-
| Is null | `$null` | None | `x.name=$null` |
114-
| Is one of | `@` or `<<` | Comma separated list | `x.name=@Harry,Ron,Hermione` |
115-
| List contains | `>>` | Scalar | `x.parents=>>Lilly` |
116-
| List does not contain | `!>>` | Scalar | `x.parents=!>>Lilly` |
117-
| String contains | `%` | String | `x.name=%Percival` |
118-
| Regex Match | `~` | String | `x.name=~neighbou?r` |
107+
| Operation | Character(s) | Format | Example |
108+
|-----------------------|----------------|----------------------|----------------------------------|
109+
| Greater than | `>` | String or number | `x.y=>5`, `x.y=>Gryffindor` |
110+
| Less than | `<` | String or number | `x.y=<5`, `x.y=<Slytherin` |
111+
| Not equal | `!` | Scalar | `x.name=!Draco` |
112+
| Is not | `!!` | Scalar | `x.name=!!Draco` |
113+
| Is null | `$null` | None | `x.name=$null` |
114+
| Is one of | `@` or `<<` | Comma separated list | `x.name=@Harry,Ron,Hermione` |
115+
| List contains | `>>` | Scalar | `x.parents=>>Lilly` |
116+
| List does not contain | `!>>` | Scalar | `x.parents=!>>Lilly` |
117+
| String contains | `%` | String | `x.name=%Percival` |
118+
| Regex Match | `~` | String | `x.name=~neighbou?r` |
119+
| CIDR IP matching | `:cidr_match:` | String | `x.ip=:cidr_match:192.168.0.0/16`|
119120
120121
There is no way to escape these special characters.
121122
@@ -325,6 +326,11 @@ paths:
325326
source: |-
326327
curl "https://api.cloudinsight.alertlogic.com/assets_query/v1/12345678/assets?asset_types=r:region&r..vpc=false" \
327328
-H "x-aims-auth-token: $TOKEN" -H "accept: application/json"
329+
- lang: Shell
330+
label: Get account hosts that private IP address match given CIDR block
331+
source: |-
332+
curl "https://api.cloudinsight.alertlogic.com/assets_query/v1/12345678/assets?asset_types=h:host&h.private_ip_addresses=:cidr_match:192.168.0.0/16" \
333+
-H "x-aims-auth-token: $TOKEN" -H "accept: application/json"
328334
responses:
329335
"200":
330336
description: OK
@@ -347,6 +353,8 @@ paths:
347353
$ref: 'examples.yaml#/QueryAssetsAssetTypesVPCSubnetHostInRegionExample'
348354
asset_types=region & not related to a vpc:
349355
$ref: 'examples.yaml#/QueryAssetsAssetTypesRegionNotRelatedToAVpcExample'
356+
asset_types=host & ip_addresses match CIDR 192.168.0.0/16:
357+
$ref: 'examples.yaml#/QueryAssetsAssetTypesHostCIDRMatchExample'
350358
topo_chain=false:
351359
$ref: 'examples.yaml#/QueryAssetsTopoChainFalseExample'
352360
"400":
@@ -419,6 +427,11 @@ paths:
419427
source: |-
420428
curl "https://api.cloudinsight.alertlogic.com/assets_query/v1/12345678/deployments/844581E6-4018-4DA8-8CF9-0D7C49EF171B/assets?asset_types=r:region&r..vpc=false" \
421429
-H "x-aims-auth-token: $TOKEN" -H "accept: application/json"
430+
- lang: Shell
431+
label: Get account hosts that private IP address match given CIDR block
432+
source: |-
433+
curl "https://api.cloudinsight.alertlogic.com/assets_query/v1/12345678/deployments/844581E6-4018-4DA8-8CF9-0D7C49EF171B/assets?asset_types=h:host&h.private_ip_addresses=:cidr_match:192.168.0.0/16" \
434+
-H "x-aims-auth-token: $TOKEN" -H "accept: application/json"
422435
responses:
423436
"200":
424437
description: OK
@@ -441,6 +454,8 @@ paths:
441454
$ref: 'examples.yaml#/QueryAssetsAssetTypesVPCSubnetHostInRegionExample'
442455
asset_types=region & not related to a vpc:
443456
$ref: 'examples.yaml#/QueryAssetsAssetTypesRegionNotRelatedToAVpcExample'
457+
asset_types=host & ip_addresses match CIDR 192.168.0.0/16:
458+
$ref: 'examples.yaml#/QueryAssetsAssetTypesHostCIDRMatchExample'
444459
topo_chain=false:
445460
$ref: 'examples.yaml#/QueryAssetsTopoChainFalseExample'
446461
"400":

alsdkdefs/apis/assets_query/examples.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,17 @@ QueryAssetsAssetTypesRegionNotRelatedToAVpcExample:
271271
created_on: 1573565512189
272272
account_id: '12345678'
273273
rows: 1
274+
QueryAssetsAssetTypesHostCIDRMatchExample:
275+
value:
276+
assets:
277+
- - deployment_id: 1C0EFEC8-7DBE-480D-A025-ECC13DE30AD5
278+
type: host
279+
key: "/aws/us-east-1/host/i-1234abcd1234abcd"
280+
account_id: '12345678'
281+
declared: true
282+
private_ip_addresses:
283+
- 192.168.1.1
284+
rows: 1
274285
QueryAssetsTopoChainFalseExample:
275286
value:
276287
assets:

0 commit comments

Comments
 (0)