Hello,
How can I get a specific value returned only using API commands in a bash script ?
E.g. I need a rule name and the rule type reurned only.
Assuming the API was developped using object oriented programming, it should be possible to get a specific value returned only instead all the information related to the rule like listed below.
like
access-rule.name
or
access-rule.type
From the API command listed below I'd like to see following only:
access-rule.name = "Stealth Rule"
or
rulebase.type = "access-rule"
or
access-rule.comments = "MY COMMENT"
=========================================================================================
[Expert@MDS2-R80.10:0]# mgmt_cli show access-rule --domain 'Domain1' layer 'Policy1 Network' uid '1ba15eb2-9fef-4042-9a6e-3842b8a9a231'
Username: script
Password:
uid: "1ba15eb2-9fef-4042-9a6e-3842b8a9a231"
name: "Stealth Rule"
type: "access-rule"
domain:
uid: "ad3744cb-55c1-4467-8119-1359dd7ca5f4"
name: "Domain1"
domain-type: "domain"
track:
type:
uid: "598ead32-aa42-4615-90ed-f51a5928d41d"
name: "Log"
type: "Track"
domain:
uid: "a0bbbc99-adef-4ef8-bb6d-defdefdefdef"
name: "Check Point Data"
domain-type: "data domain"
per-session: false
per-connection: true
accounting: false
alert: "none"
layer: "e1c4e6af-1788-4f05-a598-6a995b841948"
source:
- uid: "97aeb369-9aea-11d5-bd16-0090272ccb30"
name: "Any"
type: "CpmiAnyObject"
domain:
uid: "a0bbbc99-adef-4ef8-bb6d-defdefdefdef"
name: "Check Point Data"
domain-type: "data domain"
source-negate: false
destination:
- uid: "97aeb369-9aea-11d5-bd16-0090272ccb30"
name: "Any"
type: "CpmiAnyObject"
domain:
uid: "a0bbbc99-adef-4ef8-bb6d-defdefdefdef"
name: "Check Point Data"
domain-type: "data domain"
destination-negate: false
service:
- uid: "97aeb369-9aea-11d5-bd16-0090272ccb30"
name: "Any"
type: "CpmiAnyObject"
domain:
uid: "a0bbbc99-adef-4ef8-bb6d-defdefdefdef"
name: "Check Point Data"
domain-type: "data domain"
service-negate: false
vpn:
- uid: "97aeb369-9aea-11d5-bd16-0090272ccb30"
name: "Any"
type: "CpmiAnyObject"
domain:
uid: "a0bbbc99-adef-4ef8-bb6d-defdefdefdef"
name: "Check Point Data"
domain-type: "data domain"
action:
uid: "6c488338-8eec-4103-ad21-cd461ac2c473"
name: "Drop"
type: "RulebaseAction"
domain:
uid: "a0bbbc99-adef-4ef8-bb6d-defdefdefdef"
name: "Check Point Data"
domain-type: "data domain"
action-settings: {}
content:
- uid: "97aeb369-9aea-11d5-bd16-0090272ccb30"
name: "Any"
type: "CpmiAnyObject"
domain:
uid: "a0bbbc99-adef-4ef8-bb6d-defdefdefdef"
name: "Check Point Data"
domain-type: "data domain"
content-negate: false
content-direction: "any"
time:
- uid: "97aeb369-9aea-11d5-bd16-0090272ccb30"
name: "Any"
type: "CpmiAnyObject"
domain:
uid: "a0bbbc99-adef-4ef8-bb6d-defdefdefdef"
name: "Check Point Data"
domain-type: "data domain"
custom-fields:
field-1: ""
field-2: ""
field-3: ""
meta-info:
lock: "unlocked"
validation-state: "ok"
last-modify-time:
posix: 1542012857319
iso-8601: "2018-11-12T09:54+0100"
last-modifier: "script"
creation-time:
posix: 1542012857319
iso-8601: "2018-11-12T09:54+0100"
creator: "script"
comments: "MY COMMENT"
enabled: false
install-on:
- uid: "6c488338-8eec-4103-ad21-cd461ac2c476"
name: "Policy Targets"
type: "Global"
domain:
uid: "a0bbbc99-adef-4ef8-bb6d-defdefdefdef"
name: "Check Point Data"
domain-type: "data domain"
...
.....
Thank you for the help .