+
openMenu(!isOpenMenu)}
edge="start"
- className=""
color="inherit"
- aria-label="menu"
>
{title}
@@ -57,7 +54,6 @@ const Header = ({ title }) => {
- {isLoading && }
);
};
diff --git a/src/fireedge/src/public/components/Header/styles.js b/src/fireedge/src/public/components/Header/styles.js
new file mode 100644
index 0000000000..53908492f2
--- /dev/null
+++ b/src/fireedge/src/public/components/Header/styles.js
@@ -0,0 +1,8 @@
+import { makeStyles } from '@material-ui/core';
+
+export default makeStyles(theme => ({
+ title: {
+ flexGrow: 1,
+ textTransform: 'capitalize'
+ }
+}));
diff --git a/src/fireedge/src/public/components/Sidebar/index.js b/src/fireedge/src/public/components/Sidebar/index.js
index e6539052e8..437b5c3ffb 100644
--- a/src/fireedge/src/public/components/Sidebar/index.js
+++ b/src/fireedge/src/public/components/Sidebar/index.js
@@ -14,102 +14,94 @@
/* -------------------------------------------------------------------------- */
import React, { useState } from 'react';
+import { useHistory } from 'react-router-dom';
+
import {
Grid,
List,
+ Drawer,
+ Divider,
+ Collapse,
ListItem,
- ListItemText,
- ExpansionPanel,
- ExpansionPanelSummary,
- ExpansionPanelDetails,
- Divider
+ ListItemText
} from '@material-ui/core';
-import classnames from 'classnames';
-import { Link } from 'react-router-dom';
+import ExpandLessIcon from '@material-ui/icons/ExpandLess';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
+
+import sidebarStyles from 'client/components/Sidebar/styles';
+import useGeneral from 'client/hooks/useGeneral';
import endpoints from 'client/router/endpoints';
-const Sidebar = () => {
- const [expanded, setExpanded] = useState('');
-
- const handleChange = panel => (event, newExpanded) => {
- setExpanded(newExpanded ? panel : false);
- };
-
- const routeElement = (title = '', { path = '/', menu = true }) =>
- menu && (
-
-
- {title.replace('_', ' ')}
-
- }
- />
-
- );
-
- const routeElements = (title = '', routes = {}) => {
- const internal = Object.entries(routes)?.map(
- ([internalTitle, internalRoutes]) =>
- internalRoutes.component && routeElement(internalTitle, internalRoutes)
- );
-
- return (
- internal.some(components => components !== undefined) && (
-
- }
- className={classnames('link')}
- >
- {title.replace('_', ' ')}
-
-
-
- {internal}
-
-
-
- )
- );
- };
+const LinkItem = React.memo(({ label, path }) => {
+ const history = useHistory();
return (
-
-
-
-
-
-
-
-
- {Object.entries(endpoints)?.map(([title, routes]) =>
- routes.component
- ? routeElement(title, routes)
- : routeElements(title, routes)
- )}
-
-
+ history.push(path)}>
+
+
+ );
+});
+
+const CollapseItem = React.memo(({ label, routes }) => {
+ const [expanded, setExpanded] = useState(false);
+
+ const handleExpand = () => setExpanded(!expanded);
+
+ return (
+ <>
+
+
+ {expanded ? : }
+
+ {routes?.map((subItem, index) => (
+
+
+
+
+
+ ))}
+ >
+ );
+});
+
+const Sidebar = () => {
+ const classes = sidebarStyles();
+ const { isOpenMenu, openMenu } = useGeneral();
+
+ return React.useMemo(
+ () => (
+ openMenu(false)}>
+
+
+
+
+
+
+
+
+ {endpoints
+ ?.filter(({ authenticated = true }) => authenticated)
+ ?.map((endpoint, index) =>
+ endpoint.routes ? (
+
+ ) : (
+
+ )
+ )}
+
+
+
+ ),
+ [isOpenMenu, openMenu]
);
};
diff --git a/src/fireedge/src/public/components/Sidebar/styles.js b/src/fireedge/src/public/components/Sidebar/styles.js
new file mode 100644
index 0000000000..d464b67d1f
--- /dev/null
+++ b/src/fireedge/src/public/components/Sidebar/styles.js
@@ -0,0 +1,22 @@
+import { makeStyles } from '@material-ui/core';
+
+export default makeStyles(theme => ({
+ menu: {
+ width: '15rem',
+ textTransform: 'capitalize',
+ color: theme.palette.secondary.dark
+ },
+ logoWrapper: {
+ padding: '1rem 2rem'
+ },
+ logo: {
+ width: '100%'
+ },
+ nav: {
+ paddingtop: 0,
+ paddingBottom: 0
+ },
+ subitem: {
+ paddingLeft: theme.spacing(4)
+ }
+}));
diff --git a/src/fireedge/src/public/constants/index.js b/src/fireedge/src/public/constants/index.js
index 988b558ef6..7d999bd0fe 100644
--- a/src/fireedge/src/public/constants/index.js
+++ b/src/fireedge/src/public/constants/index.js
@@ -34,5 +34,12 @@ module.exports = {
endpointsRoutes: {
login: '/api/auth/',
userInfo: '/api/user/info'
+ },
+ ONEADMIN_ID: '0',
+ FILTER_POOL: {
+ PRIMARY_GROUP_RESOURCES: '-4',
+ USER_RESOURCES: '-3',
+ ALL_RESOURCES: '-2',
+ USER_GROUPS_RESOURCES: '-1'
}
-};
\ No newline at end of file
+};
diff --git a/src/fireedge/src/public/containers/Login/Form2fa.js b/src/fireedge/src/public/containers/Login/Form2fa.js
new file mode 100644
index 0000000000..7d2579ae65
--- /dev/null
+++ b/src/fireedge/src/public/containers/Login/Form2fa.js
@@ -0,0 +1,60 @@
+import React from 'react';
+
+import { Box, Button, TextField } from '@material-ui/core';
+import { useForm } from 'react-hook-form';
+import { yupResolver } from '@hookform/resolvers';
+import * as yup from 'yup';
+
+import { Token2FA } from 'client/constants';
+import { Tr } from 'client/components/HOC';
+import ButtonSubmit from 'client/components/FormControl/SubmitButton';
+import ErrorHelper from 'client/components/FormControl/ErrorHelper';
+
+const Form2fa = ({ classes, onBack, onSubmit, error }) => {
+ const { register, handleSubmit, errors } = useForm({
+ reValidateMode: 'onSubmit',
+ resolver: yupResolver(
+ yup.object().shape({
+ token: yup.string().required('Authenticator is a required field')
+ })
+ )
+ });
+
+ const tokenError = Boolean(errors.token || error);
+
+ return (
+
+
+ }
+ FormHelperTextProps={{ 'data-cy': 'login-username-error' }}
+ />
+
+
+ Back
+
+
+
+
+ );
+};
+
+export default Form2fa;
diff --git a/src/fireedge/src/public/containers/Login/FormGroup.js b/src/fireedge/src/public/containers/Login/FormGroup.js
new file mode 100644
index 0000000000..bf453d397f
--- /dev/null
+++ b/src/fireedge/src/public/containers/Login/FormGroup.js
@@ -0,0 +1,47 @@
+/* Copyright 2002-2019, 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. */
+/* -------------------------------------------------------------------------- */
+
+import React from 'react';
+import { Box, Button } from '@material-ui/core';
+import { useForm, Controller } from 'react-hook-form';
+
+import GroupSelect from 'client/components/FormControl/GroupSelect';
+import ButtonSubmit from 'client/components/FormControl/SubmitButton';
+
+function FormGroup({ classes, onBack, onSubmit }) {
+ const { control, handleSubmit } = useForm();
+
+ return (
+
+ } control={control} name="group" />
+ Logout
+
+
+ );
+}
+
+FormGroup.propTypes = {};
+
+FormGroup.defaultProps = {};
+
+export default FormGroup;
diff --git a/src/fireedge/src/public/containers/Login/FormUser.js b/src/fireedge/src/public/containers/Login/FormUser.js
new file mode 100644
index 0000000000..c2b184b184
--- /dev/null
+++ b/src/fireedge/src/public/containers/Login/FormUser.js
@@ -0,0 +1,102 @@
+/* Copyright 2002-2019, 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. */
+/* -------------------------------------------------------------------------- */
+
+import React from 'react';
+import { Box, Checkbox, TextField, FormControlLabel } from '@material-ui/core';
+import { useForm } from 'react-hook-form';
+import { yupResolver } from '@hookform/resolvers';
+import * as yup from 'yup';
+
+import { SignIn, Username, Password, keepLoggedIn } from 'client/constants';
+import { Translate, Tr } from 'client/components/HOC';
+import ButtonSubmit from 'client/components/FormControl/SubmitButton';
+import ErrorHelper from 'client/components/FormControl/ErrorHelper';
+
+function FormUser({ classes, onSubmit, error }) {
+ const { register, handleSubmit, errors } = useForm({
+ reValidateMode: 'onSubmit',
+ resolver: yupResolver(
+ yup.object().shape({
+ user: yup.string().required('Username is a required field'),
+ pass: yup.string().required('Password is a required field'),
+ remember: yup.boolean()
+ })
+ )
+ });
+
+ const userError = Boolean(errors.user || error);
+ const passError = Boolean(errors.pass);
+
+ return (
+
+
+ }
+ FormHelperTextProps={{ 'data-cy': 'login-username-error' }}
+ />
+ }
+ FormHelperTextProps={{ 'data-cy': 'login-password-error' }}
+ />
+
+ }
+ label={Tr(keepLoggedIn)}
+ labelPlacement="end"
+ />
+ }
+ />
+
+ );
+}
+
+FormUser.propTypes = {};
+
+FormUser.defaultProps = {};
+
+export default FormUser;
diff --git a/src/fireedge/src/public/containers/Login/Login.js b/src/fireedge/src/public/containers/Login/Login.js
deleted file mode 100644
index 1ae64b3536..0000000000
--- a/src/fireedge/src/public/containers/Login/Login.js
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Copyright 2002-2019, 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. */
-/* -------------------------------------------------------------------------- */
-
-import React from 'react';
-import {
- Box,
- Paper,
- Checkbox,
- Container,
- TextField,
- FormControlLabel
-} from '@material-ui/core';
-import { useForm } from 'react-hook-form';
-import { yupResolver } from '@hookform/resolvers';
-import * as yup from 'yup';
-
-import { SignIn, Username, Password, keepLoggedIn } from 'client/constants';
-import { Translate, Tr } from 'client/components/HOC';
-import ButtonSubmit from 'client/components/FormControl/SubmitButton';
-import ErrorHelper from 'client/components/FormControl/ErrorHelper';
-import useAuth from 'client/hooks/auth/useAuth';
-
-import loginStyles from './styles';
-
-function Login() {
- const classes = loginStyles();
- const { isLoading, login, error } = useAuth();
-
- const { register, handleSubmit, errors } = useForm({
- reValidateMode: 'onSubmit',
- resolver: yupResolver(
- yup.object().shape({
- user: yup.string().required('Username is a required field'),
- pass: yup.string().required('Password is a required field'),
- remember: yup.boolean()
- })
- )
- });
-
- const onSubmit = dataForm => {
- const { remember, ...user } = dataForm;
- login(user, remember);
- };
-
- const userError = Boolean(errors.user || error);
- const passError = Boolean(errors.pass);
-
- return (
-
-
-
-
-
- }
- FormHelperTextProps={{ 'data-cy': 'login-username-error' }}
- />
-
- }
- FormHelperTextProps={{ 'data-cy': 'login-password-error' }}
- />
-
- }
- label={Tr(keepLoggedIn)}
- labelPlacement="end"
- />
- }
- />
-
-
-
- );
-}
-
-Login.propTypes = {};
-
-Login.defaultProps = {};
-
-export default Login;
diff --git a/src/fireedge/src/public/containers/Login/index.js b/src/fireedge/src/public/containers/Login/index.js
index cd0211325d..68fabf69c9 100644
--- a/src/fireedge/src/public/containers/Login/index.js
+++ b/src/fireedge/src/public/containers/Login/index.js
@@ -13,8 +13,128 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-import Login from './Login';
+import React, { useState } from 'react';
+import {
+ Paper,
+ Box,
+ Container,
+ Slide,
+ LinearProgress
+} from '@material-ui/core';
-export {
- Login
+import useAuth from 'client/hooks/useAuth';
+import useOpennebula from 'client/hooks/useOpennebula';
+
+import FormUser from 'client/containers/Login/FormUser';
+import Form2fa from 'client/containers/Login/Form2fa';
+import FormGroup from 'client/containers/Login/FormGroup';
+import loginStyles from 'client/containers/Login/styles';
+
+const STEP = {
+ USER_FORM: 0,
+ FA2_FORM: 1,
+ GROUP_FORM: 2
};
+
+function Login() {
+ const classes = loginStyles();
+ const [user, setUser] = useState(undefined);
+ const [step, setStep] = useState(STEP.USER_FORM);
+ const {
+ isLoading,
+ error,
+ login,
+ logout,
+ getAuthInfo,
+ setPrimaryGroup
+ } = useAuth();
+ const { groups } = useOpennebula();
+
+ const handleSubmitUser = dataForm => {
+ login({ ...user, ...dataForm }).then(data => {
+ if (data?.token) {
+ getAuthInfo().then(() => setStep(STEP.GROUP_FORM));
+ } else {
+ setStep(data ? STEP.FA2_FORM : step);
+ setUser(data ? dataForm : user);
+ }
+ });
+ };
+
+ const handleSubmitGroup = dataForm => setPrimaryGroup(dataForm);
+
+ const handleBack = () => {
+ logout();
+ setUser(undefined);
+ setStep(STEP.USER_FORM);
+ };
+
+ return (
+
+ {isLoading && }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+Login.propTypes = {};
+
+Login.defaultProps = {};
+
+export default Login;
diff --git a/src/fireedge/src/public/containers/Login/styles.js b/src/fireedge/src/public/containers/Login/styles.js
index 0f57ab619f..31accca346 100644
--- a/src/fireedge/src/public/containers/Login/styles.js
+++ b/src/fireedge/src/public/containers/Login/styles.js
@@ -13,17 +13,21 @@ export default makeStyles(theme => {
justifyContent: 'center'
},
paper: {
- padding: theme.spacing(3)
+ overflow: 'hidden',
+ padding: theme.spacing(3),
+ height: 400
+ },
+ logo: {
+ display: 'block',
+ width: '50%',
+ margin: '0 auto',
+ paddingBottom: theme.spacing(3)
},
form: {
display: 'flex',
flexDirection: 'column',
justifyContent: 'center'
},
- logo: {
- width: '50%',
- margin: '1.5rem auto'
- },
helper: {
animation: '1s ease-out 0s 1'
}
diff --git a/src/fireedge/src/public/scss/header.scss b/src/fireedge/src/public/containers/System/Groups.js
similarity index 81%
rename from src/fireedge/src/public/scss/header.scss
rename to src/fireedge/src/public/containers/System/Groups.js
index cc2b0fb424..e9bdb7eddf 100644
--- a/src/fireedge/src/public/scss/header.scss
+++ b/src/fireedge/src/public/containers/System/Groups.js
@@ -13,10 +13,24 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-.header{
- border-bottom: 2px solid $primary;
- background-color: $secondary;
- .title{
- text-transform: capitalize;
- }
-}
\ No newline at end of file
+import React from 'react';
+import PropTypes from 'prop-types';
+
+function Groups() {
+
+ return (
+
+ Groups
+
+ );
+}
+
+Groups.propTypes = {
+ name: PropTypes.string
+};
+
+Groups.defaultProps = {
+ name: ''
+};
+
+export default Groups;
diff --git a/src/fireedge/src/public/containers/System/Users.js b/src/fireedge/src/public/containers/System/Users.js
new file mode 100644
index 0000000000..4b002f1d1a
--- /dev/null
+++ b/src/fireedge/src/public/containers/System/Users.js
@@ -0,0 +1,57 @@
+/* Copyright 2002-2019, 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. */
+/* -------------------------------------------------------------------------- */
+
+import React, { useEffect } from 'react';
+
+import { makeStyles, Card, CardContent, Typography } from '@material-ui/core';
+
+import useOpennebula from 'client/hooks/useOpennebula';
+
+const useStyles = makeStyles({
+ root: {
+ minWidth: 275
+ },
+ title: {
+ fontSize: 14
+ }
+});
+
+function Users() {
+ const classes = useStyles();
+ const { users, getUsers } = useOpennebula();
+
+ useEffect(() => {
+ getUsers();
+ }, [getUsers]);
+
+ console.log(users);
+ return (
+
+
+
+
+ Word of the Day
+
+
+
+
+ );
+}
+
+Users.propTypes = {};
+
+Users.defaultProps = {};
+
+export default Users;
diff --git a/src/fireedge/src/public/containers/System/index.js b/src/fireedge/src/public/containers/System/index.js
new file mode 100644
index 0000000000..2049efce7d
--- /dev/null
+++ b/src/fireedge/src/public/containers/System/index.js
@@ -0,0 +1,4 @@
+import Groups from './Groups';
+import Users from './Users';
+
+export { Groups, Users };
diff --git a/src/fireedge/src/public/containers/TestApi/ResponseForm.js b/src/fireedge/src/public/containers/TestApi/ResponseForm.js
index 1725939ff8..500cdecad8 100644
--- a/src/fireedge/src/public/containers/TestApi/ResponseForm.js
+++ b/src/fireedge/src/public/containers/TestApi/ResponseForm.js
@@ -12,28 +12,7 @@ import {
} from '@material-ui/core';
import ButtonSubmit from 'client/components/FormControl/SubmitButton';
-import { requestData } from 'client/utils';
-import { from as resourceFrom } from 'server/utils/constants/defaults';
-
-const getQueries = params =>
- Object.entries(params)
- ?.filter(([, { from }]) => from === resourceFrom.query)
- ?.map(([name, { default: value }]) => `${name}=${encodeURI(value)}`)
- ?.join('&');
-
-const getResources = params =>
- Object.values(params)
- ?.filter(({ from }) => from === resourceFrom.resource)
- ?.map(({ default: value }) => value)
- ?.join('/');
-
-const getDataBody = params =>
- Object.entries(params)
- ?.filter(([, { from }]) => from === resourceFrom.postBody)
- ?.reduce(
- (acc, [name, { default: value }]) => ({ ...acc, [name]: value }),
- {}
- );
+import { requestData, requestParams } from 'client/utils';
const ResponseForm = ({
handleChangeResponse,
@@ -42,26 +21,13 @@ const ResponseForm = ({
const { control, handleSubmit, errors, formState } = useForm();
const onSubmit = dataForm => {
- /* Spread 'from' values in current params */
- const reqParams = Object.entries(params)?.reduce(
- (acc, [param, { from }]) => ({
- ...acc,
- [param]: { from, ...dataForm[param] }
- }),
- {}
- );
+ const { url, options } = requestParams(dataForm, {
+ name,
+ httpMethod,
+ params
+ });
- const queries = getQueries(reqParams);
- const resources = getResources(reqParams);
- const data = getDataBody(reqParams);
-
- const url = `api/${name.replace('.', '/')}`;
-
- requestData(`${url}/${resources}?${queries}`, {
- data,
- method: httpMethod,
- authenticate: true
- }).then(({ id, ...res }) => {
+ requestData(url, options).then(({ id, ...res }) => {
id === 401 && console.log('ERROR');
id === 200 && handleChangeResponse(JSON.stringify(res, null, '\t'));
});
@@ -102,8 +68,8 @@ const ResponseForm = ({
)
}
control={control}
- name={`${nameCommand}.default`}
- defaultValue={value}
+ name={`${nameCommand}`}
+ defaultValue={String(value)}
/>
))}
diff --git a/src/fireedge/src/public/hooks/auth/useAuth.js b/src/fireedge/src/public/hooks/auth/useAuth.js
deleted file mode 100644
index 4329811f07..0000000000
--- a/src/fireedge/src/public/hooks/auth/useAuth.js
+++ /dev/null
@@ -1,69 +0,0 @@
-import { useCallback, useEffect } from 'react';
-import { useSelector, useDispatch, shallowEqual } from 'react-redux';
-
-import { jwtName } from 'client/constants';
-import { storage, findStorageData, removeStoreData } from 'client/utils';
-
-import * as servicesAuth from 'client/services/auth';
-import * as actions from 'client/actions/user';
-
-export default function useAuth() {
- const { isLoading, jwt, user: authUser, firstRender, error } = useSelector(
- state => state?.Authenticated,
- shallowEqual
- );
- const baseURL = useSelector(state => state?.System?.baseURL, shallowEqual);
- const dispatch = useDispatch();
-
- useEffect(() => {
- const tokenStorage = findStorageData(jwtName);
- if ((tokenStorage !== jwt && tokenStorage && jwt) || firstRender)
- dispatch(actions.loginSuccess(tokenStorage));
- }, [jwt, firstRender]);
-
- const login = useCallback(
- (user, remember) => {
- dispatch(actions.loginRequest());
-
- servicesAuth
- .login(user, baseURL)
- .then(({ data }) => {
- storage(jwtName, data?.token, remember);
- dispatch(actions.loginSuccess(data?.token));
- })
- .catch(res => {
- removeStoreData(jwtName);
- dispatch(actions.loginFailure('Unauthenticated'));
- });
- },
- [baseURL, jwtName]
- );
-
- const logout = useCallback(() => {
- removeStoreData([jwtName]);
- dispatch(actions.logout());
- }, [jwtName]);
-
- const getAuthUser = useCallback(() => {
- dispatch(actions.userRequest());
-
- servicesAuth
- .getUser()
- .then(({ data }) => dispatch(actions.userSuccess(data?.USER)))
- .catch(message => {
- removeStoreData([jwtName]);
- dispatch(actions.userFailure(message));
- });
- }, [dispatch]);
-
- return {
- login,
- logout,
- getAuthUser,
- authUser,
- isLogged: Boolean(jwt),
- isLoading,
- firstRender,
- error
- };
-}
diff --git a/src/fireedge/src/public/hooks/useAuth.js b/src/fireedge/src/public/hooks/useAuth.js
new file mode 100644
index 0000000000..5d136bdc96
--- /dev/null
+++ b/src/fireedge/src/public/hooks/useAuth.js
@@ -0,0 +1,134 @@
+import { useCallback, useEffect } from 'react';
+import { useSelector, useDispatch, shallowEqual } from 'react-redux';
+
+import { jwtName, FILTER_POOL, ONEADMIN_ID } from 'client/constants';
+import { storage, findStorageData, removeStoreData } from 'client/utils';
+
+import * as serviceAuth from 'client/services/auth';
+import * as serviceUsers from 'client/services/users';
+import * as serviceGroups from 'client/services/groups';
+import {
+ startAuth,
+ successAuth,
+ failureAuth,
+ logout as logoutRequest
+} from 'client/actions/user';
+import { setGroups } from 'client/actions/pool';
+
+// function delay(ms) {
+// return new Promise(resolve => setTimeout(resolve, ms));
+// }
+
+export default function useAuth() {
+ const {
+ jwt,
+ error,
+ isLogging,
+ isLoading,
+ firstRender,
+ filterPool,
+ user: authUser
+ } = useSelector(state => state?.Authenticated, shallowEqual);
+ const baseURL = useSelector(state => state?.System?.baseURL, shallowEqual);
+ const dispatch = useDispatch();
+
+ useEffect(() => {
+ const tokenStorage = findStorageData(jwtName);
+
+ if ((tokenStorage && jwt && tokenStorage !== jwt) || firstRender)
+ dispatch(successAuth({ jwt: tokenStorage }));
+ }, [jwt, firstRender]);
+
+ const login = useCallback(
+ ({ remember, ...user }) => {
+ dispatch(startAuth());
+
+ return serviceAuth
+ .login(user, baseURL)
+ .then(data => {
+ const { id, token } = data;
+ dispatch(successAuth());
+
+ if (token) {
+ storage(jwtName, token, remember);
+ dispatch(
+ successAuth({
+ jwt: token,
+ user: { ID: id },
+ isLoading: ONEADMIN_ID !== id, // is not oneadmin
+ isLogging: ONEADMIN_ID !== id // is not oneadmin
+ })
+ );
+ }
+
+ return data;
+ })
+ .catch(err => {
+ dispatch(failureAuth({ error: err }));
+ });
+ },
+ [baseURL, jwtName]
+ );
+
+ const logout = useCallback(() => {
+ removeStoreData([jwtName]);
+ dispatch(logoutRequest());
+ }, [jwtName]);
+
+ const getAuthInfo = useCallback(() => {
+ dispatch(startAuth());
+
+ return serviceAuth
+ .getUser(baseURL)
+ .then(user =>
+ serviceGroups.getGroups().then(groups => {
+ dispatch(setGroups(groups));
+ dispatch(successAuth({ user }));
+ })
+ )
+ .catch(err => dispatch(failureAuth({ error: err })));
+ }, [baseURL, jwtName]);
+
+ const setPrimaryGroup = useCallback(
+ values => {
+ if (values?.group === FILTER_POOL.ALL_RESOURCES) {
+ dispatch(
+ successAuth({
+ isLogging: false,
+ filterPool: FILTER_POOL.ALL_RESOURCES
+ })
+ );
+ } else {
+ dispatch(startAuth());
+
+ serviceUsers
+ .changeGroup({ id: authUser.ID, ...values })
+ .then(() =>
+ dispatch(
+ successAuth({
+ filterPool: FILTER_POOL.PRIMARY_GROUP_RESOURCES,
+ isLogging: false
+ })
+ )
+ )
+ .catch(err => dispatch(failureAuth({ error: err })));
+ }
+ },
+ [authUser, jwtName]
+ );
+
+ return {
+ login,
+ logout,
+ getAuthInfo,
+ setPrimaryGroup,
+ authUser,
+ isOneAdmin: authUser?.ID === ONEADMIN_ID,
+ isLogged: Boolean(jwt),
+ isLogging,
+ isLoading,
+ firstRender,
+ error,
+ filterPool
+ };
+}
diff --git a/src/fireedge/src/public/hooks/useGeneral.js b/src/fireedge/src/public/hooks/useGeneral.js
index 922169510d..ada80817ea 100644
--- a/src/fireedge/src/public/hooks/useGeneral.js
+++ b/src/fireedge/src/public/hooks/useGeneral.js
@@ -4,7 +4,10 @@ import { useSelector, useDispatch, shallowEqual } from 'react-redux';
import * as actions from 'client/actions/general';
export default function useGeneral() {
- const { isLoading, isOpenMenu } = useSelector(state => state?.General, shallowEqual);
+ const { isLoading, isOpenMenu } = useSelector(
+ state => state?.General,
+ shallowEqual
+ );
const dispatch = useDispatch();
const openMenu = useCallback(isOpen => dispatch(actions.openMenu(isOpen)), [
diff --git a/src/fireedge/src/public/hooks/useOpennebula.js b/src/fireedge/src/public/hooks/useOpennebula.js
new file mode 100644
index 0000000000..77884e5291
--- /dev/null
+++ b/src/fireedge/src/public/hooks/useOpennebula.js
@@ -0,0 +1,50 @@
+import { useCallback } from 'react';
+import { useSelector, useDispatch, shallowEqual } from 'react-redux';
+
+import {
+ setGroups,
+ setUsers,
+ startOneRequest,
+ failureOneRequest
+} from 'client/actions/pool';
+import * as servicesGroups from 'client/services/groups';
+import * as servicesUsers from 'client/services/users';
+
+function delay(ms) {
+ return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+export default function useOpennebula() {
+ const dispatch = useDispatch();
+ const { groups, users } = useSelector(
+ state => state?.Opennebula,
+ shallowEqual
+ );
+
+ const getGroups = useCallback(() => {
+ dispatch(startOneRequest());
+ return delay(2000).then(() =>
+ servicesGroups
+ .getGroups()
+ .then(data => dispatch(setGroups(data)))
+ .catch(() => dispatch(failureOneRequest('Unauthorized')))
+ );
+ }, [dispatch]);
+
+ const getUsers = useCallback(() => {
+ dispatch(startOneRequest());
+ return delay(2000).then(() =>
+ servicesUsers
+ .getUsers()
+ .then(data => dispatch(setUsers(data)))
+ .catch(() => dispatch(failureOneRequest('Unauthorized')))
+ );
+ }, [dispatch]);
+
+ return {
+ groups,
+ getGroups,
+ users,
+ getUsers
+ };
+}
diff --git a/src/fireedge/src/public/hooks/useStorage.js b/src/fireedge/src/public/hooks/useStorage.js
deleted file mode 100644
index b92f2c0c07..0000000000
--- a/src/fireedge/src/public/hooks/useStorage.js
+++ /dev/null
@@ -1,70 +0,0 @@
-import { useEffect, useRef } from 'react';
-
-function getItem(storage, key) {
- const value = storage.getItem(key);
-
- if (!value) return null;
-
- try {
- return JSON.parse(value);
- } catch (error) {
- return null;
- }
-}
-
-function setItem(storage, key, value) {
- storage.setItem(key, JSON.stringify(value));
-}
-
-/**
- * A wrapper for useState that retrieves the initial state from a
- * WebStorage object and saves the state there as it changes.
- */
-export default function useStorage(storage, key, [state, setState]) {
- const checkStorageRef = useRef(true);
-
- // Check for an existing value on the initial render...
- if (checkStorageRef.current) {
- checkStorageRef.current = false;
- const storedState = getItem(storage, key);
- if (storedState) setState(storedState);
- }
-
- useEffect(() => {
- setItem(storage, key, state);
- }, [storage, key, state]);
-
- return [state, setState];
-}
-
-function createMemoryStorage() {
- const storage = {};
- return {
- getItem(key) {
- return storage[key];
- },
- setItem(key, value) {
- storage[key] = value;
- }
- };
-}
-
-function getStorage(name) {
- return typeof window === 'object' && window[name]
- ? window[name]
- : createMemoryStorage();
-}
-
-/**
- * A convenient wrapper for useStorage(window.localStorage, ...)
- */
-export function useLocalStorage(key, state) {
- return useStorage(getStorage('localStorage'), key, state);
-}
-
-/**
- * A convenient wrapper for useStorage(window.sessionStorage, ...)
- */
-export function useSessionStorage(key, state) {
- return useStorage(getStorage('sessionStorage'), key, state);
-}
diff --git a/src/fireedge/src/public/hooks/auth/useSystem.js b/src/fireedge/src/public/hooks/useSystem.js
similarity index 100%
rename from src/fireedge/src/public/hooks/auth/useSystem.js
rename to src/fireedge/src/public/hooks/useSystem.js
diff --git a/src/fireedge/src/public/reducers/auth.js b/src/fireedge/src/public/reducers/auth.js
index ce2dc18e7f..30939f358e 100644
--- a/src/fireedge/src/public/reducers/auth.js
+++ b/src/fireedge/src/public/reducers/auth.js
@@ -13,8 +13,8 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-const actions = require('client/actions/user');
-const { jwtName } = require('client/constants');
+const { Actions: UserActions } = require('../actions/user');
+const { jwtName, FILTER_POOL } = require('client/constants');
const jwt =
typeof window !== 'undefined'
@@ -26,50 +26,44 @@ const jwt =
const initial = {
jwt,
user: null,
+ group: null,
error: null,
+ filterPool: FILTER_POOL.ALL_RESOURCES,
+ isLogging: false,
isLoading: false,
firstRender: true
};
const authentication = (state = initial, action) => {
switch (action.type) {
- case actions.LOGIN_REQUEST:
+ case UserActions.START_AUTH:
return {
...state,
+ error: null,
+ firstRender: false,
isLoading: true
};
- case actions.LOGIN_SUCCESS:
+ case UserActions.SUCCESS_AUTH:
return {
+ ...state,
+ error: null,
+ firstRender: false,
isLoading: false,
- jwt: action.jwt
+ ...action.payload
};
- case actions.LOGIN_FAILURE:
- return {
- isLoading: false,
- error: action.message
- };
- case actions.LOGOUT:
+ case UserActions.FAILURE_AUTH:
return {
...state,
jwt: null,
- user: null,
- error: null
- };
- case actions.USER_REQUEST:
- return {
- ...state,
- isLoading: true
- };
- case actions.USER_SUCCESS:
- return {
- ...state,
+ firstRender: false,
isLoading: false,
- user: action.user
+ ...action.payload
};
- case actions.USER_FAILURE:
+ case UserActions.LOGOUT:
return {
- isLoading: false,
- error: action.message
+ ...initial,
+ jwt: null,
+ firstRender: false
};
default:
return state;
diff --git a/src/fireedge/src/public/reducers/general.js b/src/fireedge/src/public/reducers/general.js
index 484df3fea3..966b2a18f3 100644
--- a/src/fireedge/src/public/reducers/general.js
+++ b/src/fireedge/src/public/reducers/general.js
@@ -13,7 +13,9 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-const actions = require('../actions/general');
+const { Actions: PoolActions } = require('../actions/pool');
+const { Actions: UserActions } = require('../actions/user');
+const { Actions: GeneralActions } = require('../actions/general');
const initial = {
zone: 0,
@@ -23,18 +25,18 @@ const initial = {
const General = (state = initial, action) => {
switch (action.type) {
- case actions.DISPLAY_LOADING: {
+ case PoolActions.START_ONE_REQUEST:
+ return { ...state, isLoading: true };
+ case PoolActions.SUCCESS_ONE_REQUEST:
+ return { ...state, isLoading: false };
+ case PoolActions.FAILURE_ONE_REQUEST:
+ return { ...state, isLoading: false };
+ case GeneralActions.CHANGE_ZONE:
return { ...state, ...action.payload };
- }
- case actions.CHANGE_ZONE: {
- return { ...state, ...action.payload };
- }
- case actions.TOGGLE_MENU: {
- return {
- ...state,
- isOpenMenu: action.isOpen
- };
- }
+ case GeneralActions.TOGGLE_MENU:
+ return { ...state, isOpenMenu: action.isOpen };
+ case UserActions.LOGOUT:
+ return { ...initial };
default:
return state;
}
diff --git a/src/fireedge/src/public/reducers/opennebula.js b/src/fireedge/src/public/reducers/opennebula.js
index d2d6245aaf..1e09894597 100644
--- a/src/fireedge/src/public/reducers/opennebula.js
+++ b/src/fireedge/src/public/reducers/opennebula.js
@@ -13,6 +13,9 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
+const { Actions: PoolActions } = require('../actions/pool');
+const { Actions: UserActions } = require('../actions/user');
+
const initial = {
vm: [],
templates: [],
@@ -30,6 +33,7 @@ const initial = {
clusters: [],
hosts: [],
zones: [],
+ users: [],
groups: [],
vdc: [],
acl: []
@@ -37,6 +41,10 @@ const initial = {
const Opennebula = (state = initial, action) => {
switch (action.type) {
+ case PoolActions.SUCCESS_ONE_REQUEST:
+ return { ...state, ...action.payload };
+ case UserActions.LOGOUT:
+ return { ...initial };
default:
return state;
}
diff --git a/src/fireedge/src/public/router/endpoints.js b/src/fireedge/src/public/router/endpoints.js
index e08084a959..e65066add6 100644
--- a/src/fireedge/src/public/router/endpoints.js
+++ b/src/fireedge/src/public/router/endpoints.js
@@ -13,59 +13,111 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-import { Login } from 'client/containers/Login';
+import Login from 'client/containers/Login';
import { Clusters, Hosts, Zones } from 'client/containers/Infrastructure';
+import { Users, Groups } from 'client/containers/System';
import Settings from 'client/containers/Settings';
import TestApi from 'client/containers/TestApi';
import Dashboard from 'client/containers/Dashboard';
-export default {
- login: {
- path: '/',
- authenticated: false,
- menu: false,
- component: Login
+export const PATH = {
+ LOGIN: '/',
+ DASHBOARD: '/dashboard',
+ SETTINGS: '/settings',
+ TEST_API: '/test-api',
+ INFRASTRUCTURE: {
+ CLUSTERS: '/clusters',
+ HOSTS: '/hosts',
+ ZONES: '/zones'
},
- dashboard: {
- path: '/dashboard',
- component: Dashboard
+ SYSTEM: {
+ USERS: '/users',
+ GROUPS: '/groups'
},
- settings: {
- path: '/settings',
- component: Settings
- },
- test_api: {
- path: '/test-api',
- component: TestApi
- },
- // infrastructure
- infrastructure: {
- clusters: {
- path: '/clusters',
- component: Clusters
- },
- hosts: {
- path: '/hosts',
- component: Hosts
- },
- zones: {
- path: '/zones',
- component: Zones
- }
- },
- // networks
- networks: {
- vnets: {
- path: '/vnets'
- },
- vnets_templates: {
- path: '/vnets-templates'
- },
- vnets_topology: {
- path: '/vnets-topology'
- },
- vnets_secgroup: {
- path: '/secgroup'
- }
+ NETWORKS: {
+ VNETS: '/vnets',
+ VNETS_TEMPLATES: '/vnets-templates',
+ VNETS_TOPOLOGY: '/vnets-topology',
+ SEC_GROUPS: '/secgroups'
}
};
+
+export default [
+ {
+ label: 'login',
+ path: PATH.LOGIN,
+ authenticated: false,
+ component: Login
+ },
+ {
+ label: 'dashboard',
+ path: PATH.DASHBOARD,
+ component: Dashboard
+ },
+ {
+ label: 'settings',
+ path: PATH.SETTINGS,
+ component: Settings
+ },
+ {
+ label: 'test api',
+ path: PATH.TEST_API,
+ component: TestApi
+ },
+ {
+ label: 'infrastructure',
+ routes: [
+ {
+ label: 'clusters',
+ path: PATH.INFRASTRUCTURE.CLUSTERS,
+ component: Clusters
+ },
+ {
+ label: 'hosts',
+ path: PATH.INFRASTRUCTURE.HOSTS,
+ component: Hosts
+ },
+ {
+ label: 'zones',
+ path: PATH.INFRASTRUCTURE.ZONES,
+ component: Zones
+ }
+ ]
+ },
+ {
+ label: 'system',
+ routes: [
+ {
+ label: 'users',
+ path: PATH.SYSTEM.USERS,
+ component: Users
+ },
+ {
+ label: 'groups',
+ path: PATH.SYSTEM.GROUPS,
+ component: Groups
+ }
+ ]
+ },
+ {
+ label: 'networks',
+ routes: [
+ {
+ label: 'vnets',
+ path: PATH.NETWORKS.VNETS
+ },
+ {
+ label: 'vnets templates',
+ path: PATH.NETWORKS.VNETS_TEMPLATES
+ },
+ {
+ label: 'vnets topology',
+ path: PATH.NETWORKS.VNETS_TOPOLOGY
+ },
+ {
+ label: 'vnets secgroup',
+ path: PATH.NETWORKS.SEC_GROUPS
+ }
+ ]
+ }
+];
diff --git a/src/fireedge/src/public/router/index.js b/src/fireedge/src/public/router/index.js
index fcebd640a1..58fb076875 100644
--- a/src/fireedge/src/public/router/index.js
+++ b/src/fireedge/src/public/router/index.js
@@ -22,39 +22,37 @@ import Error404 from 'client/containers/Error404';
import endpoints from './endpoints';
-const routeElement = (
- title = '',
- { path = '/', authenticated = true, component: Component }
-) => (
-
- authenticated ? (
-
-
-
-
-
- ) : (
-
-
-
- )
- }
- />
-);
-
function Routes() {
+ const renderRoute = ({
+ label = '',
+ path = '',
+ authenticated = true,
+ component: Component
+ }) => (
+
+ authenticated ? (
+
+
+
+
+
+ ) : (
+
+
+
+ )
+ }
+ />
+ );
+
return (
- {Object.entries(endpoints)?.map(([title, routes]) =>
- routes.component
- ? routeElement(title, routes)
- : Object.entries(routes)?.map(([internalTitle, route]) =>
- routeElement(internalTitle, route)
- )
+ {endpoints?.map(({ routes, ...endpoint }) =>
+ endpoint.path ? renderRoute(endpoint) : routes?.map(renderRoute)
)}
} />
diff --git a/src/fireedge/src/public/scss/main.scss b/src/fireedge/src/public/scss/main.scss
index a524adfbdd..17d0c26e0f 100644
--- a/src/fireedge/src/public/scss/main.scss
+++ b/src/fireedge/src/public/scss/main.scss
@@ -33,7 +33,6 @@ $font_secondary: red;
text-rendering: optimizeLegibility;
}
-@import "header";
@import "login";
@import "footer";
@import "menu";
diff --git a/src/fireedge/src/public/services/auth.js b/src/fireedge/src/public/services/auth.js
index a9262143d9..32bd77546b 100644
--- a/src/fireedge/src/public/services/auth.js
+++ b/src/fireedge/src/public/services/auth.js
@@ -1,25 +1,37 @@
-import { endpointsRoutes } from 'client/constants';
-import { requestData } from 'client/utils';
-import httpCodes from 'server/utils/constants/http-codes';
+import { httpCodes } from 'server/utils/constants';
+import { jwtName, endpointsRoutes } from 'client/constants';
+import { requestData, removeStoreData } from 'client/utils';
export const login = (user, baseURL = '') =>
requestData(endpointsRoutes.login, {
+ baseURL,
data: user,
method: 'POST',
authenticate: false,
- baseURL,
- error: console.error
+ error: err => {
+ removeStoreData(jwtName);
+ return err?.message;
+ }
}).then(res => {
- if (!res?.id || res?.id !== httpCodes.ok.id) throw new Error(res);
+ if (!res?.id || res?.id !== httpCodes.ok.id) {
+ if (res?.id === httpCodes.accepted.id) return res;
+ throw res;
+ }
- return res;
+ return res?.data;
});
-export const getUser = () =>
- requestData(endpointsRoutes.userInfo).then(res => {
- if (!res?.id || res?.id !== httpCodes.ok.id) throw new Error(res);
+export const getUser = (baseURL = '') =>
+ requestData(endpointsRoutes.userInfo, {
+ baseURL,
+ error: err => {
+ removeStoreData(jwtName);
+ return err?.message;
+ }
+ }).then(res => {
+ if (!res?.id || res?.id !== httpCodes.ok.id) throw res;
- return res;
+ return res?.data?.USER ?? {};
});
export default {
diff --git a/src/fireedge/src/public/services/groups.js b/src/fireedge/src/public/services/groups.js
new file mode 100644
index 0000000000..8cfb8d8a2b
--- /dev/null
+++ b/src/fireedge/src/public/services/groups.js
@@ -0,0 +1,18 @@
+import { Actions, Commands } from 'server/utils/constants/commands/group';
+import { requestData, requestParams } from 'client/utils';
+import httpCodes from 'server/utils/constants/http-codes';
+
+export const getGroups = () => {
+ const name = Actions.GROUP_POOL_INFO;
+ const { url, options } = requestParams({}, { name, ...Commands[name] });
+
+ return requestData(url, options).then(res => {
+ if (!res?.id || res?.id !== httpCodes.ok.id) throw res;
+
+ return [res?.data?.GROUP_POOL?.GROUP ?? []].flat();
+ });
+};
+
+export default {
+ getGroups
+};
diff --git a/src/fireedge/src/public/services/users.js b/src/fireedge/src/public/services/users.js
new file mode 100644
index 0000000000..f054a01f6d
--- /dev/null
+++ b/src/fireedge/src/public/services/users.js
@@ -0,0 +1,30 @@
+import { Actions, Commands } from 'server/utils/constants/commands/user';
+import { requestData, requestParams } from 'client/utils';
+import httpCodes from 'server/utils/constants/http-codes';
+
+export const changeGroup = values => {
+ const name = Actions.USER_CHGRP;
+ const { url, options } = requestParams(values, { name, ...Commands[name] });
+
+ return requestData(url, options).then(res => {
+ if (!res?.id || res?.id !== httpCodes.ok.id) throw res;
+
+ return res?.data ?? {};
+ });
+};
+
+export const getUsers = () => {
+ const name = Actions.USER_POOL_INFO;
+ const { url, options } = requestParams({}, { name, ...Commands[name] });
+
+ return requestData(url, options).then(res => {
+ if (!res?.id || res?.id !== httpCodes.ok.id) throw res;
+
+ return [res?.data?.USER_POOL?.USER ?? []].flat();
+ });
+};
+
+export default {
+ changeGroup,
+ getUsers
+};
diff --git a/src/fireedge/src/public/utils/index.js b/src/fireedge/src/public/utils/index.js
index a854d28444..4fe24d2d0c 100644
--- a/src/fireedge/src/public/utils/index.js
+++ b/src/fireedge/src/public/utils/index.js
@@ -14,3 +14,4 @@
/* -------------------------------------------------------------------------- */
export * from './utils';
+export * from './request';
diff --git a/src/fireedge/src/public/utils/request.js b/src/fireedge/src/public/utils/request.js
new file mode 100644
index 0000000000..2dca36e112
--- /dev/null
+++ b/src/fireedge/src/public/utils/request.js
@@ -0,0 +1,54 @@
+import { jwtName } from 'client/constants';
+import { removeStoreData } from 'client/utils';
+import { from as resourceFrom } from 'server/utils/constants/defaults';
+
+export const getQueries = params =>
+ Object.entries(params)
+ ?.filter(([, { from }]) => from === resourceFrom.query)
+ ?.map(([name, { value }]) => `${name}=${encodeURI(value)}`)
+ ?.join('&');
+
+export const getResources = params =>
+ Object.values(params)
+ ?.filter(({ from }) => from === resourceFrom.resource)
+ ?.map(({ value }) => value)
+ ?.join('/');
+
+export const getDataBody = params =>
+ Object.entries(params)
+ ?.filter(([, { from }]) => from === resourceFrom.postBody)
+ ?.reduce((acc, [name, { value }]) => ({ ...acc, [name]: value }), {});
+
+export const requestParams = (data, command) => {
+ if (command === undefined) throw new Error('command not exists');
+ const { name, httpMethod, params } = command;
+
+ /* Spread 'from' values in current params */
+ const mappedParams =
+ Object.entries(params)?.reduce(
+ (acc, [param, { from }]) => ({
+ ...acc,
+ [param]: { from, value: data[param] }
+ }),
+ {}
+ ) ?? {};
+
+ const queries = getQueries(mappedParams);
+ const resources = getResources(mappedParams);
+ const body = getDataBody(mappedParams);
+
+ const url = `api/${name.replace('.', '/')}`;
+
+ return {
+ url: `${url}/${resources}?${queries}`,
+ options: {
+ data: body,
+ method: httpMethod,
+ authenticate: true,
+ error: err => {
+ removeStoreData(jwtName);
+ return err?.message;
+ }
+ }
+ };
+};
diff --git a/src/fireedge/src/public/utils/utils.js b/src/fireedge/src/public/utils/utils.js
index 428ef8eb77..a5756a4112 100644
--- a/src/fireedge/src/public/utils/utils.js
+++ b/src/fireedge/src/public/utils/utils.js
@@ -17,7 +17,18 @@ import axios from 'axios';
import root from 'window-or-global';
import { messageTerminal } from 'server/utils/general';
-import constants from 'client/constants';
+import { httpCodes } from 'server/utils/constants';
+import { jwtName } from 'client/constants';
+
+const defaultData = {
+ data: {},
+ json: true,
+ baseURL: '',
+ method: 'GET',
+ authenticate: true,
+ onUploadProgress: null,
+ error: e => e
+};
export const storage = (name = '', data = '', keepData = false) => {
if (name && data && root && root.localStorage && root.sessionStorage) {
@@ -34,10 +45,10 @@ export const removeStoreData = (items = []) => {
if (!Array.isArray(items)) {
itemsToRemove = [items];
}
- itemsToRemove.forEach(e => {
+ itemsToRemove.forEach(item => {
if (root && root.localStorage && root.sessionStorage) {
- root.localStorage.removeItem(e);
- root.sessionStorage.removeItem(e);
+ root.localStorage.removeItem(item);
+ root.sessionStorage.removeItem(item);
}
});
};
@@ -57,26 +68,16 @@ export const findStorageData = (name = '') => {
return rtn;
};
-export const requestData = (
- url = '',
- params = {
- method: 'GET',
- json: true,
- data: {},
- authenticate: true,
- onUploadProgress: null,
- baseURL: '',
- error: e => e
- }
-) => {
+export const requestData = (url = '', data = {}) => {
+ const params = { ...defaultData, ...data };
const config = {
url,
method: params.method,
baseURL: params.baseURL,
headers: {},
- validateStatus: status => status >= 200 && status <= 401
+ validateStatus: status =>
+ Object.values(httpCodes).some(({ id }) => id === status)
};
- const { jwtName } = constants;
const json = params.json ? params.json : true;
let rtn = null;
if (json) {
@@ -100,22 +101,22 @@ export const requestData = (
return axios
.request(config)
.then(response => {
- if (response && response.statusText && response.data) {
+ if (response?.data && response?.status < httpCodes.badRequest.id) {
rtn =
json && typeof response === 'string'
? response.data.json()
: response.data;
return rtn;
}
- throw Error(response.statusText);
+ throw new Error(response.statusText);
})
- .catch(e => {
+ .catch(err => {
const configErrorParser = {
color: 'red',
- type: e,
+ type: err.message,
message: 'Error request: %s'
};
messageTerminal(configErrorParser);
- return params.error(rtn);
+ return params.error(err);
});
};
diff --git a/src/fireedge/src/utils/constants/commands/acl.js b/src/fireedge/src/utils/constants/commands/acl.js
index 1f20bbab1f..57d73bc70a 100644
--- a/src/fireedge/src/utils/constants/commands/acl.js
+++ b/src/fireedge/src/utils/constants/commands/acl.js
@@ -14,38 +14,56 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = ({ resource, postBody }, { GET, POST, DELETE }) => ({
- 'acl.addrule': {
- // inspected
- httpMethod: POST,
- params: {
- user: {
- from: postBody,
- default: '0x100000000'
- },
- resource: {
- from: postBody,
- default: '0x1000000000'
- },
- right: {
- from: postBody,
- default: '0x1'
+const {
+ from: { resource, postBody },
+ httpMethod: { GET, POST, DELETE }
+} = require('../defaults');
+
+const ACL_ADDRULE = 'acl.addrule';
+const ACL_DELRULE = 'acl.delrule';
+const ACL_INFO = 'acl.info';
+
+const Actions = {
+ ACL_ADDRULE,
+ ACL_DELRULE,
+ ACL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [ACL_ADDRULE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ user: {
+ from: postBody,
+ default: '0x100000000'
+ },
+ resource: {
+ from: postBody,
+ default: '0x1000000000'
+ },
+ right: {
+ from: postBody,
+ default: '0x1'
+ }
}
- }
- },
- 'acl.delrule': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [ACL_DELRULE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
+ },
+ [ACL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
}
- },
- 'acl.info': {
- // inspected
- httpMethod: GET,
- params: {}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/cluster.js b/src/fireedge/src/utils/constants/commands/cluster.js
index d8eae3d1f8..70a433952b 100644
--- a/src/fireedge/src/utils/constants/commands/cluster.js
+++ b/src/fireedge/src/utils/constants/commands/cluster.js
@@ -13,163 +13,196 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'cluster.allocate': {
- // inspected
- httpMethod: PUT,
- params: {
- name: {
- from: postBody,
- default: ''
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const CLUSTER_ALLOCATE = 'cluster.allocate';
+const CLUSTER_DELETE = 'cluster.delete';
+const CLUSTER_UPDATE = 'cluster.update';
+const CLUSTER_ADDHOST = 'cluster.addhost';
+const CLUSTER_DELHOST = 'cluster.delhost';
+const CLUSTER_ADDDATASTORE = 'cluster.adddatastore';
+const CLUSTER_DELDATASTORE = 'cluster.deldatastore';
+const CLUSTER_ADDVNET = 'cluster.addvnet';
+const CLUSTER_DELVNET = 'cluster.delvnet';
+const CLUSTER_RENAME = 'cluster.rename';
+const CLUSTER_INFO = 'cluster.info';
+const CLUSTER_POOL_INFO = 'clusterpool.info';
+
+const Actions = {
+ CLUSTER_ALLOCATE,
+ CLUSTER_DELETE,
+ CLUSTER_UPDATE,
+ CLUSTER_ADDHOST,
+ CLUSTER_DELHOST,
+ CLUSTER_ADDDATASTORE,
+ CLUSTER_DELDATASTORE,
+ CLUSTER_ADDVNET,
+ CLUSTER_DELVNET,
+ CLUSTER_RENAME,
+ CLUSTER_INFO,
+ CLUSTER_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [CLUSTER_ALLOCATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'cluster.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [CLUSTER_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'cluster.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [CLUSTER_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'cluster.addhost': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- host: {
- from: postBody,
- default: 0
+ },
+ [CLUSTER_ADDHOST]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ host: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'cluster.delhost': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- host: {
- from: query,
- default: 0
+ },
+ [CLUSTER_DELHOST]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ host: {
+ from: query,
+ default: 0
+ }
}
- }
- },
- 'cluster.adddatastore': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- datastore: {
- from: postBody,
- default: 0
+ },
+ [CLUSTER_ADDDATASTORE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ datastore: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'cluster.deldatastore': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- datastore: {
- from: postBody,
- default: 0
+ },
+ [CLUSTER_DELDATASTORE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ datastore: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'cluster.addvnet': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- vnet: {
- from: postBody,
- default: 0
+ },
+ [CLUSTER_ADDVNET]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ vnet: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'cluster.delvnet': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- vnet: {
- from: postBody,
- default: 0
+ },
+ [CLUSTER_DELVNET]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ vnet: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'cluster.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [CLUSTER_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'cluster.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [CLUSTER_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
+ },
+ [CLUSTER_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
}
- },
- 'clusterpool.info': {
- // inspected
- httpMethod: GET,
- params: {}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/datastore.js b/src/fireedge/src/utils/constants/commands/datastore.js
index ddf088c255..7f404e224e 100644
--- a/src/fireedge/src/utils/constants/commands/datastore.js
+++ b/src/fireedge/src/utils/constants/commands/datastore.js
@@ -13,161 +13,188 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'datastore.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
- },
- cluster: {
- from: postBody,
- default: -1
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const DATASTORE_ALLOCATE = 'datastore.allocate';
+const DATASTORE_DELETE = 'datastore.delete';
+const DATASTORE_UPDATE = 'datastore.update';
+const DATASTORE_CHMOD = 'datastore.chmod';
+const DATASTORE_CHOWN = 'datastore.chown';
+const DATASTORE_RENAME = 'datastore.rename';
+const DATASTORE_ENABLE = 'datastore.enable';
+const DATASTORE_INFO = 'datastore.info';
+const DATASTORE_POOL_INFO = 'datastorepool.info';
+
+const Actions = {
+ DATASTORE_ALLOCATE,
+ DATASTORE_DELETE,
+ DATASTORE_UPDATE,
+ DATASTORE_CHMOD,
+ DATASTORE_CHOWN,
+ DATASTORE_RENAME,
+ DATASTORE_ENABLE,
+ DATASTORE_INFO,
+ DATASTORE_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [DATASTORE_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ },
+ cluster: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'datastore.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [DATASTORE_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'datastore.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [DATASTORE_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'datastore.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
+ },
+ [DATASTORE_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'datastore.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user: {
- from: postBody,
- default: -1
- },
- group: {
- from: postBody,
- default: -1
+ },
+ [DATASTORE_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user: {
+ from: postBody,
+ default: -1
+ },
+ group: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'datastore.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [DATASTORE_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'datastore.enable': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- enable: {
- from: postBody,
- default: true
+ },
+ [DATASTORE_ENABLE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ enable: {
+ from: postBody,
+ default: true
+ }
}
- }
- },
- 'datastore.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [DATASTORE_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
+ },
+ [DATASTORE_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
}
- },
- 'datastorepool.info': {
- // inspected
- httpMethod: GET,
- params: {}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/document.js b/src/fireedge/src/utils/constants/commands/document.js
index a665fce1fe..c5a4eca9ec 100644
--- a/src/fireedge/src/utils/constants/commands/document.js
+++ b/src/fireedge/src/utils/constants/commands/document.js
@@ -13,206 +13,237 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'document.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
- },
- type: {
- from: postBody,
- default: 0
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const DOCUMENT_ALLOCATE = 'document.allocate';
+const DOCUMENT_CLONE = 'document.clone';
+const DOCUMENT_DELETE = 'document.delete';
+const DOCUMENT_UPDATE = 'document.update';
+const DOCUMENT_CHMOD = 'document.chmod';
+const DOCUMENT_CHOWN = 'document.chown';
+const DOCUMENT_RENAME = 'document.rename';
+const DOCUMENT_INFO = 'document.info';
+const DOCUMENT_LOCK = 'document.lock';
+const DOCUMENT_UNLOCK = 'document.unlock';
+const DOCUMENT_POOL_INFO = 'documentpool.info';
+
+const Actions = {
+ DOCUMENT_ALLOCATE,
+ DOCUMENT_CLONE,
+ DOCUMENT_DELETE,
+ DOCUMENT_UPDATE,
+ DOCUMENT_CHMOD,
+ DOCUMENT_CHOWN,
+ DOCUMENT_RENAME,
+ DOCUMENT_INFO,
+ DOCUMENT_LOCK,
+ DOCUMENT_UNLOCK,
+ DOCUMENT_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [DOCUMENT_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ },
+ type: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'document.clone': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [DOCUMENT_CLONE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'document.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [DOCUMENT_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'document.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [DOCUMENT_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'document.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
+ },
+ [DOCUMENT_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'document.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user: {
- from: postBody,
- default: -1
- },
- group: {
- from: postBody,
- default: -1
+ },
+ [DOCUMENT_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user: {
+ from: postBody,
+ default: -1
+ },
+ group: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'document.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [DOCUMENT_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'document.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: postBody,
- default: false
+ },
+ [DOCUMENT_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: postBody,
+ default: false
+ }
}
- }
- },
- 'document.lock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- lock: {
- from: postBody,
- default: 4
+ },
+ [DOCUMENT_LOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ lock: {
+ from: postBody,
+ default: 4
+ }
}
- }
- },
- 'document.unlock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [DOCUMENT_UNLOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'documentpool.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- filter: {
- from: query,
- default: -1
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
- },
- type: {
- from: query,
- default: 0
+ },
+ [DOCUMENT_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ filter: {
+ from: query,
+ default: -1
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ },
+ type: {
+ from: query,
+ default: 0
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/group.js b/src/fireedge/src/utils/constants/commands/group.js
index 174f7687f2..5f0ea0a1a8 100644
--- a/src/fireedge/src/utils/constants/commands/group.js
+++ b/src/fireedge/src/utils/constants/commands/group.js
@@ -13,122 +13,151 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'group.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- name: {
- from: postBody,
- default: ''
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const GROUP_ALLOCATE = 'group.allocate';
+const GROUP_DELETE = 'group.delete';
+const GROUP_INFO = 'group.info';
+const GROUP_UPDATE = 'group.update';
+const GROUP_ADDADMIN = 'group.addadmin';
+const GROUP_DELADMIN = 'group.deladmin';
+const GROUP_QUOTA = 'group.quota';
+const GROUP_POOL_INFO = 'grouppool.info';
+const GROUP_QUOTA_INFO = 'groupquota.info';
+const GROUP_QUOTA_UPDATE = 'groupquota.update';
+
+const Actions = {
+ GROUP_ALLOCATE,
+ GROUP_DELETE,
+ GROUP_INFO,
+ GROUP_UPDATE,
+ GROUP_ADDADMIN,
+ GROUP_DELADMIN,
+ GROUP_QUOTA,
+ GROUP_POOL_INFO,
+ GROUP_QUOTA_INFO,
+ GROUP_QUOTA_UPDATE
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [GROUP_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'group.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [GROUP_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'group.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: -1
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [GROUP_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: -1
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'group.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [GROUP_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'group.addadmin': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user: {
- from: postBody,
- default: 0
+ },
+ [GROUP_ADDADMIN]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'group.deladmin': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user: {
- from: postBody,
- default: 0
+ },
+ [GROUP_DELADMIN]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'group.quota': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: resource,
- default: ''
+ },
+ [GROUP_QUOTA]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: resource,
+ default: ''
+ }
}
- }
- },
- 'grouppool.info': {
- // inspected
- httpMethod: GET,
- params: {}
- },
- 'groupquota.info': {
- // inspected
- httpMethod: GET,
- params: {}
- },
- 'groupquota.update': {
- // inspected
- httpMethod: PUT,
- params: {
- template: {
- from: postBody,
- default: ''
+ },
+ [GROUP_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
+ },
+ [GROUP_QUOTA_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
+ },
+ [GROUP_QUOTA_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/groupsec.js b/src/fireedge/src/utils/constants/commands/groupsec.js
deleted file mode 100644
index 513207e5b1..0000000000
--- a/src/fireedge/src/utils/constants/commands/groupsec.js
+++ /dev/null
@@ -1,196 +0,0 @@
-/* Copyright 2002-2019, 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. */
-/* -------------------------------------------------------------------------- */
-
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- '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
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- 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
- }
- }
- },
- 'secgrouppool.info': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -3
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
- }
- }
- }
-});
diff --git a/src/fireedge/src/utils/constants/commands/hook.js b/src/fireedge/src/utils/constants/commands/hook.js
index 894e8d50df..8c6697ce46 100644
--- a/src/fireedge/src/utils/constants/commands/hook.js
+++ b/src/fireedge/src/utils/constants/commands/hook.js
@@ -13,152 +13,179 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'hook.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const HOOK_ALLOCATE = 'hook.allocate';
+const HOOK_DELETE = 'hook.delete';
+const HOOK_INFO = 'hook.info';
+const HOOK_RENAME = 'hook.rename';
+const HOOK_LOCK = 'hook.lock';
+const HOOK_UNLOCK = 'hook.unlock';
+const HOOK_RETRY = 'hook.retry';
+const HOOK_POOL_INFO = 'hookpool.info';
+const HOOK_LOG_INFO = 'hooklog.info';
+
+const Actions = {
+ HOOK_ALLOCATE,
+ HOOK_DELETE,
+ HOOK_INFO,
+ HOOK_RENAME,
+ HOOK_LOCK,
+ HOOK_UNLOCK,
+ HOOK_RETRY,
+ HOOK_POOL_INFO,
+ HOOK_LOG_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [HOOK_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'hook.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [HOOK_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'hook.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [HOOK_DELETE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'hook.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [HOOK_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'hook.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: postBody,
- default: false
+ },
+ [HOOK_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: postBody,
+ default: false
+ }
}
- }
- },
- 'hook.lock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- lock: {
- from: postBody,
- default: 4
+ },
+ [HOOK_LOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ lock: {
+ from: postBody,
+ default: 4
+ }
}
- }
- },
- 'hook.unlock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [HOOK_UNLOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'hook.retry': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- execution: {
- from: postBody,
- default: 0
+ },
+ [HOOK_RETRY]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ execution: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'hookpool.info': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -1
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
+ },
+ [HOOK_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -1
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ }
}
- }
- },
- 'hooklog.info': {
- // inspected
- httpMethod: GET,
- params: {
- minimun: {
- from: postBody, // epoch time
- default: ''
- },
- maximun: {
- from: postBody, // epoch time
- default: ''
- },
- id: {
- from: postBody,
- default: '' // check
- },
- execution: {
- from: postBody,
- default: 0
+ },
+ [HOOK_LOG_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ minimun: {
+ from: postBody, // epoch time
+ default: ''
+ },
+ maximun: {
+ from: postBody, // epoch time
+ default: ''
+ },
+ id: {
+ from: postBody,
+ default: '' // check
+ },
+ execution: {
+ from: postBody,
+ default: 0
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/host.js b/src/fireedge/src/utils/constants/commands/host.js
index 6b038fdba8..5cbdbb7094 100644
--- a/src/fireedge/src/utils/constants/commands/host.js
+++ b/src/fireedge/src/utils/constants/commands/host.js
@@ -13,117 +13,147 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = ({ resource, postBody, query }, { GET, PUT, DELETE }) => ({
- 'host.allocate': {
- // inspected
- httpMethod: PUT,
- params: {
- hostname: {
- from: postBody,
- default: ''
- },
- information: {
- from: postBody,
- default: ''
- },
- manager: {
- from: postBody,
- default: ''
- },
- cluster: {
- from: postBody,
- default: -1
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, PUT, DELETE }
+} = require('../defaults');
+
+const HOST_ALLOCATE = 'host.allocate';
+const HOST_DELETE = 'host.delete';
+const HOST_STATUS = 'host.status';
+const HOST_UPDATE = 'host.update';
+const HOST_RENAME = 'host.rename';
+const HOST_INFO = 'host.info';
+const HOST_MONITORING = 'host.monitoring';
+const HOST_POOL_INFO = 'hostpool.info';
+const HOST_POOL_MONITORING = 'hostpool.monitoring';
+
+const Actions = {
+ HOST_ALLOCATE,
+ HOST_DELETE,
+ HOST_STATUS,
+ HOST_UPDATE,
+ HOST_RENAME,
+ HOST_INFO,
+ HOST_MONITORING,
+ HOST_POOL_INFO,
+ HOST_POOL_MONITORING
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [HOST_ALLOCATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ hostname: {
+ from: postBody,
+ default: ''
+ },
+ information: {
+ from: postBody,
+ default: ''
+ },
+ manager: {
+ from: postBody,
+ default: ''
+ },
+ cluster: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'host.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [HOST_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'host.status': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- status: {
- from: postBody,
- default: 0
+ },
+ [HOST_STATUS]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ status: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'host.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [HOST_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'host.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [HOST_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'host.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [HOST_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'host.monitoring': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [HOST_MONITORING]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
+ },
+ [HOST_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
+ },
+ [HOST_POOL_MONITORING]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
}
- },
- 'hostpool.info': {
- // inspected
- httpMethod: GET,
- params: {}
- },
- 'hostpool.monitoring': {
- // inspected
- httpMethod: GET,
- params: {}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/image.js b/src/fireedge/src/utils/constants/commands/image.js
index 12e8780912..e9b54b49c2 100644
--- a/src/fireedge/src/utils/constants/commands/image.js
+++ b/src/fireedge/src/utils/constants/commands/image.js
@@ -13,290 +13,333 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'image.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
- },
- datastore: {
- from: postBody,
- default: 0
- },
- capacity: {
- from: postBody,
- default: false
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const IMAGE_ALLOCATE = 'image.allocate';
+const IMAGE_CLONE = 'image.clone';
+const IMAGE_DELETE = 'image.delete';
+const IMAGE_ENABLE = 'image.enable';
+const IMAGE_PERSISTENT = 'image.persistent';
+const IMAGE_CHTYPE = 'image.chtype';
+const IMAGE_UPDATE = 'image.update';
+const IMAGE_CHMOD = 'image.chmod';
+const IMAGE_CHOWN = 'image.chown';
+const IMAGE_RENAME = 'image.rename';
+const IMAGE_SNAPDEL = 'image.snapshotdelete';
+const IMAGE_SNAPREV = 'image.snapshotrevert';
+const IMAGE_SNAPFLAT = 'image.snapshotflatten';
+const IMAGE_INFO = 'image.info';
+const IMAGE_LOCK = 'image.lock';
+const IMAGE_UNLOCK = 'image.unlock';
+const IMAGE_POOL_INFO = 'imagepool.info';
+
+const Actions = {
+ IMAGE_ALLOCATE,
+ IMAGE_CLONE,
+ IMAGE_DELETE,
+ IMAGE_ENABLE,
+ IMAGE_PERSISTENT,
+ IMAGE_CHTYPE,
+ IMAGE_UPDATE,
+ IMAGE_CHMOD,
+ IMAGE_CHOWN,
+ IMAGE_RENAME,
+ IMAGE_SNAPDEL,
+ IMAGE_SNAPREV,
+ IMAGE_SNAPFLAT,
+ IMAGE_INFO,
+ IMAGE_LOCK,
+ IMAGE_UNLOCK,
+ IMAGE_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [IMAGE_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ },
+ datastore: {
+ from: postBody,
+ default: 0
+ },
+ capacity: {
+ from: postBody,
+ default: false
+ }
}
- }
- },
- 'image.clone': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
- },
- datastore: {
- from: postBody,
- default: -1
+ },
+ [IMAGE_CLONE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ },
+ datastore: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'image.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [IMAGE_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'image.enable': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- enable: {
- from: postBody,
- default: true
+ },
+ [IMAGE_ENABLE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ enable: {
+ from: postBody,
+ default: true
+ }
}
- }
- },
- 'image.persistent': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- persistent: {
- from: postBody,
- default: true
+ },
+ [IMAGE_PERSISTENT]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ persistent: {
+ from: postBody,
+ default: true
+ }
}
- }
- },
- 'image.chtype': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- type: {
- from: postBody,
- default: ''
+ },
+ [IMAGE_CHTYPE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ type: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'image.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [IMAGE_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'image.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
+ },
+ [IMAGE_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'image.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user: {
- from: postBody,
- default: -1
- },
- group: {
- from: postBody,
- default: -1
+ },
+ [IMAGE_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user: {
+ from: postBody,
+ default: -1
+ },
+ group: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'image.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [IMAGE_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'image.snapshotdelete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- snapshot: {
- from: postBody,
- default: 0
+ },
+ [IMAGE_SNAPDEL]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ snapshot: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'image.snapshotrevert': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- snapshot: {
- from: postBody,
- default: 0
+ },
+ [IMAGE_SNAPREV]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ snapshot: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'image.snapshotflatten': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- snapshot: {
- from: postBody,
- default: 0
+ },
+ [IMAGE_SNAPFLAT]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ snapshot: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'image.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [IMAGE_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'image.lock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- lock: {
- from: postBody,
- default: 4
+ },
+ [IMAGE_LOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ lock: {
+ from: postBody,
+ default: 4
+ }
}
- }
- },
- 'image.unlock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [IMAGE_UNLOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'imagepool.info': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -1
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
+ },
+ [IMAGE_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -1
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/index.js b/src/fireedge/src/utils/constants/commands/index.js
index 14a473194a..0876de9dd6 100644
--- a/src/fireedge/src/utils/constants/commands/index.js
+++ b/src/fireedge/src/utils/constants/commands/index.js
@@ -13,47 +13,48 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-const { from, httpMethod } = require('../defaults');
-const acl = require('./acl');
-const cluster = require('./cluster');
-const datastore = require('./datastore');
-const document = require('./document');
-const group = require('./group');
-const groupsec = require('./groupsec');
-const hook = require('./hook');
-const host = require('./host');
-const image = require('./image');
-const market = require('./market');
-const system = require('./system');
-const template = require('./template');
-const user = require('./user');
-const vdc = require('./vdc');
-const vm = require('./vm');
-const vmgroup = require('./vmgroup');
-const vn = require('./vn');
-const vntemplate = require('./vntemplate');
-const vrouter = require('./vrouter');
-const zone = require('./zone');
+const { Commands: acl } = require('./acl');
+const { Commands: cluster } = require('./cluster');
+const { Commands: datastore } = require('./datastore');
+const { Commands: document } = require('./document');
+const { Commands: group } = require('./group');
+const { Commands: secgroup } = require('./secgroup');
+const { Commands: hook } = require('./hook');
+const { Commands: host } = require('./host');
+const { Commands: image } = require('./image');
+const { Commands: market } = require('./market');
+const { Commands: marketapp } = require('./marketapp');
+const { Commands: system } = require('./system');
+const { Commands: template } = require('./template');
+const { Commands: user } = require('./user');
+const { Commands: vdc } = require('./vdc');
+const { Commands: vm } = require('./vm');
+const { Commands: vmgroup } = require('./vmgroup');
+const { Commands: vn } = require('./vn');
+const { Commands: vntemplate } = require('./vntemplate');
+const { Commands: vrouter } = require('./vrouter');
+const { Commands: zone } = require('./zone');
module.exports = {
- ...acl(from, httpMethod),
- ...cluster(from, httpMethod),
- ...datastore(from, httpMethod),
- ...document(from, httpMethod),
- ...group(from, httpMethod),
- ...groupsec(from, httpMethod),
- ...hook(from, httpMethod),
- ...host(from, httpMethod),
- ...image(from, httpMethod),
- ...market(from, httpMethod),
- ...system(from, httpMethod),
- ...template(from, httpMethod),
- ...user(from, httpMethod),
- ...vdc(from, httpMethod),
- ...vm(from, httpMethod),
- ...vmgroup(from, httpMethod),
- ...vn(from, httpMethod),
- ...vntemplate(from, httpMethod),
- ...vrouter(from, httpMethod),
- ...zone(from, httpMethod)
+ ...acl,
+ ...cluster,
+ ...datastore,
+ ...document,
+ ...group,
+ ...secgroup,
+ ...hook,
+ ...host,
+ ...image,
+ ...market,
+ ...marketapp,
+ ...system,
+ ...template,
+ ...user,
+ ...vdc,
+ ...vm,
+ ...vmgroup,
+ ...vn,
+ ...vntemplate,
+ ...vrouter,
+ ...zone
};
diff --git a/src/fireedge/src/utils/constants/commands/market.js b/src/fireedge/src/utils/constants/commands/market.js
index 3bc600edc4..177f27d4d6 100644
--- a/src/fireedge/src/utils/constants/commands/market.js
+++ b/src/fireedge/src/utils/constants/commands/market.js
@@ -13,329 +13,168 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'market.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const MARKET_ALLOCATE = 'market.allocate';
+const MARKET_DELETE = 'market.delete';
+const MARKET_UPDATE = 'market.update';
+const MARKET_CHMOD = 'market.chmod';
+const MARKET_CHOWN = 'market.chown';
+const MARKET_RENAME = 'market.rename';
+const MARKET_INFO = 'market.info';
+const MARKET_POOL_INFO = 'marketpool.info';
+
+const Actions = {
+ MARKET_ALLOCATE,
+ MARKET_DELETE,
+ MARKET_UPDATE,
+ MARKET_CHMOD,
+ MARKET_CHOWN,
+ MARKET_RENAME,
+ MARKET_INFO,
+ MARKET_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [MARKET_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'market.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [MARKET_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'market.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- update: {
- from: postBody,
- default: 0
+ },
+ [MARKET_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ update: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'market.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
+ },
+ [MARKET_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'market.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_id: {
- from: postBody,
- default: -1
- },
- group_id: {
- from: postBody,
- default: -1
+ },
+ [MARKET_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_id: {
+ from: postBody,
+ default: -1
+ },
+ group_id: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'market.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [MARKET_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'market.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: -1
- },
- decrypt: {
- from: query,
- default: false
- }
- }
- },
- 'marketpool.info': {
- // inspected
- httpMethod: GET,
- params: {}
- },
- 'marketapp.allocate': {
- // inspected
- httpMethod: PUT,
- params: {
- template: {
- from: postBody,
- default: ''
- },
- id: {
- from: resource,
- default: 0
- }
- }
- },
- 'marketapp.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- }
- }
- },
- 'marketapp.enable': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- enable: {
- from: postBody,
- default: true
- }
- }
- },
- 'marketapp.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
- }
- }
- },
- 'marketapp.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
- }
- }
- },
- 'marketapp.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_id: {
- from: postBody,
- default: -1
- },
- group_id: {
- from: postBody,
- default: -1
- }
- }
- },
- 'marketapp.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
- }
- }
- },
- 'marketapp.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: -1
- }
- }
- },
- 'marketapp.lock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- lock: {
- from: postBody,
- default: 4
- }
- }
- },
- 'marketapp.unlock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- }
- }
- },
- 'marketapppool.info': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -1
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
+ },
+ [MARKET_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: -1
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
+ },
+ [MARKET_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/marketapp.js b/src/fireedge/src/utils/constants/commands/marketapp.js
new file mode 100644
index 0000000000..33b946d54f
--- /dev/null
+++ b/src/fireedge/src/utils/constants/commands/marketapp.js
@@ -0,0 +1,237 @@
+/* Copyright 2002-2019, 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, PUT, DELETE }
+} = require('../defaults');
+
+const MARKETAPP_ALLOCATE = 'marketapp.allocate';
+const MARKETAPP_DELETE = 'marketapp.delete';
+const MARKETAPP_UPDATE = 'marketapp.update';
+const MARKETAPP_ENABLE = 'marketapp.enable';
+const MARKETAPP_CHMOD = 'marketapp.chmod';
+const MARKETAPP_CHOWN = 'marketapp.chown';
+const MARKETAPP_RENAME = 'marketapp.rename';
+const MARKETAPP_INFO = 'marketapp.info';
+const MARKETAPP_LOCK = 'marketapp.lock';
+const MARKETAPP_UNLOCK = 'marketapp.unlock';
+const MARKETAPP_POOL_INFO = 'marketapppool.info';
+
+const Actions = {
+ MARKETAPP_ALLOCATE,
+ MARKETAPP_DELETE,
+ MARKETAPP_UPDATE,
+ MARKETAPP_ENABLE,
+ MARKETAPP_CHMOD,
+ MARKETAPP_CHOWN,
+ MARKETAPP_RENAME,
+ MARKETAPP_INFO,
+ MARKETAPP_LOCK,
+ MARKETAPP_UNLOCK,
+ MARKETAPP_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [MARKETAPP_ALLOCATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ },
+ id: {
+ from: resource,
+ default: 0
+ }
+ }
+ },
+ [MARKETAPP_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
+ }
+ },
+ [MARKETAPP_ENABLE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ enable: {
+ from: postBody,
+ default: true
+ }
+ }
+ },
+ [MARKETAPP_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
+ }
+ },
+ [MARKETAPP_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ }
+ }
+ },
+ [MARKETAPP_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_id: {
+ from: postBody,
+ default: -1
+ },
+ group_id: {
+ from: postBody,
+ default: -1
+ }
+ }
+ },
+ [MARKETAPP_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
+ }
+ },
+ [MARKETAPP_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: -1
+ }
+ }
+ },
+ [MARKETAPP_LOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ lock: {
+ from: postBody,
+ default: 4
+ }
+ }
+ },
+ [MARKETAPP_UNLOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
+ }
+ },
+ [MARKETAPP_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -1
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ }
+ }
+ }
+ }
+};
diff --git a/src/fireedge/src/utils/constants/commands/secgroup.js b/src/fireedge/src/utils/constants/commands/secgroup.js
new file mode 100644
index 0000000000..648eac139c
--- /dev/null
+++ b/src/fireedge/src/utils/constants/commands/secgroup.js
@@ -0,0 +1,225 @@
+/* Copyright 2002-2019, 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
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ 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
+ }
+ }
+ }
+ }
+};
diff --git a/src/fireedge/src/utils/constants/commands/system.js b/src/fireedge/src/utils/constants/commands/system.js
index a314053c11..b5d2340a10 100644
--- a/src/fireedge/src/utils/constants/commands/system.js
+++ b/src/fireedge/src/utils/constants/commands/system.js
@@ -13,15 +13,30 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (_, { GET }) => ({
- 'system.version': {
- // inspected
- httpMethod: GET,
- params: {}
- },
- 'system.config': {
- // inspected
- httpMethod: GET,
- params: {}
+const {
+ httpMethod: { GET }
+} = require('../defaults');
+
+const SYSTEM_VERSION = 'system.version';
+const SYSTEM_CONFIG = 'system.config';
+
+const Actions = {
+ SYSTEM_VERSION,
+ SYSTEM_CONFIG
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [SYSTEM_VERSION]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
+ },
+ [SYSTEM_CONFIG]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
+ }
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/template.js b/src/fireedge/src/utils/constants/commands/template.js
index 1bb7dc941c..d5fb2c372a 100644
--- a/src/fireedge/src/utils/constants/commands/template.js
+++ b/src/fireedge/src/utils/constants/commands/template.js
@@ -13,236 +13,269 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'template.allocate': {
- // inspected
- httpMethod: PUT,
- params: {
- template: {
- from: postBody,
- default: ''
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const TEMPLATE_ALLOCATE = 'template.allocate';
+const TEMPLATE_CLONE = 'template.clone';
+const TEMPLATE_DELETE = 'template.delete';
+const TEMPLATE_INSTANTIATE = 'template.instantiate';
+const TEMPLATE_UPDATE = 'template.update';
+const TEMPLATE_CHMOD = 'template.chmod';
+const TEMPLATE_CHOWN = 'template.chown';
+const TEMPLATE_RENAME = 'template.rename';
+const TEMPLATE_LOCK = 'template.lock';
+const TEMPLATE_UNLOCK = 'template.unlock';
+const TEMPLATE_INFO = 'template.info';
+const TEMPLATE_POOL_INFO = 'templatepool.info';
+
+const Actions = {
+ TEMPLATE_ALLOCATE,
+ TEMPLATE_CLONE,
+ TEMPLATE_DELETE,
+ TEMPLATE_INSTANTIATE,
+ TEMPLATE_UPDATE,
+ TEMPLATE_CHMOD,
+ TEMPLATE_CHOWN,
+ TEMPLATE_RENAME,
+ TEMPLATE_LOCK,
+ TEMPLATE_UNLOCK,
+ TEMPLATE_INFO,
+ TEMPLATE_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [TEMPLATE_ALLOCATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'template.clone': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
- },
- image: {
- from: postBody,
- default: false
+ },
+ [TEMPLATE_CLONE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ },
+ image: {
+ from: postBody,
+ default: false
+ }
}
- }
- },
- 'template.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- image: {
- from: query,
- default: false
+ },
+ [TEMPLATE_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ image: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'template.instantiate': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
- },
- pending: {
- from: postBody,
- default: false
- },
- template: {
- from: postBody,
- default: ''
- },
- image: {
- from: postBody,
- default: false
+ },
+ [TEMPLATE_INSTANTIATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ },
+ pending: {
+ from: postBody,
+ default: false
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ image: {
+ from: postBody,
+ default: false
+ }
}
- }
- },
- 'template.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [TEMPLATE_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'template.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
- },
- image: {
- from: postBody,
- default: false
+ },
+ [TEMPLATE_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ },
+ image: {
+ from: postBody,
+ default: false
+ }
}
- }
- },
- 'template.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_id: {
- from: postBody,
- default: -1
- },
- group_id: {
- from: postBody,
- default: -1
+ },
+ [TEMPLATE_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_id: {
+ from: postBody,
+ default: -1
+ },
+ group_id: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'template.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [TEMPLATE_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'template.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- extended: {
- from: query,
- default: false
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [TEMPLATE_LOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ lock: {
+ from: postBody,
+ default: 4
+ }
}
- }
- },
- 'templatepool.info': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -1
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
+ },
+ [TEMPLATE_UNLOCK]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'template.lock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- lock: {
- from: postBody,
- default: 4
+ },
+ [TEMPLATE_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ extended: {
+ from: query,
+ default: false
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'template.unlock': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [TEMPLATE_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -1
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/user.js b/src/fireedge/src/utils/constants/commands/user.js
index ed6a95ae6a..499c2096cd 100644
--- a/src/fireedge/src/utils/constants/commands/user.js
+++ b/src/fireedge/src/utils/constants/commands/user.js
@@ -13,202 +13,239 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'user.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- username: {
- from: postBody,
- default: 0
- },
- password: {
- from: postBody,
- default: ''
- },
- driver: {
- from: postBody,
- default: ''
- },
- group: {
- from: postBody,
- default: []
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const USER_ALLOCATE = 'user.allocate';
+const USER_DELETE = 'user.delete';
+const USER_PASSWD = 'user.passwd';
+const USER_LOGIN = 'user.login';
+const USER_UPDATE = 'user.update';
+const USER_CHAUTH = 'user.chauth';
+const USER_QUOTA = 'user.quota';
+const USER_CHGRP = 'user.chgrp';
+const USER_ADDGROUP = 'user.addgroup';
+const USER_DELGROUP = 'user.delgroup';
+const USER_INFO = 'user.info';
+const USER_POOL_INFO = 'userpool.info';
+const USER_QUOTA_INFO = 'userquota.info';
+const USER_QUOTA_UPDATE = 'userquota.update';
+
+const Actions = {
+ USER_ALLOCATE,
+ USER_DELETE,
+ USER_PASSWD,
+ USER_LOGIN,
+ USER_UPDATE,
+ USER_CHAUTH,
+ USER_QUOTA,
+ USER_CHGRP,
+ USER_ADDGROUP,
+ USER_DELGROUP,
+ USER_INFO,
+ USER_POOL_INFO,
+ USER_QUOTA_INFO,
+ USER_QUOTA_UPDATE
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [USER_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ username: {
+ from: postBody,
+ default: 0
+ },
+ password: {
+ from: postBody,
+ default: ''
+ },
+ driver: {
+ from: postBody,
+ default: ''
+ },
+ group: {
+ from: postBody,
+ default: []
+ }
}
- }
- },
- 'user.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [USER_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'user.passwd': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- password: {
- from: postBody,
- default: ''
+ },
+ [USER_PASSWD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ password: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'user.login': {
- // inspected
- httpMethod: POST,
- params: {
- user: {
- from: postBody,
- default: ''
- },
- token: {
- from: postBody,
- default: ''
- },
- expire: {
- from: postBody,
- default: 0
- },
- gid: {
- from: postBody,
- default: -1
+ },
+ [USER_LOGIN]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ user: {
+ from: postBody,
+ default: ''
+ },
+ token: {
+ from: postBody,
+ default: ''
+ },
+ expire: {
+ from: postBody,
+ default: 0
+ },
+ gid: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'user.update': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- update: {
- from: postBody,
- default: 1
+ },
+ [USER_UPDATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ update: {
+ from: postBody,
+ default: 1
+ }
}
- }
- },
- 'user.chauth': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: postBody,
- default: 0
- },
- driver: {
- from: postBody,
- default: ''
- },
- password: {
- from: postBody,
- default: ''
+ },
+ [USER_CHAUTH]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: postBody,
+ default: 0
+ },
+ driver: {
+ from: postBody,
+ default: ''
+ },
+ password: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'user.quota': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [USER_QUOTA]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'user.chgrp': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- group: {
- from: postBody,
- default: 0
+ },
+ [USER_CHGRP]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ group: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'user.addgroup': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- group: {
- from: postBody,
- default: 0
+ },
+ [USER_ADDGROUP]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ group: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'user.delgroup': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- group: {
- from: query,
- default: 0
+ },
+ [USER_DELGROUP]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ group: {
+ from: query,
+ default: 0
+ }
}
- }
- },
- 'user.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: -1
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [USER_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: -1
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'userpool.info': {
- // inspected
- httpMethod: GET,
- params: {}
- },
- 'userquota.info': {
- // inspected
- httpMethod: GET,
- params: {}
- },
- 'userquota.update': {
- // inspected
- httpMethod: PUT,
- params: {
- template: {
- from: postBody,
- default: ''
+ },
+ [USER_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
+ },
+ [USER_QUOTA_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
+ },
+ [USER_QUOTA_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/vdc.js b/src/fireedge/src/utils/constants/commands/vdc.js
index 3e2fa44f82..4fc1d4f1b8 100644
--- a/src/fireedge/src/utils/constants/commands/vdc.js
+++ b/src/fireedge/src/utils/constants/commands/vdc.js
@@ -13,255 +13,296 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'vdc.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
- },
- cluster: {
- from: postBody,
- default: -1
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const VDC_ALLOCATE = 'vdc.allocate';
+const VDC_DELETE = 'vdc.delete';
+const VDC_UPDATE = 'vdc.update';
+const VDC_RENAME = 'vdc.rename';
+const VDC_ADDGROUP = 'vdc.addgroup';
+const VDC_DELGROUP = 'vdc.delgroup';
+const VDC_ADDCLUSTER = 'vdc.addcluster';
+const VDC_DELCLUSTER = 'vdc.delcluster';
+const VDC_ADDHOST = 'vdc.addhost';
+const VDC_DELHOST = 'vdc.delhost';
+const VDC_ADDDATASTORE = 'vdc.adddatastore';
+const VDC_DELDATASTORE = 'vdc.deldatastore';
+const VDC_ADDVNET = 'vdc.addvnet';
+const VDC_DELVNET = 'vdc.delvnet';
+const VDC_INFO = 'vdc.info';
+const VDC_POOL_INFO = 'vdcpool.info';
+
+const Actions = {
+ VDC_ALLOCATE,
+ VDC_DELETE,
+ VDC_UPDATE,
+ VDC_RENAME,
+ VDC_ADDGROUP,
+ VDC_DELGROUP,
+ VDC_ADDCLUSTER,
+ VDC_DELCLUSTER,
+ VDC_ADDHOST,
+ VDC_DELHOST,
+ VDC_ADDDATASTORE,
+ VDC_DELDATASTORE,
+ VDC_ADDVNET,
+ VDC_DELVNET,
+ VDC_INFO,
+ VDC_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [VDC_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ },
+ cluster: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vdc.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [VDC_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vdc.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [VDC_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vdc.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [VDC_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vdc.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: -1
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [VDC_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: -1
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'vdcpool.info': {
- // inspected
- httpMethod: GET,
- params: {}
- },
- 'vdc.addgroup': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- group: {
- from: postBody,
- default: 0
+ },
+ [VDC_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
+ },
+ [VDC_ADDGROUP]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ group: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vdc.delgroup': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- group: {
- from: query,
- default: 0
+ },
+ [VDC_DELGROUP]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ group: {
+ from: query,
+ default: 0
+ }
}
- }
- },
- 'vdc.addcluster': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- zone: {
- from: postBody,
- default: 0
- },
- cluster: {
- from: postBody,
- default: 0
+ },
+ [VDC_ADDCLUSTER]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ zone: {
+ from: postBody,
+ default: 0
+ },
+ cluster: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vdc.delcluster': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- zone: {
- from: query,
- default: 0
- },
- cluster: {
- from: query,
- default: 0
+ },
+ [VDC_DELCLUSTER]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ zone: {
+ from: query,
+ default: 0
+ },
+ cluster: {
+ from: query,
+ default: 0
+ }
}
- }
- },
- 'vdc.addhost': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- zone: {
- from: postBody,
- default: 0
- },
- host: {
- from: postBody,
- default: 0
+ },
+ [VDC_ADDHOST]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ zone: {
+ from: postBody,
+ default: 0
+ },
+ host: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vdc.delhost': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- zone: {
- from: postBody,
- default: 0
- },
- host: {
- from: postBody,
- default: 0
+ },
+ [VDC_DELHOST]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ zone: {
+ from: postBody,
+ default: 0
+ },
+ host: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vdc.adddatastore': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- zone: {
- from: postBody,
- default: 0
- },
- datastore: {
- from: postBody,
- default: 0
+ },
+ [VDC_ADDDATASTORE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ zone: {
+ from: postBody,
+ default: 0
+ },
+ datastore: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vdc.deldatastore': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- zone: {
- from: postBody,
- default: 0
- },
- datastore: {
- from: postBody,
- default: 0
+ },
+ [VDC_DELDATASTORE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ zone: {
+ from: postBody,
+ default: 0
+ },
+ datastore: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vdc.addvnet': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- zone: {
- from: postBody,
- default: 0
- },
- vnet: {
- from: postBody,
- default: 0
+ },
+ [VDC_ADDVNET]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ zone: {
+ from: postBody,
+ default: 0
+ },
+ vnet: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vdc.delvnet': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- zone: {
- from: query,
- default: 0
- },
- vnet: {
- from: query,
- default: 0
+ },
+ [VDC_DELVNET]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ zone: {
+ from: query,
+ default: 0
+ },
+ vnet: {
+ from: query,
+ default: 0
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/vm.js b/src/fireedge/src/utils/constants/commands/vm.js
index b6cc6f9d3d..21d7d752fe 100644
--- a/src/fireedge/src/utils/constants/commands/vm.js
+++ b/src/fireedge/src/utils/constants/commands/vm.js
@@ -13,624 +13,701 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'vm.allocate': {
- // inspected
- httpMethod: PUT,
- params: {
- template: {
- from: postBody,
- default: ''
- },
- status: {
- from: postBody,
- default: false
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const VM_ALLOCATE = 'vm.allocate';
+const VM_DEPLOY = 'vm.deploy';
+const VM_ACTION = 'vm.action';
+const VM_MIGRATE = 'vm.migrate';
+const VM_CHMOD = 'vm.chmod';
+const VM_CHOWN = 'vm.chown';
+const VM_RENAME = 'vm.rename';
+const VM_SNAP_CREATE = 'vm.snapshotcreate';
+const VM_SNAP_REVERT = 'vm.snapshotrevert';
+const VM_SNAP_DELETE = 'vm.snapshotdelete';
+const VM_RESIZE = 'vm.resize';
+const VM_UPDATE = 'vm.update';
+const VM_CONF_UPDATE = 'vm.updateconf';
+const VM_RECOVER = 'vm.recover';
+const VM_INFO = 'vm.info';
+const VM_MONITORING = 'vm.monitoring';
+const VM_LOCK = 'vm.lock';
+const VM_UNLOCK = 'vm.unlock';
+const VM_DISK_SAVEAS = 'vm.disksaveas';
+const VM_DISK_SNAP_CREATE = 'vm.disksnapshotcreate';
+const VM_DISK_SNAP_DELETE = 'vm.disksnapshotdelete';
+const VM_DISK_SNAP_REVERT = 'vm.disksnapshotrevert';
+const VM_DISK_SNAP_RENAME = 'vm.disksnapshotrename';
+const VM_DISK_ATTACH = 'vm.attach';
+const VM_DISK_DETACH = 'vm.detach';
+const VM_DISK_RESIZE = 'vm.diskresize';
+const VM_NIC_ATTACH = 'vm.attachnic';
+const VM_NIC_DETACH = 'vm.detachnic';
+const VM_POOL_INFO = 'vmpool.info';
+const VM_POOL_INFO_EXTENDED = 'vmpool.infoextended';
+const VM_POOL_MONITORING = 'vmpool.monitoring';
+const VM_POOL_ACCOUNTING = 'vmpool.accounting';
+const VM_POOL_SHOWBACK = 'vmpool.showback';
+const VM_POOL_CALCULATE_SHOWBACK = 'vmpool.calculateshowback';
+
+const Actions = {
+ VM_ALLOCATE,
+ VM_DEPLOY,
+ VM_ACTION,
+ VM_MIGRATE,
+ VM_CHMOD,
+ VM_CHOWN,
+ VM_RENAME,
+ VM_SNAP_CREATE,
+ VM_SNAP_REVERT,
+ VM_SNAP_DELETE,
+ VM_RESIZE,
+ VM_UPDATE,
+ VM_CONF_UPDATE,
+ VM_RECOVER,
+ VM_INFO,
+ VM_MONITORING,
+ VM_LOCK,
+ VM_UNLOCK,
+ VM_DISK_SAVEAS,
+ VM_DISK_SNAP_CREATE,
+ VM_DISK_SNAP_DELETE,
+ VM_DISK_SNAP_REVERT,
+ VM_DISK_SNAP_RENAME,
+ VM_DISK_ATTACH,
+ VM_DISK_DETACH,
+ VM_DISK_RESIZE,
+ VM_NIC_ATTACH,
+ VM_NIC_DETACH,
+ VM_POOL_INFO,
+ VM_POOL_INFO_EXTENDED,
+ VM_POOL_MONITORING,
+ VM_POOL_ACCOUNTING,
+ VM_POOL_SHOWBACK,
+ VM_POOL_CALCULATE_SHOWBACK
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [VM_ALLOCATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ },
+ status: {
+ from: postBody,
+ default: false
+ }
}
- }
- },
- 'vm.deploy': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- host: {
- from: postBody,
- default: 0
- },
- enforce: {
- from: postBody,
- default: false
- },
- datastore: {
- from: postBody,
- default: -1
+ },
+ [VM_DEPLOY]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ host: {
+ from: postBody,
+ default: 0
+ },
+ enforce: {
+ from: postBody,
+ default: false
+ },
+ datastore: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vm.action': {
- // inspected
- httpMethod: PUT,
- params: {
- action: {
- from: postBody,
- default: 'stop'
- },
- id: {
- from: resource,
- default: 0
+ },
+ [VM_ACTION]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ action: {
+ from: postBody,
+ default: 'stop'
+ },
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vm.migrate': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- host: {
- from: postBody,
- default: 0
- },
- livemigration: {
- from: postBody,
- default: false
- },
- enforce: {
- from: postBody,
- default: false
- },
- datastore: {
- from: postBody,
- default: 0
- },
- migration: {
- from: postBody,
- default: 0
+ },
+ [VM_MIGRATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ host: {
+ from: postBody,
+ default: 0
+ },
+ livemigration: {
+ from: postBody,
+ default: false
+ },
+ enforce: {
+ from: postBody,
+ default: false
+ },
+ datastore: {
+ from: postBody,
+ default: 0
+ },
+ migration: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vm.disksaveas': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- disk: {
- from: postBody,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
- },
- type: {
- from: postBody,
- default: ''
- },
- snapshot: {
- from: postBody,
- default: -1
+ },
+ [VM_DISK_SAVEAS]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ disk: {
+ from: postBody,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ },
+ type: {
+ from: postBody,
+ default: ''
+ },
+ snapshot: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vm.disksnapshotcreate': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- disk: {
- from: postBody,
- default: 0
- },
- description: {
- from: postBody,
- default: ''
+ },
+ [VM_DISK_SNAP_CREATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ disk: {
+ from: postBody,
+ default: 0
+ },
+ description: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vm.disksnapshotdelete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- disk: {
- from: query,
- default: 0
- },
- snapshot: {
- from: query,
- default: 0
+ },
+ [VM_DISK_SNAP_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ disk: {
+ from: query,
+ default: 0
+ },
+ snapshot: {
+ from: query,
+ default: 0
+ }
}
- }
- },
- 'vm.disksnapshotrevert': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- disk: {
- from: postBody,
- default: 0
- },
- snapshot: {
- from: postBody,
- default: 0
+ },
+ [VM_DISK_SNAP_REVERT]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ disk: {
+ from: postBody,
+ default: 0
+ },
+ snapshot: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vm.disksnapshotrename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- disk: {
- from: postBody,
- default: 0
- },
- snapshot: {
- from: postBody,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [VM_DISK_SNAP_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ disk: {
+ from: postBody,
+ default: 0
+ },
+ snapshot: {
+ from: postBody,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vm.attach': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [VM_DISK_ATTACH]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vm.detach': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- disk: {
- from: postBody,
- default: 0
+ },
+ [VM_DISK_DETACH]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ disk: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vm.diskresize': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- disk: {
- from: postBody,
- default: 0
- },
- size: {
- from: postBody,
- default: ''
+ },
+ [VM_DISK_RESIZE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ disk: {
+ from: postBody,
+ default: 0
+ },
+ size: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vm.attachnic': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [VM_NIC_ATTACH]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vm.detachnic': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- nic: {
- from: postBody,
- default: 0
+ },
+ [VM_NIC_DETACH]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ nic: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vm.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
+ },
+ [VM_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vm.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user: {
- from: postBody,
- default: -1
- },
- group: {
- from: postBody,
- default: -1
+ },
+ [VM_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user: {
+ from: postBody,
+ default: -1
+ },
+ group: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vm.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [VM_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vm.snapshotcreate': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [VM_SNAP_CREATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vm.snapshotrevert': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- snapshot: {
- from: postBody,
- default: 0
+ },
+ [VM_SNAP_REVERT]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ snapshot: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vm.snapshotdelete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- snapshot: {
- from: postBody,
- default: 0
+ },
+ [VM_SNAP_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ snapshot: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vm.resize': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- enforce: {
- from: postBody,
- default: false
+ },
+ [VM_RESIZE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ enforce: {
+ from: postBody,
+ default: false
+ }
}
- }
- },
- 'vm.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [VM_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vm.updateconf': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: resource,
- default: ''
+ },
+ [VM_CONF_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: resource,
+ default: ''
+ }
}
- }
- },
- 'vm.recover': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- operation: {
- from: postBody,
- default: 1
+ },
+ [VM_RECOVER]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ operation: {
+ from: postBody,
+ default: 1
+ }
}
- }
- },
- 'vm.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [VM_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'vm.monitoring': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [VM_MONITORING]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vm.lock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- level: {
- from: postBody,
- default: 4
+ },
+ [VM_LOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ level: {
+ from: postBody,
+ default: 4
+ }
}
- }
- },
- 'vm.unlock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [VM_UNLOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vmpool.info': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -2
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
- },
- state: {
- from: query,
- default: -2
- },
- filterbykey: {
- from: query,
- default: ''
+ },
+ [VM_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -2
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ },
+ state: {
+ from: query,
+ default: -2
+ },
+ filterbykey: {
+ from: query,
+ default: ''
+ }
}
- }
- },
- 'vmpool.infoextended': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -2
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
- },
- state: {
- from: query,
- default: -2
- },
- filterbykey: {
- from: query,
- default: ''
+ },
+ [VM_POOL_INFO_EXTENDED]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -2
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ },
+ state: {
+ from: query,
+ default: -2
+ },
+ filterbykey: {
+ from: query,
+ default: ''
+ }
}
- }
- },
- 'vmpool.monitoring': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -2
+ },
+ [VM_POOL_MONITORING]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -2
+ }
}
- }
- },
- 'vmpool.accounting': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -2
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
+ },
+ [VM_POOL_ACCOUNTING]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -2
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ }
}
- }
- },
- 'vmpool.showback': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -2
- },
- start_month: {
- filter: query,
- default: -1
- },
- start_year: {
- filter: query,
- default: -1
- },
- end_month: {
- filter: query,
- default: -1
- },
- end_year: {
- filter: query,
- default: -1
+ },
+ [VM_POOL_SHOWBACK]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -2
+ },
+ start_month: {
+ filter: query,
+ default: -1
+ },
+ start_year: {
+ filter: query,
+ default: -1
+ },
+ end_month: {
+ filter: query,
+ default: -1
+ },
+ end_year: {
+ filter: query,
+ default: -1
+ }
}
- }
- },
- 'vmpool.calculateshowback': {
- // inspected
- httpMethod: GET,
- params: {
- start_month: {
- filter: query,
- default: -1
- },
- start_year: {
- filter: query,
- default: -1
- },
- end_month: {
- filter: query,
- default: -1
- },
- end_year: {
- filter: query,
- default: -1
+ },
+ [VM_POOL_CALCULATE_SHOWBACK]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ start_month: {
+ filter: query,
+ default: -1
+ },
+ start_year: {
+ filter: query,
+ default: -1
+ },
+ end_month: {
+ filter: query,
+ default: -1
+ },
+ end_year: {
+ filter: query,
+ default: -1
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/vmgroup.js b/src/fireedge/src/utils/constants/commands/vmgroup.js
index 2f9a493a53..2119843773 100644
--- a/src/fireedge/src/utils/constants/commands/vmgroup.js
+++ b/src/fireedge/src/utils/constants/commands/vmgroup.js
@@ -13,180 +13,209 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'vmgroup.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const VMGROUP_ALLOCATE = 'vmgroup.allocate';
+const VMGROUP_DELETE = 'vmgroup.delete';
+const VMGROUP_UPDATE = 'vmgroup.update';
+const VMGROUP_CHMOD = 'vmgroup.chmod';
+const VMGROUP_CHOWN = 'vmgroup.chown';
+const VMGROUP_RENAME = 'vmgroup.rename';
+const VMGROUP_INFO = 'vmgroup.info';
+const VMGROUP_LOCK = 'vmgroup.lock';
+const VMGROUP_UNLOCK = 'vmgroup.unlock';
+const VMGROUP_POOL_INFO = 'vmgrouppool.info';
+
+const Actions = {
+ VMGROUP_ALLOCATE,
+ VMGROUP_DELETE,
+ VMGROUP_UPDATE,
+ VMGROUP_CHMOD,
+ VMGROUP_CHOWN,
+ VMGROUP_RENAME,
+ VMGROUP_INFO,
+ VMGROUP_LOCK,
+ VMGROUP_UNLOCK,
+ VMGROUP_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [VMGROUP_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vmgroup.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [VMGROUP_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vmgroup.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [VMGROUP_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vmgroup.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
+ },
+ [VMGROUP_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vmgroup.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user: {
- from: postBody,
- default: -1
- },
- group: {
- from: postBody,
- default: -1
+ },
+ [VMGROUP_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user: {
+ from: postBody,
+ default: -1
+ },
+ group: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vmgroup.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- defaul: ''
+ },
+ [VMGROUP_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ defaul: ''
+ }
}
- }
- },
- 'vmgroup.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: postBody,
- default: false
+ },
+ [VMGROUP_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: postBody,
+ default: false
+ }
}
- }
- },
- 'vmgroup.lock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- lock: {
- from: postBody,
- default: 4
+ },
+ [VMGROUP_LOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ lock: {
+ from: postBody,
+ default: 4
+ }
}
- }
- },
- 'vmgroup.unlock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [VMGROUP_UNLOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vmgrouppool.info': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -1
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
+ },
+ [VMGROUP_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -1
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/vn.js b/src/fireedge/src/utils/constants/commands/vn.js
index 2c6b050921..8dee11b870 100644
--- a/src/fireedge/src/utils/constants/commands/vn.js
+++ b/src/fireedge/src/utils/constants/commands/vn.js
@@ -13,282 +13,325 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'vn.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
- },
- cluster: {
- from: postBody,
- default: -1
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const VN_ALLOCATE = 'vn.allocate';
+const VN_DELETE = 'vn.delete';
+const VN_AR_ADD = 'vn.add_ar';
+const VN_AR_RM = 'vn.rm_ar';
+const VN_AR_UPDATE = 'vn.update_ar';
+const VN_RESERVE = 'vn.reserve';
+const VN_AR_FREE = 'vn.free_ar';
+const VN_HOLD = 'vn.hold';
+const VN_RELEASE = 'vn.release';
+const VN_UPDATE = 'vn.update';
+const VN_CHMOD = 'vn.chmod';
+const VN_CHOWN = 'vn.chown';
+const VN_RENAME = 'vn.rename';
+const VN_INFO = 'vn.info';
+const VN_LOCK = 'vn.lock';
+const VN_UNLOCK = 'vn.unlock';
+const VN_POOL_INFO = 'vnpool.info';
+
+const Actions = {
+ VN_ALLOCATE,
+ VN_DELETE,
+ VN_AR_ADD,
+ VN_AR_RM,
+ VN_AR_UPDATE,
+ VN_RESERVE,
+ VN_AR_FREE,
+ VN_HOLD,
+ VN_RELEASE,
+ VN_UPDATE,
+ VN_CHMOD,
+ VN_CHOWN,
+ VN_RENAME,
+ VN_INFO,
+ VN_LOCK,
+ VN_UNLOCK,
+ VN_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [VN_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ },
+ cluster: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vn.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [VN_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vn.add_ar': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [VN_AR_ADD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vn.rm_ar': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- address: {
- from: postBody,
- default: 0
+ },
+ [VN_AR_RM]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ address: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vn.update_ar': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [VN_AR_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vn.reserve': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [VN_RESERVE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vn.free_ar': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- range: {
- from: postBody,
- default: 0
+ },
+ [VN_AR_FREE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ range: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vn.hold': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [VN_HOLD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vn.release': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [VN_RELEASE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vn.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [VN_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vn.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
+ },
+ [VN_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vn.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user: {
- from: postBody,
- default: -1
- },
- group: {
- from: postBody,
- default: -1
+ },
+ [VN_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user: {
+ from: postBody,
+ default: -1
+ },
+ group: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vn.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [VN_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vn.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [VN_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'vn.lock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- level: {
- from: postBody,
- default: 4
+ },
+ [VN_LOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ level: {
+ from: postBody,
+ default: 4
+ }
}
- }
- },
- 'vn.unlock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [VN_UNLOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vnpool.info': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -3
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
+ },
+ [VN_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -3
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/vntemplate.js b/src/fireedge/src/utils/constants/commands/vntemplate.js
index ba410681ad..5f48991015 100644
--- a/src/fireedge/src/utils/constants/commands/vntemplate.js
+++ b/src/fireedge/src/utils/constants/commands/vntemplate.js
@@ -13,212 +13,245 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'vntemplate.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const VNTEMPLATE_ALLOCATE = 'vntemplate.allocate';
+const VNTEMPLATE_CLONE = 'vntemplate.clone';
+const VNTEMPLATE_DELETE = 'vntemplate.delete';
+const VNTEMPLATE_INSTANTIATE = 'vntemplate.instantiate';
+const VNTEMPLATE_UPDATE = 'vntemplate.update';
+const VNTEMPLATE_CHMOD = 'vntemplate.chmod';
+const VNTEMPLATE_CHOWN = 'vntemplate.chown';
+const VNTEMPLATE_RENAME = 'vntemplate.rename';
+const VNTEMPLATE_INFO = 'vntemplate.info';
+const VNTEMPLATE_LOCK = 'vntemplate.lock';
+const VNTEMPLATE_UNLOCK = 'vntemplate.unlock';
+const VNTEMPLATE_POOL_INFO = 'vntemplatepool.info';
+
+const Actions = {
+ VNTEMPLATE_ALLOCATE,
+ VNTEMPLATE_CLONE,
+ VNTEMPLATE_DELETE,
+ VNTEMPLATE_INSTANTIATE,
+ VNTEMPLATE_UPDATE,
+ VNTEMPLATE_CHMOD,
+ VNTEMPLATE_CHOWN,
+ VNTEMPLATE_RENAME,
+ VNTEMPLATE_INFO,
+ VNTEMPLATE_LOCK,
+ VNTEMPLATE_UNLOCK,
+ VNTEMPLATE_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [VNTEMPLATE_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vntemplate.clone': {
- // inspected
- httpMethod: POST,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [VNTEMPLATE_CLONE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vntemplate.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [VNTEMPLATE_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vntemplate.instantiate': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [VNTEMPLATE_INSTANTIATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vntemplate.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [VNTEMPLATE_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vntemplate.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
+ },
+ [VNTEMPLATE_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vntemplate.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_id: {
- from: postBody,
- default: -1
- },
- group_id: {
- from: postBody,
- default: -1
+ },
+ [VNTEMPLATE_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_id: {
+ from: postBody,
+ default: -1
+ },
+ group_id: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vntemplate.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [VNTEMPLATE_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vntemplate.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [VNTEMPLATE_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'vntemplate.lock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- lock: {
- from: postBody,
- default: 4
+ },
+ [VNTEMPLATE_LOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ lock: {
+ from: postBody,
+ default: 4
+ }
}
- }
- },
- 'vntemplate.unlock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [VNTEMPLATE_UNLOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vntemplatepool.info': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -1
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
+ },
+ [VNTEMPLATE_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -1
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/vrouter.js b/src/fireedge/src/utils/constants/commands/vrouter.js
index 1a6f7f421b..db1ff90e7b 100644
--- a/src/fireedge/src/utils/constants/commands/vrouter.js
+++ b/src/fireedge/src/utils/constants/commands/vrouter.js
@@ -13,242 +13,277 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'vrouter.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const VROUTER_ALLOCATE = 'vrouter.allocate';
+const VROUTER_DELETE = 'vrouter.delete';
+const VROUTER_INSTANTIATE = 'vrouter.instantiate';
+const VROUTER_NIC_ATTACH = 'vrouter.attachnic';
+const VROUTER_NIC_DETACH = 'vrouter.detachnic';
+const VROUTER_UPDATE = 'vrouter.update';
+const VROUTER_CHMOD = 'vrouter.chmod';
+const VROUTER_CHOWN = 'vrouter.chown';
+const VROUTER_RENAME = 'vrouter.rename';
+const VROUTER_INFO = 'vrouter.info';
+const VROUTER_LOCK = 'vrouter.lock';
+const VROUTER_UNLOCK = 'vrouter.unlock';
+const VROUTER_POOL_INFO = 'vrouterpool.info';
+
+const Actions = {
+ VROUTER_ALLOCATE,
+ VROUTER_DELETE,
+ VROUTER_INSTANTIATE,
+ VROUTER_NIC_ATTACH,
+ VROUTER_NIC_DETACH,
+ VROUTER_UPDATE,
+ VROUTER_CHMOD,
+ VROUTER_CHOWN,
+ VROUTER_RENAME,
+ VROUTER_INFO,
+ VROUTER_LOCK,
+ VROUTER_UNLOCK,
+ VROUTER_POOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [VROUTER_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vrouter.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
- },
- images: {
- from: query,
- default: false
+ },
+ [VROUTER_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ images: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'vrouter.instantiate': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- number: {
- from: postBody,
- default: 1
- },
- template_id: {
- from: postBody,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
- },
- pending: {
- from: postBody,
- default: false
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [VROUTER_INSTANTIATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ number: {
+ from: postBody,
+ default: 1
+ },
+ template_id: {
+ from: postBody,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ },
+ pending: {
+ from: postBody,
+ default: false
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vrouter.attachnic': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
+ },
+ [VROUTER_NIC_ATTACH]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vrouter.detachnic': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- nic: {
- from: postBody,
- default: 0
+ },
+ [VROUTER_NIC_DETACH]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ nic: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'vrouter.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- update: {
- from: postBody,
- default: 1
+ },
+ [VROUTER_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ update: {
+ from: postBody,
+ default: 1
+ }
}
- }
- },
- 'vrouter.chmod': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_use: {
- from: postBody,
- default: -1
- },
- user_manage: {
- from: postBody,
- default: -1
- },
- user_admin: {
- from: postBody,
- default: -1
- },
- group_use: {
- from: postBody,
- default: -1
- },
- group_manage: {
- from: postBody,
- default: -1
- },
- group_admin: {
- from: postBody,
- default: -1
- },
- other_use: {
- from: postBody,
- default: -1
- },
- other_manage: {
- from: postBody,
- default: -1
- },
- other_admin: {
- from: postBody,
- default: -1
+ },
+ [VROUTER_CHMOD]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_use: {
+ from: postBody,
+ default: -1
+ },
+ user_manage: {
+ from: postBody,
+ default: -1
+ },
+ user_admin: {
+ from: postBody,
+ default: -1
+ },
+ group_use: {
+ from: postBody,
+ default: -1
+ },
+ group_manage: {
+ from: postBody,
+ default: -1
+ },
+ group_admin: {
+ from: postBody,
+ default: -1
+ },
+ other_use: {
+ from: postBody,
+ default: -1
+ },
+ other_manage: {
+ from: postBody,
+ default: -1
+ },
+ other_admin: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vrouter.chown': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- user_id: {
- from: postBody,
- default: -1
- },
- group_id: {
- from: postBody,
- default: -1
+ },
+ [VROUTER_CHOWN]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ user_id: {
+ from: postBody,
+ default: -1
+ },
+ group_id: {
+ from: postBody,
+ default: -1
+ }
}
- }
- },
- 'vrouter.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [VROUTER_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'vrouter.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: -1
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [VROUTER_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: -1
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
- }
- },
- 'vrouter.lock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- lock: {
- from: postBody,
- default: 4
+ },
+ [VROUTER_LOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ lock: {
+ from: postBody,
+ default: 4
+ }
}
- }
- },
- 'vrouter.unlock': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [VROUTER_UNLOCK]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'vrouterpool.info': {
- // inspected
- httpMethod: GET,
- params: {
- filter: {
- from: query,
- default: -1
- },
- start: {
- from: query,
- default: -1
- },
- end: {
- from: query,
- default: -1
+ },
+ [VROUTER_POOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ filter: {
+ from: query,
+ default: -1
+ },
+ start: {
+ from: query,
+ default: -1
+ },
+ end: {
+ from: query,
+ default: -1
+ }
}
}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/commands/zone.js b/src/fireedge/src/utils/constants/commands/zone.js
index ab45042573..255b2307c8 100644
--- a/src/fireedge/src/utils/constants/commands/zone.js
+++ b/src/fireedge/src/utils/constants/commands/zone.js
@@ -13,84 +13,107 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
-module.exports = (
- { resource, postBody, query },
- { GET, POST, PUT, DELETE }
-) => ({
- 'zone.allocate': {
- // inspected
- httpMethod: POST,
- params: {
- template: {
- from: postBody,
- default: ''
+const {
+ from: { resource, postBody, query },
+ httpMethod: { GET, POST, PUT, DELETE }
+} = require('../defaults');
+
+const ZONE_ALLOCATE = 'zone.allocate';
+const ZONE_DELETE = 'zone.delete';
+const ZONE_UPDATE = 'zone.update';
+const ZONE_RENAME = 'zone.rename';
+const ZONE_INFO = 'zone.info';
+const ZONE_RAFTSTATUS = 'zone.raftstatus';
+const ZONEPOOL_INFO = 'zonepool.info';
+
+const Actions = {
+ ZONE_ALLOCATE,
+ ZONE_DELETE,
+ ZONE_UPDATE,
+ ZONE_RENAME,
+ ZONE_INFO,
+ ZONE_RAFTSTATUS,
+ ZONEPOOL_INFO
+};
+
+module.exports = {
+ Actions,
+ Commands: {
+ [ZONE_ALLOCATE]: {
+ // inspected
+ httpMethod: POST,
+ params: {
+ template: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'zone.delete': {
- // inspected
- httpMethod: DELETE,
- params: {
- id: {
- from: resource,
- default: 0
+ },
+ [ZONE_DELETE]: {
+ // inspected
+ httpMethod: DELETE,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ }
}
- }
- },
- 'zone.update': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- template: {
- from: postBody,
- default: ''
- },
- replace: {
- from: postBody,
- default: 0
+ },
+ [ZONE_UPDATE]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ template: {
+ from: postBody,
+ default: ''
+ },
+ replace: {
+ from: postBody,
+ default: 0
+ }
}
- }
- },
- 'zone.rename': {
- // inspected
- httpMethod: PUT,
- params: {
- id: {
- from: resource,
- default: 0
- },
- name: {
- from: postBody,
- default: ''
+ },
+ [ZONE_RENAME]: {
+ // inspected
+ httpMethod: PUT,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ name: {
+ from: postBody,
+ default: ''
+ }
}
- }
- },
- 'zone.info': {
- // inspected
- httpMethod: GET,
- params: {
- id: {
- from: resource,
- default: 0
- },
- decrypt: {
- from: query,
- default: false
+ },
+ [ZONE_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {
+ id: {
+ from: resource,
+ default: 0
+ },
+ decrypt: {
+ from: query,
+ default: false
+ }
}
+ },
+ [ZONE_RAFTSTATUS]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
+ },
+ [ZONEPOOL_INFO]: {
+ // inspected
+ httpMethod: GET,
+ params: {}
}
- },
- 'zone.raftstatus': {
- // inspected
- httpMethod: GET,
- params: {}
- },
- 'zonepool.info': {
- // inspected
- httpMethod: GET,
- params: {}
}
-});
+};
diff --git a/src/fireedge/src/utils/constants/index.js b/src/fireedge/src/utils/constants/index.js
index 028434a554..56e81d8d65 100644
--- a/src/fireedge/src/utils/constants/index.js
+++ b/src/fireedge/src/utils/constants/index.js
@@ -23,4 +23,4 @@ module.exports = {
httpCodes,
params,
opennebulaCommands
-};
\ No newline at end of file
+};