1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

F #3951: Add effective group login and switcher (#159)

* Fix actions and commands
* Add effective group login and switcher
* Fix sidebar component
* Fix header component and test api
* Add pool actions and system section
* Remove package lock json
This commit is contained in:
Sergio Betanzos 2020-08-20 17:28:45 +02:00 committed by GitHub
parent ddb4067fbd
commit a91b0a72ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
69 changed files with 5930 additions and 16540 deletions

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@
"@hookform/resolvers": "0.0.6",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.56",
"ace-builds": "^1.4.11",
"atob": "^2.1.2",
"axios": "^0.19.2",

View File

@ -1,18 +1,25 @@
export const CHANGE_ZONE = 'CHANGE_ZONE';
export const DISPLAY_LOADING = 'DISPLAY_LOADING';
export const TOGGLE_MENU = 'TOGGLE_MENU';
const CHANGE_ZONE = 'CHANGE_ZONE';
const DISPLAY_LOADING = 'DISPLAY_LOADING';
const TOGGLE_MENU = 'TOGGLE_MENU';
export const changeZone = zone => ({
type: CHANGE_ZONE,
payload: { zone }
});
const Actions = {
CHANGE_ZONE,
DISPLAY_LOADING,
TOGGLE_MENU
};
export const changeLoading = isLoading => ({
type: DISPLAY_LOADING,
payload: { isLoading }
});
export const openMenu = isOpen => ({
type: TOGGLE_MENU,
isOpen
});
module.exports = {
Actions,
changeZone: zone => ({
type: CHANGE_ZONE,
payload: { zone }
}),
changeLoading: isLoading => ({
type: DISPLAY_LOADING,
payload: { isLoading }
}),
openMenu: isOpen => ({
type: TOGGLE_MENU,
isOpen
})
};

View File

@ -0,0 +1,100 @@
const START_ONE_REQUEST = 'START_ONE_REQUEST';
const SUCCESS_ONE_REQUEST = 'SUCCESS_ONE_REQUEST';
const FAILURE_ONE_REQUEST = 'FAILURE_ONE_REQUEST';
const Actions = {
START_ONE_REQUEST,
SUCCESS_ONE_REQUEST,
FAILURE_ONE_REQUEST
};
module.exports = {
Actions,
setVms: vms => ({
type: SUCCESS_ONE_REQUEST,
payload: { vms }
}),
setTemplates: templates => ({
type: SUCCESS_ONE_REQUEST,
payload: { templates }
}),
setServices: services => ({
type: SUCCESS_ONE_REQUEST,
payload: { services }
}),
setDatastores: datastores => ({
type: SUCCESS_ONE_REQUEST,
payload: { datastores }
}),
setVRouters: virtualRouters => ({
type: SUCCESS_ONE_REQUEST,
payload: { virtualRouters }
}),
setVmGroups: vmGroups => ({
type: SUCCESS_ONE_REQUEST,
payload: { vmGroups }
}),
setImages: images => ({
type: SUCCESS_ONE_REQUEST,
payload: { images }
}),
setFiles: files => ({
type: SUCCESS_ONE_REQUEST,
payload: { files }
}),
setMarketplaces: marketPlaces => ({
type: SUCCESS_ONE_REQUEST,
payload: { marketPlaces }
}),
setApps: apps => ({
type: SUCCESS_ONE_REQUEST,
payload: { apps }
}),
setVNetworks: virtualNetworks => ({
type: SUCCESS_ONE_REQUEST,
payload: { virtualNetworks }
}),
setNetworkTemplates: networkTemplates => ({
type: SUCCESS_ONE_REQUEST,
payload: { networkTemplates }
}),
setSecGroups: securityGroups => ({
type: SUCCESS_ONE_REQUEST,
payload: { securityGroups }
}),
setCluster: clusters => ({
type: SUCCESS_ONE_REQUEST,
payload: { clusters }
}),
setHosts: hosts => ({
type: SUCCESS_ONE_REQUEST,
payload: { hosts }
}),
setZones: zones => ({
type: SUCCESS_ONE_REQUEST,
payload: { zones }
}),
setUsers: users => ({
type: SUCCESS_ONE_REQUEST,
payload: { users }
}),
setGroups: groups => ({
type: SUCCESS_ONE_REQUEST,
payload: { groups }
}),
setVdc: vdc => ({
type: SUCCESS_ONE_REQUEST,
payload: { vdc }
}),
setAcl: acl => ({
type: SUCCESS_ONE_REQUEST,
payload: { acl }
}),
startOneRequest: () => ({
type: START_ONE_REQUEST
}),
failureOneRequest: error => ({
type: FAILURE_ONE_REQUEST,
payload: { error }
})
};

