{
    "Resources": [
        {
            "Uri": "/cli/v1/vnc",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Operate vnc"
                }
            ]
        },
        {
            "Uri": "/cli/v1/vnc/keyboardlayout",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set VNC keyboard layout",
                    "Usage": "ipmcset -t vnc -d keyboardlayout -v <en|jp|de>",
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "keyboardlayout": {
                                "Type": "string",
                                "Required": true,
                                "Validator": [
                                    {
                                        "Type": "Enum",
                                        "Formula": [
                                            "en",
                                            "jp",
                                            "de"
                                        ]
                                    }
                                ]
                            }
                        }
                    },
                    "RspBody": {
                        "keyboardlayout": "${ReqBody/keyboardlayout}"
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Method",
                            "Path": "/bmc/kepler/Managers/1/VncService",
                            "Interface": "bmc.kepler.Managers.VncService",
                            "Name": "SetKeyboardLayout",
                            "Params": [
                                "${ReqBody/keyboardlayout}"
                            ]
                        }
                    ],
                    "Echoes": [
                        "ipmcset/vnc_keyboardlayout",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/vnc/ssl",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set VNC ssl encryption",
                    "Usage": "ipmcset -t vnc -d ssl -v <enabled|disabled>",
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "state": {
                                "Type": "string",
                                "Required": true,
                                "Validator": [
                                    {
                                        "Type": "Enum",
                                        "Formula": [
                                            "enabled",
                                            "disabled"
                                        ]
                                    }
                                ]
                            }
                        }
                    },
                    "RspBody": {
                        "state": "${ReqBody/state}"
                    },
                    "Statements": {
                        "GetState": {
                            "Input": "${ReqBody/state}",
                            "Steps": [
                                {
                                    "Type": "Switch",
                                    "Formula": [
                                        {
                                            "Case": "enabled",
                                            "To": true
                                        },
                                        {
                                            "Case": "disabled",
                                            "To": false
                                        }
                                    ]
                                }
                            ]
                        }
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Method",
                            "Path": "/bmc/kepler/Managers/1/VncService",
                            "Interface": "bmc.kepler.Managers.VncService",
                            "Name": "SetSSLEncryptionEnabled",
                            "Params": [
                                "${Statements/GetState()}"
                            ]
                        }
                    ],
                    "Echoes": [
                        "ipmcset/vnc_ssl",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/vnc/timeout",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set VNC timeout period(min)",
                    "Usage": "ipmcset -t vnc -d timeout -v <value>",
                    "ReqBody": {
                        "Type": "object",
                        "Required": true,
                        "Properties": {
                            "value": {
                                "Type": "integer",
                                "Required": true,
                                "Validator": [
                                    {
                                        "Type": "Range",
                                        "Formula": [
                                            0,
                                            480
                                        ]
                                    }
                                ],
                                "Description": "\n    0       No limit\n    1-480   VNC timeout period(min)"
                            }
                        }
                    },
                    "Statements": {
                        "Value": {
                            "Steps": [
                                {
                                    "Type": "Script",
                                    "Formula": "return ReqBody.value * 60"
                                }
                            ]
                        }
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Property",
                            "Path": "/bmc/kepler/SessionService/VNC",
                            "Interface": "bmc.kepler.SessionService",
                            "Source": {
                                "SessionTimeout": "${Statements/Value()}"
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/vnc_timeout",
                        ""
                    ]
                }
            ]
        },
        {
            "Uri": "/cli/v1/vnc/password",
            "Interfaces": [
                {
                    "Type": "Patch",
                    "Description": "Set VNC password",
                    "Usage": "ipmcset -t vnc -d password",
                    "Authentication": {
                        "Description": "Input your password:",
                        "Condition": true
                    },
                    "RspBody": {
                        "PwdValid": "${Statements/GetPwd()}"
                    },
                    "Statements": {
                        "GetPwd": {
                            "Steps": [
                                {
                                    "Type": "Plugin",
                                    "Formula": "orchestrator.vnc.get_pwd()"
                                }
                            ]
                        }
                    },
                    "ProcessingFlow": [
                        {
                            "Type": "Method",
                            "Path": "/bmc/kepler/AccountService/Accounts/18",
                            "Interface": "bmc.kepler.AccountService.ManagerAccount",
                            "Name": "ChangePwd",
                            "Params": [
                                "${Statements/GetPwd()[2]}"
                            ],
                            "CallIf": {
                                "${Statements/GetPwd()[1]}": 0
                            }
                        }
                    ],
                    "Echoes": [
                        "ipmcset/vnc_password"
                    ]
                }
            ]
        }
    ]
}