text: /* ------------------------------------------------------------------------- *
   * Copyright 2002-2021, OpenNebula Project, OpenNebula Systems               *
   *                                                                           *
   * Licensed under the Apache License, Version 2.0 (the "License"); you may   *
   * not use this file except in compliance with the License. You may obtain   *
   * a copy of the License at                                                  *
   *                                                                           *
   * http://www.apache.org/licenses/LICENSE-2.0                                *
   *                                                                           *
   * Unless required by applicable law or agreed to in writing, software       *
   * distributed under the License is distributed on an "AS IS" BASIS,         *
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
   * See the License for the specific language governing permissions and       *
   * limitations under the License.                                            *
   * ------------------------------------------------------------------------- */
  
  const {
    from: { resource, postBody, query },
    httpMethod: { GET, POST, PUT, DELETE }
  } = require('../defaults')
  
  const SECGROUP_ALLOCATE = 'secgroup.allocate'
  const SECGROUP_CLONE = 'secgroup.clone'
  const SECGROUP_DELETE = 'secgroup.delete'
  const SECGROUP_UPDATE = 'secgroup.update'
  const SECGROUP_COMMIT = 'secgroup.commit'
  const SECGROUP_CHMOD = 'secgroup.chmod'
  const SECGROUP_CHOWN = 'secgroup.chown'
  const SECGROUP_RENAME = 'secgroup.rename'
  const SECGROUP_INFO = 'secgroup.info'
  const SECGROUP_POOL_INFO = 'secgrouppool.info'
  
  const Actions = {
    SECGROUP_ALLOCATE,
    SECGROUP_CLONE,
    SECGROUP_DELETE,
    SECGROUP_UPDATE,
    SECGROUP_COMMIT,
    SECGROUP_CHMOD,
    SECGROUP_CHOWN,
    SECGROUP_RENAME,
    SECGROUP_INFO,
    SECGROUP_POOL_INFO
  }
  
  module.exports = {
    Actions,
    Commands: {
      [SECGROUP_ALLOCATE]: {
        // inspected
        httpMethod: POST,
        params: {
          template: {
            from: postBody,
            default: ''
          }
        }
      },
      [SECGROUP_CLONE]: {
        // inspected
        httpMethod: POST,
        params: {
          id: {
            from: resource,
            default: 0
          },
          name: {
            from: postBody,
            default: ''
          }
        }
      },
      [SECGROUP_DELETE]: {
        // inspected
        httpMethod: DELETE,
        params: {
          id: {
            from: resource,
            default: 0
          }
        }
      },
      [SECGROUP_UPDATE]: {
        // inspected
        httpMethod: PUT,
        params: {
          id: {
            from: resource,
            default: 0
          },
          template: {
            from: postBody,
            default: ''
          },
          replace: {
            from: postBody,
            default: 0
          }
        }
      },
      [SECGROUP_COMMIT]: {
        // inspected
        httpMethod: PUT,
        params: {
          id: {
            from: resource,
            default: 0
          },
          vms: {
            from: postBody,
            default: false
          }
        }
      },
      [SECGROUP_CHMOD]: {
        // inspected
        httpMethod: PUT,
        params: {
          id: {
            from: resource,
            default: 0
          },
          ownerUse: {
            from: postBody,
            default: -1
          },
          ownerManage: {
            from: postBody,
            default: -1
          },
          ownerAdmin: {
            from: postBody,
            default: -1
          },
          groupUse: {
            from: postBody,
            default: -1
          },
          groupManage: {
            from: postBody,
            default: -1
          },
          groupAdmin: {
            from: postBody,
            default: -1
          },
          otherUse: {
            from: postBody,
            default: -1
          },
          otherManage: {
            from: postBody,
            default: -1
          },
          otherAdmin: {
            from: postBody,
            default: -1
          }
        }
      },
      [SECGROUP_CHOWN]: {
        // inspected
        httpMethod: PUT,
        params: {
          id: {
            from: resource,
            default: 0
          },
          user: {
            from: postBody,
            default: -1
          },
          group: {
            from: postBody,
            default: -1
          }
        }
      },
      [SECGROUP_RENAME]: {
        // inspected
        httpMethod: PUT,
        params: {
          id: {
            from: resource,
            default: 0
          },
          name: {
            from: postBody,
            default: ''
          }
        }
      },
      [SECGROUP_INFO]: {
        // inspected
        httpMethod: GET,
        params: {
          id: {
            from: resource,
            default: 0
          },
          decrypt: {
            from: query,
            default: false
          }
        }
      },
      [SECGROUP_POOL_INFO]: {
        // inspected
        httpMethod: GET,
        params: {
          filter: {
            from: query,
            default: -3
          },
          start: {
            from: query,
            default: -1
          },
          end: {
            from: query,
            default: -1
          }
        }
      }
    }
  }
  