View File

@ -1,40 +1,29 @@
export const LOGIN_REQUEST = 'LOGIN_REQUEST';
export const LOGIN_SUCCESS = 'LOGIN_SUCCESS';
export const LOGIN_FAILURE = 'LOGIN_FAILURE';
export const LOGOUT = 'LOGOUT';
const START_AUTH = 'START_AUTH';
const SUCCESS_AUTH = 'SUCCESS_AUTH';
const FAILURE_AUTH = 'FAILURE_AUTH';
const LOGOUT = 'LOGOUT';
export const USER_REQUEST = 'USER_REQUEST';
export const USER_SUCCESS = 'USER_SUCCESS';
export const USER_FAILURE = 'USER_FAILURE';
const Actions = {
START_AUTH,
SUCCESS_AUTH,
FAILURE_AUTH,
LOGOUT
};
export const loginRequest = () => ({
type: LOGIN_REQUEST
});
export const loginSuccess = jwt => ({
type: LOGIN_SUCCESS,
jwt
});
export const loginFailure = message => ({
type: LOGIN_FAILURE,
message
});
export const logout = () => ({
type: LOGOUT
});
export const userRequest = () => ({
type: USER_REQUEST
});
export const userSuccess = user => ({
type: USER_SUCCESS,
user
});
export const userFailure = message => ({
type: USER_FAILURE,
message
});
module.exports = {
Actions,
startAuth: () => ({
type: START_AUTH
}),
successAuth: payload => ({
type: SUCCESS_AUTH,
payload
}),
failureAuth: payload => ({
type: FAILURE_AUTH,
payload
}),
logout: () => ({
type: LOGOUT
})
};

View File

@ -1,6 +1,12 @@
import React from 'react';
import { Box, darken, lighten, makeStyles, Typography } from '@material-ui/core';
import {
Box,
darken,
lighten,
makeStyles,
Typography
} from '@material-ui/core';
import { Info as InfoIcon } from '@material-ui/icons';
import { Translate } from 'client/components/HOC';
@ -32,7 +38,7 @@ const ErrorHelper = ({ label = 'Error', ...rest }) => {
<Box className={classes.root} {...rest}>
<InfoIcon className={classes.icon} />
<Typography className={classes.text} data-cy="error-text">
<Translate word={label} />
{label}
</Typography>
</Box>
);

View File

