{
    "Resources": [
        {
            "Uri": "/cli/v1/syslog",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Operate syslog"
                }
            ]
        },
        {
            "Uri": "/cli/v1/syslog/address",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set syslog dest address",
                    "Usage": "ipmcset -t syslog -d address -v <destination> <ipaddr>",
                    "Brief": "destination : The destination index that will be set. The values can be 1, 2, 3 or 4.\nipaddr      : The IP address that will be set. The value \"\" means clearing the address.",
                    "Example": [
                        "ipmcset -t syslog -d address -v 1 192.168.1.1",
                        "ipmcset -t syslog -d address -v 4 \"\""
                    ],
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "Destination": {
                                "Type": "integer",
                                "Validator": [
                                    {
                                        "Type": "Range",
                                        "Formula": [
                                            1,
                                            4
                                        ]
                                    }
                                ],
                                "Required": true
                            },
                            "Address": {
                                "Type": "string",
                                "Required": true
                            }
                        }
                    },
                    "RspBody": {
                        "Destination": "${ReqBody/Destination}"
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/Managers/1/Syslog/Servers/${ReqBody/Destination}",
                            "Interface": "bmc.kepler.Managers.Syslog.Server",
                            "Source": {
                                "Address": "${ReqBody/Address}"
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/syslog_address",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/syslog/port",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set syslog dest port",
                    "Usage": "ipmcset -t syslog -d port -v <destination> <portvalue>",
                    "Brief": "destination : The destination index that will be set. The values can be 1, 2, 3 or 4.\nportvalue   : The port value that will be set. The value can be from 1 to 65535.",
                    "Example": [
                        "ipmcset -t syslog -d port -v 1 1",
                        "ipmcset -t syslog -d port -v 4 65535"
                    ],
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "Destination": {
                                "Type": "integer",
                                "Validator": [
                                    {
                                        "Type": "Range",
                                        "Formula": [
                                            1,
                                            4
                                        ]
                                    }
                                ],
                                "Required": true
                            },
                            "Port": {
                                "Type": "integer",
                                "Required": true,
                                "Validator": [
                                    {
                                        "Type": "Range",
                                        "Formula": [
                                            1,
                                            65535
                                        ]
                                    }
                                ]
                            }
                        }
                    },
                    "RspBody": {
                        "Destination": "${ReqBody/Destination}"
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/Managers/1/Syslog/Servers/${ReqBody/Destination}",
                            "Interface": "bmc.kepler.Managers.Syslog.Server",
                            "Source": {
                                "Port": "${ReqBody/Port}"
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/syslog_port",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/syslog/logtype",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set syslog dest log type",
                    "Usage": "ipmcset -t syslog -d logtype -v <destination> <type>",
                    "Brief": "destination : The destination index that will be set. The values can be 1, 2, 3 or 4.\ntype : contains at least one of the following types : none,all,operationlogs,securitylogs,eventlogs,intrusion_detectionlogs.",
                    "Example": [
                        "ipmcset -t syslog -d logtype -v 1 none",
                        "ipmcset -t syslog -d logtype -v 4 operationlogs eventlogs"
                    ],
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "Destination": {
                                "Type": "integer",
                                "Validator": [
                                    {
                                        "Type": "Range",
                                        "Formula": [
                                            1,
                                            4
                                        ]
                                    }
                                ],
                                "Required": true
                            },
                            "value1": {
                                "Type": "string",
                                "Required": true
                            },
                            "value2": {
                                "Type": "string",
                                "Required": false
                            },
                            "value3": {
                                "Type": "string",
                                "Required": false
                            },
                            "value4": {
                                "Type": "string",
                                "Required": false
                            }
                        }
                    },
                    "RspBody": {
                        "CheckLogType": "${Statements/CheckLogType()}"
                    },
                    "Statements": {
                        "LogType": {
                            "Steps": [
                                {
                                    "Type": "Plugin",
                                    "Formula": "orchestrator.syslog.set_log_type(ReqBody)"
                                }
                            ]
                        },
                        "CheckLogType": {
                            "Steps": [
                                {
                                    "Type": "Plugin",
                                    "Formula": "orchestrator.syslog.check_log_type(ReqBody)"
                                }
                            ]
                        }
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/Managers/1/Syslog/Servers/${ReqBody/Destination}",
                            "Interface": "bmc.kepler.Managers.Syslog.Server",
                            "Source": {
                                "LogType": "${Statements/LogType()}"
                            },
                            "CallIf": {
                                "${Statements/CheckLogType()}": true
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/syslog_logtype",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/syslog/severity",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set syslog severity",
                    "Usage": "ipmcset -t syslog -d severity -v <level>",
                    "Brief": "Level : contains one of the following levels : none,all,normal,minor,major,critical.\n        normal  : send all level message.\n        minor   : send minor and above level message.\n        major   : send major and above level message.\n        critical: send critical level message.",
                    "Example": [
                        "ipmcset -t syslog -d severity -v none",
                        "ipmcset -t syslog -d severity -v normal"
                    ],
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "LowestSeverity": {
                                "Type": "string",
                                "Required": true,
                                "Validator": [
                                    {
                                        "Type": "Enum",
                                        "Formula": [
                                            "critical",
                                            "major",
                                            "minor",
                                            "normal",
                                            "none",
                                            "all"
                                        ]
                                    }
                                ]
                            }
                        }
                    },
                    "Statements": {
                        "Severity": {
                            "Steps": [
                                {
                                    "Type": "Plugin",
                                    "Formula": "orchestrator.syslog.set_severity(ReqBody.LowestSeverity)"
                                }
                            ]
                        }
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/Managers/1/Syslog",
                            "Interface": "bmc.kepler.Managers.Syslog",
                            "Source": {
                                "LowestSeverity": "${Statements/Severity()}"
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/syslog_severity",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/syslog/state",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set syslog enable state",
                    "Usage": "ipmcset -t syslog -d state -v [destination] <disabled|enabled>",
                    "Brief": "To enable or disable the syslog function for a syslog server, you must specifiy the destination parameter. The value range of destination is 1 to 4.\nTo enable or disable the syslog function,leave destination unspecified.",
                    "Example": [
                        "ipmcset -t syslog -d state -v disabled",
                        "ipmcset -t syslog -d state -v enabled",
                        "ipmcset -t syslog -d state -v 1 disabled",
                        "ipmcset -t syslog -d state -v 4 enabled"
                    ],
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "Destination": {
                                "Required": false,
                                "Type": "integer",
                                "Validator": [
                                    {
                                        "Type": "Range",
                                        "Formula": [
                                            1,
                                            4
                                        ]
                                    }
                                ]
                            },
                            "State": {
                                "Required": true,
                                "Type": "string",
                                "Validator": [
                                    {
                                        "Type": "Enum",
                                        "Formula": [
                                            "enabled",
                                            "disabled"
                                        ]
                                    }
                                ]
                            }
                        }
                    },
                    "RspBody": {
                        "Destination": "${Statements/Destination()}",
                        "State": "${ReqBody/State}"
                    },
                    "Statements": {
                        "StateBool": {
                            "Input": "${ReqBody/State}",
                            "Steps": [
                                {
                                    "Type": "Switch",
                                    "Formula": [
                                        {
                                            "Case": "enabled",
                                            "To": true
                                        },
                                        {
                                            "Case": "disabled",
                                            "To": false
                                        }
                                    ]
                                }
                            ]
                        },
                        "Destination": {
                            "Steps": [
                                {
                                    "Type": "Script",
                                    "Formula": "return ReqBody.Destination == nil and '' or ' dest' .. ReqBody.Destination"
                                }
                            ]
                        }
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/Managers/1/Syslog",
                            "Interface": "bmc.kepler.Managers.Syslog",
                            "Source": {
                                "Enabled": "${Statements/StateBool()}"
                            },
                            "CallIf": {
                                "${ReqBody/Destination}": "#WITHOUT"
                            }
                        },
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/Managers/1/Syslog/Servers/${ReqBody/Destination}",
                            "Interface": "bmc.kepler.Managers.Syslog.Server",
                            "Source": {
                                "Enabled": "${Statements/StateBool()}"
                            },
                            "CallIf": {
                                "${ReqBody/Destination}": "#WITH"
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/syslog_state",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/syslog/protocol",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set syslog protocol",
                    "Usage": "ipmcset -t syslog -d protocol -v <option>",
                    "Brief": "Option : The values can be 1, 2 or 3.\n         1 : UDP\n         2 : TCP\n         3 : TLS",
                    "Example": [
                        "ipmcset -t syslog -d protocol -v 1",
                        "ipmcset -t syslog -d protocol -v 3"
                    ],
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "Protocol": {
                                "Type": "integer",
                                "Required": true,
                                "Validator": [
                                    {
                                        "Type": "Enum",
                                        "Formula": [
                                            1,
                                            2,
                                            3
                                        ]
                                    }
                                ]
                            }
                        }
                    },
                    "Statements": {
                        "Protocol": {
                            "Input": "${ReqBody/Protocol}",
                            "Steps": [
                                {
                                    "Type": "Switch",
                                    "Formula": [
                                        {
                                            "Case": 1,
                                            "To": "UDP"
                                        },
                                        {
                                            "Case": 2,
                                            "To": "TCP"
                                        },
                                        {
                                            "Case": 3,
                                            "To": "TLS"
                                        }
                                    ]
                                }
                            ]
                        }
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/Managers/1/Syslog",
                            "Interface": "bmc.kepler.Managers.Syslog",
                            "Source": {
                                "Protocol": "${Statements/Protocol()}"
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/syslog_protocol",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/syslog/auth",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set syslog auth type",
                    "Usage": "ipmcset -t syslog -d auth -v <option>",
                    "Brief": "Option : The values can be 1 or 2.\n          1 : one way authentication\n          2 : mutual authentication",
                    "Example": [
                        "ipmcset -t syslog -d auth -v 1",
                        "ipmcset -t syslog -d auth -v 2"
                    ],
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "Auth": {
                                "Type": "integer",
                                "Required": true,
                                "Validator": [
                                    {
                                        "Type": "Enum",
                                        "Formula": [
                                            1,
                                            2
                                        ]
                                    }
                                ]
                            }
                        }
                    },
                    "Statements": {
                        "AuthenticateMode": {
                            "Input": "${ReqBody/Auth}",
                            "Steps": [
                                {
                                    "Type": "Switch",
                                    "Formula": [
                                        {
                                            "Case": 1,
                                            "To": "OneWay"
                                        },
                                        {
                                            "Case": 2,
                                            "To": "TwoWay"
                                        }
                                    ]
                                }
                            ]
                        }
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/Managers/1/Syslog",
                            "Interface": "bmc.kepler.Managers.Syslog",
                            "Source": {
                                "AuthenticateMode": "${Statements/AuthenticateMode()}"
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/syslog_auth",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/syslog/identity",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set syslog identity",
                    "Usage": "ipmcset -t syslog -d identity -v <option>",
                    "Brief": "Option : The values can be 1, 2 or 3.\n         1 : board serial number\n         2 : product asset tag\n         3 : host name",
                    "Example": [
                        "ipmcset -t syslog -d identity -v 3"
                    ],
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "Identity": {
                                "Type": "integer",
                                "Required": true,
                                "Validator": [
                                    {
                                        "Type": "Enum",
                                        "Formula": [
                                            1,
                                            2,
                                            3
                                        ]
                                    }
                                ]
                            }
                        }
                    },
                    "RspBody": {
                        "CheckMessageFormat": "${Statements/CheckMessageFormat()}"
                    },
                    "Statements": {
                        "ServerIdentitySource": {
                            "Input": "${ReqBody/Identity}",
                            "Steps": [
                                {
                                    "Type": "Switch",
                                    "Formula": [
                                        {
                                            "Case": 1,
                                            "To": "BoardSN"
                                        },
                                        {
                                            "Case": 2,
                                            "To": "ProductAssetTag"
                                        },
                                        {
                                            "Case": 3,
                                            "To": "HostName"
                                        }
                                    ]
                                }
                            ]
                        },
                        "CheckMessageFormat": {
                            "Steps": [
                                {
                                    "Type": "Plugin",
                                    "Formula": "orchestrator.syslog.check_message_format(ProcessingFlow[1].Destination.MessageFormat)"
                                }
                            ]
                        }
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/Managers/1/Syslog",
                            "Interface": "bmc.kepler.Managers.Syslog",
                            "Destination": {
                                "MessageFormat": "MessageFormat"
                            }
                        },
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/Managers/1/Syslog",
                            "Interface": "bmc.kepler.Managers.Syslog",
                            "Source": {
                                "ServerIdentitySource": "${Statements/ServerIdentitySource()}"
                            },
                            "CallIf": {
                                "${Statements/CheckMessageFormat()}": true
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/syslog_identity",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/syslog/test",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Test syslog dest send",
                    "Usage": "ipmcset -t syslog -d test -v <destination>",
                    "Brief": "destination : The destination index that will be set. The values can be 1, 2, 3 or 4.",
                    "Example": [
                        "ipmcset -t syslog -d test -v 1",
                        "ipmcset -t syslog -d test -v 4"
                    ],
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "Id": {
                                "Type": "integer",
                                "Required": true,
                                "Validator": [
                                    {
                                        "Type": "Enum",
                                        "Formula": [
                                            1,
                                            2,
                                            3,
                                            4
                                        ]
                                    }
                                ]
                            }
                        }
                    },
                    "RspBody": {
                        "Id": "${ReqBody/Id}"
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Method",
                            "Path": "/bmc/kepler/Managers/1/Syslog/Servers",
                            "Interface": "bmc.kepler.Managers.Syslog.Servers",
                            "Name": "SubmitTestEvent",
                            "Params": [
                                "${ReqBody/Id}"
                            ]
                        }
                    ],
                    "Echoes": [
                        "ipmcset/syslog_test",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/syslog/rootcertificate",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "import syslog rootcertificate",
                    "Usage": "ipmcset -t syslog -d rootcertificate -v <filepath>",
                    "Example": [
                        "ipmcset -t syslog -d rootcertificate -v /tmp/rootcertificate.cer"
                    ],
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "path": {
                                "Type": "string",
                                "Validator": [
                                    {
                                        "Type": "Regex",
                                        "Formula": "^(/tmp/.{1,255})$"
                                    }
                                ],
                                "Required": true,
                                "Sensitive": true
                            }
                        }
                    },
                    "RspBody": {
                        "ValidateResult": "${Statements/GetValidateResult()}"
                    },
                    "Statements": {
                        "IsImportActionPermitted": {
                            "Steps": [
                                {
                                    "Type": "Plugin",
                                    "Formula": "orchestrator.utils.is_import_permitted('URI', ReqBody.path, 'cert', 'path', ProcessingFlow[1].Destination.Result)"
                                }
                            ]
                        },
                        "GetValidateResult": {
                            "Input": "${ProcessingFlow[2]/Destination/Extra}",
                            "Steps": [
                                {
                                    "Type": "Script",
                                    "Formula": "return tonumber(Input.ValidateResult)"
                                }
                            ]
                        }
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Method",
                            "Path": "/bmc/kepler/Managers/1/Security/File",
                            "Interface": "bmc.kepler.Managers.Security.File",
                            "Name": "IsPermitted",
                            "Params": [
                                "${ReqBody/path}",
                                "rw"
                            ],
                            "Destination": {
                                "Result": "Result"
                            }
                        },
                        {
                            "Type": "Method",
                            "Path": "/bmc/kepler/CertificateService",
                            "Interface": "bmc.kepler.CertificateService",
                            "Name": "ImportCertificate",
                            "Params": [
                                0,
                                "URI",
                                "${ReqBody/path}",
                                0,
                                false,
                                "",
                                {}
                            ],
                            "Destination": {
                                "Extra": "Extra"
                            },
                            "CallIf": {
                                "${Statements/IsImportActionPermitted()}": true
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/syslog_rootcertificate",
                        ""
                    ]
                }
            ]
        }
    ]
}