@ -0,0 +1,77 @@
/* 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 { func } from 'prop-types';
import { MenuItem, TextField } from '@material-ui/core';
import { FilterVintage } from '@material-ui/icons';
import useAuth from 'client/hooks/useAuth';
import useOpennebula from 'client/hooks/useOpennebula';
import { Translate } from 'client/components/HOC';
import { FILTER_POOL } from 'client/constants';
const GroupSelect = ({ handleChange }) => {
const { filterPool, authUser } = useAuth();
const { groups } = useOpennebula();
const defaultValue = React.useMemo(
() =>
filterPool === FILTER_POOL.ALL_RESOURCES
? FILTER_POOL.ALL_RESOURCES
: authUser?.GID,
[filterPool]
);
const orderGroups = React.useMemo(
() =>
groups
?.sort((a, b) => a.ID - b.ID)
?.map(({ ID, NAME }) => (
<MenuItem key={`selector-group-${ID}`} value={String(ID)}>
{`${ID} - ${String(NAME)}`}
{authUser?.GID === ID && <FilterVintage fontSize="small" />}
</MenuItem>
)),
[groups]
);
return (
<TextField
select
fullWidth
onChange={handleChange}
defaultValue={defaultValue}
variant="outlined"
inputProps={{ 'data-cy': 'select-group' }}
label={<Translate word="Select a group" />}
FormHelperTextProps={{ 'data-cy': 'select-group-error' }}
>
<MenuItem value={FILTER_POOL.ALL_RESOURCES}>{`Show all`}</MenuItem>
{orderGroups}
</TextField>
);
};
GroupSelect.propTypes = {
handleChange: func
};
GroupSelect.defaultProps = {
handleChange: () => undefined
};
export default GroupSelect;

View File

@ -17,18 +17,20 @@ import React, { Fragment, useEffect } from 'react';
import PropTypes from 'prop-types';
import { Redirect } from 'react-router-dom';
import useAuth from 'client/hooks/auth/useAuth';
import routes from 'client/router/endpoints';
import useAuth from 'client/hooks/useAuth';
import { PATH } from 'client/router/endpoints';
const AuthLayout = ({ children }) => {
const { isLogged, getAuthUser } = useAuth();
const { isLogging, isLogged, getAuthInfo } = useAuth();
useEffect(() => {
if (isLogged) getAuthUser();
}, [isLogged, getAuthUser]);
if (isLogged && !isLogging) {
getAuthInfo();
}
}, [isLogged, isLogging]);
if (!isLogged) {
return <Redirect to={routes.login.path} />;
return <Redirect to={PATH.LOGIN} />;
}
return <Fragment>{children}</Fragment>;

View File

@ -19,14 +19,14 @@ import { Redirect } from 'react-router-dom';
import { LinearProgress } from '@material-ui/core';
import useAuth from 'client/hooks/auth/useAuth';
import routes from 'client/router/endpoints';
import useAuth from 'client/hooks/useAuth';
import { PATH } from 'client/router/endpoints';
const GuessLayout = ({ children }) => {
const { isLogged, firstRender } = useAuth();
const { isLogging, isLogged, firstRender } = useAuth();
if (isLogged) {
return <Redirect to={routes.dashboard.path} />;
if (isLogged && !isLogging) {
return <Redirect to={PATH.DASHBOARD} />;
}
if (firstRender) {

View File

@ -16,22 +16,32 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Drawer, Box, Container } from '@material-ui/core';
import { Box, Container } from '@material-ui/core';
import { Skeleton } from '@material-ui/lab';
import useAuth from 'client/hooks/useAuth';
import useOpenNebula from 'client/hooks/useOpennebula';
import Header from 'client/components/Header';
import Footer from 'client/components/Footer';
import Sidebar from 'client/components/Sidebar';
import useGeneral from 'client/hooks/useGeneral';
const InternalLayout = ({ children, title }) => {
const { isOpenMenu, openMenu } = useGeneral();
const { groups } = useOpenNebula();
const { authUser } = useAuth();
return (
const isAuthenticating = Boolean(!authUser && !groups?.length);
return isAuthenticating ? (
<Box width="100%" display="flex" flexDirection="column">
<Skeleton variant="rect" width="100%" height={64} />
<Box padding={2}>
<Skeleton variant="rect" width="50%" height={32} />
</Box>
</Box>
) : (
<Box display="flex" width="100%">
<Header title={title} />
<Drawer anchor="left" open={isOpenMenu} onClose={() => openMenu(false)}>
<Sidebar />
</Drawer>
<Sidebar />
<Container
component="main"
style={{ paddingTop: 96, paddingBottom: 96, height: '100vh' }}

View File

@ -0,0 +1,35 @@
/* 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 } from '@material-ui/core';
import { FILTER_POOL } from 'client/constants';
import useAuth from 'client/hooks/useAuth';
import GroupSelect from '../FormControl/GroupSelect';
const FilterPoolSelect = () => {
const { setPrimaryGroup } = useAuth();
const handleChangeFilter = evt => {
console.log(evt);
// setPrimaryGroup({ group: });
};
return <GroupSelect handleChange={handleChangeFilter} />;
};
export default FilterPoolSelect;

View File

@ -15,8 +15,6 @@
import React, { useState, useRef, Fragment } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { useHistory } from 'react-router-dom';
import {
Button,
@ -31,11 +29,12 @@ import {
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
import { Translate } from 'client/components/HOC';
import { SignOut, Groups } from 'client/constants';
import useAuth from 'client/hooks/auth/useAuth';
import { SignOut } from 'client/constants';
import useAuth from 'client/hooks/useAuth';
import FilterPoolSelect from './FilterPoolSelect';
const User = () => {
const { logout, authUser } = useAuth();
const { logout, authUser, isOneAdmin } = useAuth();
const [open, setOpen] = useState(false);
const anchorRef = useRef(null);
const { current } = anchorRef;
@ -98,10 +97,14 @@ const User = () => {
>
<Translate word={SignOut} />
</MenuItem>
<Divider />
<MenuItem onClick={handleClose}>
<Translate word={Groups} />
</MenuItem>
{!isOneAdmin && (
<>
<Divider />
<MenuItem>
<FilterPoolSelect />
</MenuItem>
</>
)}
</MenuList>
</ClickAwayListener>
</Paper>

View File

@ -15,41 +15,38 @@
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import {
makeStyles,
AppBar,
Toolbar,
IconButton,
Typography,
LinearProgress
Typography
} from '@material-ui/core';
import MenuIcon from '@material-ui/icons/Menu';
import useGeneral from 'client/hooks/useGeneral';
import User from './User';
import Zone from './Zone';
import User from 'client/components/Header/User';
import Zone from 'client/components/Header/Zone';
import headerStyles from 'client/components/Header/styles';
const Header = ({ title }) => {
const { isLoading, isOpenMenu, openMenu } = useGeneral();
const classes = headerStyles();
const { isOpenMenu, openMenu } = useGeneral();
return (
<AppBar position="fixed" className={classnames('header')} data-cy="header">
<AppBar position="fixed" data-cy="header">
<Toolbar>
<IconButton
onClick={() => openMenu(!isOpenMenu)}
edge="start"
className=""
color="inherit"
aria-label="menu"
>
<MenuIcon />
</IconButton>
<Typography
variant="h6"
style={{ flexGrow: 1 }}
className={classnames('title')}
className={classes.title}
data-cy="header-title"
>
{title}
@ -57,7 +54,6 @@ const Header = ({ title }) => {
<User />
<Zone />
</Toolbar>
{isLoading && <LinearProgress />}
</AppBar>
);
};

View File

@ -0,0 +1,8 @@
import { makeStyles } from '@material-ui/core';
export default makeStyles(theme => ({
title: {
flexGrow: 1,
textTransform: 'capitalize'
}
}));

View File

@ -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 && (
<ListItem key={`menu-key-${title}`}>
<ListItemText
primary={
<Link
to={path}
className={classnames(
'link',
'MuiTypography-root',
'MuiLink-root',
'MuiLink-underlineHover',
'MuiTypography-colorPrimary'
)}
>
{title.replace('_', ' ')}
</Link>
}
/>
</ListItem>
);
const routeElements = (title = '', routes = {}) => {
const internal = Object.entries(routes)?.map(
([internalTitle, internalRoutes]) =>
internalRoutes.component && routeElement(internalTitle, internalRoutes)
);
return (
internal.some(components => components !== undefined) && (
<ExpansionPanel
square
expanded={expanded === title}
onChange={handleChange(title)}
key={`menu-key-${title}`}
>
<ExpansionPanelSummary
aria-controls="panel1d-content"
id="panel1d-header"
expandIcon={<ExpandMoreIcon />}
className={classnames('link')}
>
{title.replace('_', ' ')}
</ExpansionPanelSummary>
<ExpansionPanelDetails className={classnames('internalNav')}>
<List disablePadding style={{ width: '100%' }}>
{internal}
</List>
</ExpansionPanelDetails>
</ExpansionPanel>
)
);
};
const LinkItem = React.memo(({ label, path }) => {
const history = useHistory();
return (
<div className={classnames('menu')}>
<Grid container>
<Grid item className={classnames('logo-wrapper')}>
<img
className={classnames('logo')}
src="/static/logo.png"
alt="Opennebula"
/>
</Grid>
</Grid>
<Divider />
<List>
{Object.entries(endpoints)?.map(([title, routes]) =>
routes.component
? routeElement(title, routes)
: routeElements(title, routes)
)}
</List>
</div>
<ListItem button onClick={() => history.push(path)}>
<ListItemText primary={label} />
</ListItem>
);
});
const CollapseItem = React.memo(({ label, routes }) => {
const [expanded, setExpanded] = useState(false);
const handleExpand = () => setExpanded(!expanded);
return (
<>
<ListItem button onClick={handleExpand}>
<ListItemText primary={label} />
{expanded ? <ExpandLessIcon /> : <ExpandMoreIcon />}
</ListItem>
{routes?.map((subItem, index) => (
<Collapse
key={`subitem-${index}`}
in={expanded}
timeout="auto"
unmountOnExit
>
<List component="div" disablePadding>
<LinkItem {...subItem} />
</List>
</Collapse>
))}
</>
);
});
const Sidebar = () => {
const classes = sidebarStyles();
const { isOpenMenu, openMenu } = useGeneral();
return React.useMemo(
() => (
<Drawer anchor="left" open={isOpenMenu} onClose={() => openMenu(false)}>
<div className={classes.menu}>
<Grid container>
<Grid item className={classes.logoWrapper}>
<img
className={classes.logo}
src="/static/logo.png"
alt="Opennebula"
/>
</Grid>
</Grid>
<Divider />
<List>
{endpoints
?.filter(({ authenticated = true }) => authenticated)
?.map((endpoint, index) =>
endpoint.routes ? (
<CollapseItem key={`item-${index}`} {...endpoint} />
) : (
<LinkItem key={`item-${index}`} {...endpoint} />
)
)}
</List>
</div>
</Drawer>
),
[isOpenMenu, openMenu]
);
};

View File

@ -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)
}
}));

View File

@ -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'
}
};
};

View File

@ -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 (
<Box
component="form"
className={classes?.form}
onSubmit={handleSubmit(onSubmit)}
>
<TextField
autoFocus
fullWidth
required
name="token"
label={Tr(Token2FA)}
variant="outlined"
inputRef={register}
inputProps={{ 'data-cy': 'login-token' }}
error={tokenError}
helperText={
tokenError && <ErrorHelper label={errors.token?.message || error} />
}
FormHelperTextProps={{ 'data-cy': 'login-username-error' }}
/>
<Box>
<Button onClick={onBack} color="primary">
Back
</Button>
<ButtonSubmit
data-cy="login-2fa-button"
isSubmitting={false}
label="Next"
/>
</Box>
</Box>
);
};
export default Form2fa;

View File

@ -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 (
<Box
component="form"
className={classes?.form}
onSubmit={handleSubmit(onSubmit)}
>
<Controller as={<GroupSelect />} control={control} name="group" />
<Button onClick={onBack}>Logout</Button>
<ButtonSubmit
data-cy="login-group-button"
isSubmitting={false}
label="Enter"
/>
</Box>
);
}
FormGroup.propTypes = {};
FormGroup.defaultProps = {};
export default FormGroup;

View File

@ -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 (
<Box
component="form"
className={classes?.form}
onSubmit={handleSubmit(onSubmit)}
>
<TextField
autoFocus
fullWidth
required
name="user"
label={Tr(Username)}
variant="outlined"
inputRef={register}
inputProps={{ 'data-cy': 'login-username' }}
error={userError}
helperText={
userError && <ErrorHelper label={errors.user?.message || error} />
}
FormHelperTextProps={{ 'data-cy': 'login-username-error' }}
/>
<TextField
fullWidth
required
name="pass"
type="password"
label={Tr(Password)}
variant="outlined"
inputRef={register}
inputProps={{ 'data-cy': 'login-password' }}
error={passError}
helperText={passError && <ErrorHelper label={errors.pass?.message} />}
FormHelperTextProps={{ 'data-cy': 'login-password-error' }}
/>
<FormControlLabel
control={
<Checkbox
name="remember"
defaultValue={false}
color="primary"
inputRef={register}
inputProps={{ 'data-cy': 'login-remember' }}
/>
}
label={Tr(keepLoggedIn)}
labelPlacement="end"
/>
<ButtonSubmit
data-cy="login-button"
isSubmitting={false}
label={<Translate word={SignIn} />}
/>
</Box>
);
}
FormUser.propTypes = {};
FormUser.defaultProps = {};
export default FormUser;

View File

@ -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 (
<Container component="main" maxWidth="xs" className={classes.root}>
<Paper variant="outlined" className={classes.paper}>
<Box
component="form"
className={classes.form}
onSubmit={handleSubmit(onSubmit)}
>
<img
className={classes.logo}
src="/static/logo.png"
alt="Opennebula"
/>
<TextField
autoFocus
fullWidth
required
name="user"
label={Tr(Username)}
variant="outlined"
inputRef={register}
inputProps={{ 'data-cy': 'login-username' }}
error={userError}
helperText={
userError && <ErrorHelper label={errors.user?.message || error} />
}
FormHelperTextProps={{ 'data-cy': 'login-username-error' }}
/>
<TextField
fullWidth
required
name="pass"
type="password"
label={Tr(Password)}
variant="outlined"
inputRef={register}
inputProps={{ 'data-cy': 'login-password' }}
error={passError}
helperText={
passError && <ErrorHelper label={errors.pass?.message} />
}
FormHelperTextProps={{ 'data-cy': 'login-password-error' }}
/>
<FormControlLabel
control={
<Checkbox
name="remember"
defaultValue={false}
color="primary"
inputRef={register}
inputProps={{ 'data-cy': 'login-remember' }}
/>
}
label={Tr(keepLoggedIn)}
labelPlacement="end"
/>
<ButtonSubmit
data-cy="login-button"
isSubmitting={isLoading}
label={<Translate word={SignIn} />}
/>
</Box>
</Paper>
</Container>
);
}
Login.propTypes = {};
Login.defaultProps = {};
export default Login;

View File

@ -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 (
<Container component="main" maxWidth="xs" className={classes.root}>
{isLoading && <LinearProgress style={{ width: '100%' }} />}
<Paper variant="outlined" className={classes.paper}>
<img className={classes.logo} src="/static/logo.png" alt="Opennebula" />
<Box className={classes.wrapper}>
<Slide
direction="right"
timeout={{ enter: 400 }}
in={step === STEP.USER_FORM}
appear={false}
mountOnEnter
unmountOnExit
>
<Box style={{ opacity: isLoading ? 0.7 : 1 }}>
<FormUser
classes={classes}
onSubmit={handleSubmitUser}
error={error}
/>
</Box>
</Slide>
</Box>
<Box>
<Slide
direction="left"
timeout={{ enter: 400 }}
in={step === STEP.FA2_FORM}
mountOnEnter
unmountOnExit
>
<Box style={{ opacity: isLoading ? 0.7 : 1 }}>
<Form2fa
classes={classes}
onBack={handleBack}
onSubmit={handleSubmitUser}
error={error}
/>
</Box>
</Slide>
</Box>
<Box className={classes.wrapper}>
<Slide
direction="left"
timeout={{ enter: 400 }}
in={step === STEP.GROUP_FORM}
mountOnEnter
unmountOnExit
>
<Box style={{ opacity: isLoading ? 0.7 : 1 }}>
<FormGroup
groups={groups}
classes={classes}
onBack={handleBack}
onSubmit={handleSubmitGroup}
/>
</Box>
</Slide>
</Box>
</Paper>
</Container>
);
}
Login.propTypes = {};
Login.defaultProps = {};
export default Login;

View File

@ -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'
}

View File

@ -13,10 +13,24 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
.header{
border-bottom: 2px solid $primary;
background-color: $secondary;
.title{
text-transform: capitalize;
}
}
import React from 'react';
import PropTypes from 'prop-types';
function Groups() {
return (
<div>
Groups
</div>
);
}
Groups.propTypes = {
name: PropTypes.string
};
Groups.defaultProps = {
name: ''
};
export default Groups;

View File

@ -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 (
<div>
<Card className={classes.root}>
<CardContent>
<Typography className={classes.title} gutterBottom>
Word of the Day
</Typography>
</CardContent>
</Card>
</div>
);
}
Users.propTypes = {};
Users.defaultProps = {};
export default Users;

View File

@ -0,0 +1,4 @@
import Groups from './Groups';
import Users from './Users';
export { Groups, Users };

View File

@ -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)}
/>
</Grid>
))}

View File

@ -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
};
}

View File

@ -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
};
}

View File

@ -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)), [

View File

@ -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
};
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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
}
]
}
];

View File

@ -22,39 +22,37 @@ import Error404 from 'client/containers/Error404';
import endpoints from './endpoints';
const routeElement = (
title = '',
{ path = '/', authenticated = true, component: Component }
) => (
<Route
key={`key-${title.replace(' ', '-')}`}
exact
path={path}
component={() =>
authenticated ? (
<AuthLayout>
<InternalLayout title={title.replace('_', ' ')}>
<Component />
</InternalLayout>
</AuthLayout>
) : (
<GuessLayout>
<Component />
</GuessLayout>
)
}
/>
);
function Routes() {
const renderRoute = ({
label = '',
path = '',
authenticated = true,
component: Component
}) => (
<Route
key={`key-${label.replace(' ', '-')}`}
exact
path={path}
component={() =>
authenticated ? (
<AuthLayout>
<InternalLayout title={label}>
<Component />
</InternalLayout>
</AuthLayout>
) : (
<GuessLayout>
<Component />
</GuessLayout>
)
}
/>
);
return (
<Switch>
{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)
)}
<Route component={() => <Error404 />} />
</Switch>

View File

@ -33,7 +33,6 @@ $font_secondary: red;
text-rendering: optimizeLegibility;
}
@import "header";
@import "login";
@import "footer";
@import "menu";

View File

@ -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 {

View File

@ -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
};

View File

@ -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
};

View File

@ -14,3 +14,4 @@
/* -------------------------------------------------------------------------- */
export * from './utils';
export * from './request';

View File

@ -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;
}
}
};
};

View File

@ -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);
});
};

View File

@ -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: {}
}
});
};

View File

@ -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: {}
}
});
};

View File

@ -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: {}
}
});
};

View File

@ -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
}
}
}
}
});
};

View File

@ -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: ''
}
}
}
}
});
};

View File

@ -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
}
}
}
});

View File

@ -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
}
}
}
}
});
};

View File

@ -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: {}
}
});
};

View File

@ -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
}
}
}
}
});
};

View File

@ -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
};

View File

@ -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: {}
}
}
});
};

View File

@ -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
}
}
}
}
};

View File

@ -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
}
}
}
}
};

View File

@ -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: {}
}
}
});
};

View File

@ -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
}
}
}
}
});
};

View File

@ -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: ''
}
}
}
}
});
};

View File

@ -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
}
}
}
}
});
};

File diff suppressed because it is too large Load Diff

View File

@ -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
}
}
}
}
});
};

View File

@ -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
}
}
}
}
});
};

View File

@ -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
}
}
}
}
});
};

View File

@ -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
}
}
}
}
});
};

View File

@ -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: {}
}
});
};

View File

@ -23,4 +23,4 @@ module.exports = {
httpCodes,
params,
opennebulaCommands
};
};