Merge "Fixing policies inconsistencies"

This commit is contained in:
Zuul 2019-03-06 20:01:33 +00:00 committed by Gerrit Code Review
commit f5e047ec2c
32 changed files with 597 additions and 164 deletions

View File

@ -0,0 +1,12 @@
---
fixes:
- |
With APIv2 we detected some inconsistencies on the policies. This patch
updates the policy to fix those incosistencies.
other:
- |
All APIv2 policy names have been changed to the recommended format: specifically,
changes to resource names (now _singular_, whereas previously they may have been
_plural_, or otherwise inconsistent), action verbs (now fully independent of HTTP
semantics) and overall formatting (hyphens replace underscores).
Eventually, the remaining non-conforming policy names will be deprecated too.

View File

@ -25,7 +25,7 @@ rest = u.RestV2('cluster-templates', __name__)
@rest.get('/cluster-templates')
@acl.enforce("data-processing:cluster-templates:get_all")
@acl.enforce("data-processing:cluster-template:list")
@v.check_exists(api.get_cluster_template, 'marker')
@v.validate(None, v.validate_pagination_limit,
v.validate_sorting_cluster_templates)
@ -43,7 +43,7 @@ def cluster_templates_list():
@rest.post('/cluster-templates')
@acl.enforce("data-processing:cluster-templates:create")
@acl.enforce("data-processing:cluster-template:create")
@v.validate(ct_schema.CLUSTER_TEMPLATE_SCHEMA_V2,
v_ct.check_cluster_template_create)
@v.validate_request_params([])
@ -59,7 +59,7 @@ def cluster_templates_create(data):
@rest.get('/cluster-templates/<cluster_template_id>')
@acl.enforce("data-processing:cluster-templates:get")
@acl.enforce("data-processing:cluster-template:get")
@v.check_exists(api.get_cluster_template, 'cluster_template_id')
@v.validate_request_params([])
def cluster_templates_get(cluster_template_id):
@ -71,7 +71,7 @@ def cluster_templates_get(cluster_template_id):
@rest.patch('/cluster-templates/<cluster_template_id>')
@acl.enforce("data-processing:cluster-templates:modify")
@acl.enforce("data-processing:cluster-template:update")
@v.check_exists(api.get_cluster_template, 'cluster_template_id')
@v.validate(ct_schema.CLUSTER_TEMPLATE_UPDATE_SCHEMA_V2,
v_ct.check_cluster_template_update)
@ -88,7 +88,7 @@ def cluster_templates_update(cluster_template_id, data):
@rest.delete('/cluster-templates/<cluster_template_id>')
@acl.enforce("data-processing:cluster-templates:delete")
@acl.enforce("data-processing:cluster-template:delete")
@v.check_exists(api.get_cluster_template, 'cluster_template_id')
@v.validate(None, v_ct.check_cluster_template_usage)
@v.validate_request_params([])
@ -108,7 +108,7 @@ def _cluster_template_export_helper(template):
@rest.get('/cluster-templates/<cluster_template_id>/export')
@acl.enforce("data-processing:cluster-templates:get")
@acl.enforce("data-processing:cluster-template:get")
@v.check_exists(api.get_cluster_template, 'cluster_template_id')
@v.validate_request_params([])
def cluster_template_export(cluster_template_id):

View File

@ -35,7 +35,7 @@ def _replace_tenant_id_project_id_provision_steps(c):
@rest.get('/clusters')
@acl.enforce("data-processing:clusters:get_all")
@acl.enforce("data-processing:cluster:list")
@v.check_exists(api.get_cluster, 'marker')
@v.validate(None, v.validate_pagination_limit)
@v.validate_request_params(['plugin_name', 'plugin_version', 'name'])
@ -53,7 +53,7 @@ def clusters_list():
@rest.post('/clusters')
@acl.enforce("data-processing:clusters:create")
@acl.enforce("data-processing:cluster:create")
@v.validate(v_c_schema.CLUSTER_SCHEMA_V2,
v_c.check_one_or_multiple_clusters_create)
@v.validate_request_params([])
@ -76,7 +76,7 @@ def clusters_create(data):
@rest.put('/clusters/<cluster_id>')
@acl.enforce("data-processing:clusters:scale")
@acl.enforce("data-processing:cluster:scale")
@v.check_exists(api.get_cluster, 'cluster_id')
@v.validate(v_c_schema.CLUSTER_SCALING_SCHEMA_V2, v_c_s.check_cluster_scaling)
@v.validate_request_params([])
@ -90,7 +90,7 @@ def clusters_scale(cluster_id, data):
@rest.get('/clusters/<cluster_id>')
@acl.enforce("data-processing:clusters:get")
@acl.enforce("data-processing:cluster:get")
@v.check_exists(api.get_cluster, 'cluster_id')
@v.validate_request_params(['show_progress'])
def clusters_get(cluster_id):
@ -106,7 +106,7 @@ def clusters_get(cluster_id):
@rest.patch('/clusters/<cluster_id>')
@acl.enforce("data-processing:clusters:modify")
@acl.enforce("data-processing:cluster:update")
@v.check_exists(api.get_cluster, 'cluster_id')
@v.validate(v_c_schema.CLUSTER_UPDATE_SCHEMA_V2, v_c.check_cluster_update)
@v.validate_request_params([])
@ -120,7 +120,7 @@ def clusters_update(cluster_id, data):
@rest.delete('/clusters/<cluster_id>')
@acl.enforce("data-processing:clusters:delete")
@acl.enforce("data-processing:cluster:delete")
@v.check_exists(api.get_cluster, 'cluster_id')
@v.validate(v_c_schema.CLUSTER_DELETE_SCHEMA_V2, v_c.check_cluster_delete)
@v.validate_request_params([])

View File

@ -25,7 +25,7 @@ rest = u.RestV2('data-sources', __name__)
@rest.get('/data-sources')
@acl.enforce("data-processing:data-sources:get_all")
@acl.enforce("data-processing:data-source:list")
@v.check_exists(api.get_data_source, 'marker')
@v.validate(None, v.validate_pagination_limit,
v.validate_sorting_data_sources)
@ -38,7 +38,7 @@ def data_sources_list():
@rest.post('/data-sources')
@acl.enforce("data-processing:data-sources:register")
@acl.enforce("data-processing:data-source:register")
@v.validate(v_d_s_schema.DATA_SOURCE_SCHEMA, v_d_s.check_data_source_create)
@v.validate_request_params([])
def data_source_register(data):
@ -48,7 +48,7 @@ def data_source_register(data):
@rest.get('/data-sources/<data_source_id>')
@acl.enforce("data-processing:data-sources:get")
@acl.enforce("data-processing:data-source:get")
@v.check_exists(api.get_data_source, 'data_source_id')
@v.validate_request_params([])
def data_source_get(data_source_id):
@ -58,7 +58,7 @@ def data_source_get(data_source_id):
@rest.delete('/data-sources/<data_source_id>')
@acl.enforce("data-processing:data-sources:delete")
@acl.enforce("data-processing:data-source:delete")
@v.check_exists(api.get_data_source, 'data_source_id')
@v.validate_request_params([])
def data_source_delete(data_source_id):
@ -67,7 +67,7 @@ def data_source_delete(data_source_id):
@rest.patch('/data-sources/<data_source_id>')
@acl.enforce("data-processing:data-sources:modify")
@acl.enforce("data-processing:data-source:update")
@v.check_exists(api.get_data_source, 'data_source_id')
@v.validate(v_d_s_schema.DATA_SOURCE_UPDATE_SCHEMA)
@v.validate_request_params([])

View File

@ -24,7 +24,7 @@ rest = u.RestV2('images', __name__)
@rest.get('/images')
@acl.enforce("data-processing:images:get_all")
@acl.enforce("data-processing:image:list")
@v.validate_request_params(['name', 'tags', 'username'])
def images_list():
tags = u.get_request_args().getlist('tags')
@ -33,7 +33,7 @@ def images_list():
@rest.get('/images/<image_id>')
@acl.enforce("data-processing:images:get")
@acl.enforce("data-processing:image:get")
@v.check_exists(api.get_image, id='image_id')
@v.validate_request_params([])
def images_get(image_id):
@ -41,7 +41,7 @@ def images_get(image_id):
@rest.post('/images/<image_id>')
@acl.enforce("data-processing:images:register")
@acl.enforce("data-processing:image:register")
@v.check_exists(api.get_image, id='image_id')
@v.validate(v_images.image_register_schema, v_images.check_image_register)
@v.validate_request_params([])
@ -50,7 +50,7 @@ def images_set(image_id, data):
@rest.delete('/images/<image_id>')
@acl.enforce("data-processing:images:unregister")
@acl.enforce("data-processing:image:unregister")
@v.check_exists(api.get_image, id='image_id')
@v.validate_request_params([])
def images_unset(image_id):
@ -59,7 +59,7 @@ def images_unset(image_id):
@rest.get('/images/<image_id>/tags')
@acl.enforce("data-processing:images:get_tags")
@acl.enforce("data-processing:image:get-tags")
@v.check_exists(api.get_image, id='image_id')
@v.validate_request_params([])
def image_tags_get(image_id):
@ -67,7 +67,7 @@ def image_tags_get(image_id):
@rest.put('/images/<image_id>/tags', status_code=200)
@acl.enforce("data-processing:images:set_tags")
@acl.enforce("data-processing:image:set-tags")
@v.check_exists(api.get_image, id='image_id')
@v.validate(v_images.image_tags_schema, v_images.check_tags)
@v.validate_request_params([])
@ -76,7 +76,7 @@ def image_tags_update(image_id, data):
@rest.delete('/images/<image_id>/tags')
@acl.enforce("data-processing:images:remove_tags")
@acl.enforce("data-processing:image:remove-tags")
@v.check_exists(api.get_image, id='image_id')
@v.validate_request_params([])
def image_tags_delete(image_id):

View File

@ -25,7 +25,7 @@ rest = u.RestV2('job-binaries', __name__)
@rest.post('/job-binaries')
@acl.enforce("data-processing:job-binaries:create")
@acl.enforce("data-processing:job-binary:create")
@v.validate(v_j_b_schema.JOB_BINARY_SCHEMA, v_j_b.check_job_binary)
@v.validate_request_params([])
def job_binary_create(data):
@ -35,7 +35,7 @@ def job_binary_create(data):
@rest.get('/job-binaries')
@acl.enforce("data-processing:job-binaries:get_all")
@acl.enforce("data-processing:job-binary:list")
@v.check_exists(api.get_job_binary, 'marker')
@v.validate(None, v.validate_pagination_limit,
v.validate_sorting_job_binaries)
@ -48,7 +48,7 @@ def job_binary_list():
@rest.get('/job-binaries/<job_binary_id>')
@acl.enforce("data-processing:job-binaries:get")
@acl.enforce("data-processing:job-binary:get")
@v.check_exists(api.get_job_binary, 'job_binary_id')
@v.validate_request_params([])
def job_binary_get(job_binary_id):
@ -58,7 +58,7 @@ def job_binary_get(job_binary_id):
@rest.delete('/job-binaries/<job_binary_id>')
@acl.enforce("data-processing:job-binaries:delete")
@acl.enforce("data-processing:job-binary:delete")
@v.check_exists(api.get_job_binary, id='job_binary_id')
@v.validate_request_params([])
def job_binary_delete(job_binary_id):
@ -67,7 +67,7 @@ def job_binary_delete(job_binary_id):
@rest.get('/job-binaries/<job_binary_id>/data')
@acl.enforce("data-processing:job-binaries:get_data")
@acl.enforce("data-processing:job-binary:get-data")
@v.check_exists(api.get_job_binary, 'job_binary_id')
@v.validate_request_params([])
def job_binary_data(job_binary_id):
@ -78,7 +78,7 @@ def job_binary_data(job_binary_id):
@rest.patch('/job-binaries/<job_binary_id>')
@acl.enforce("data-processing:job-binaries:modify")
@acl.enforce("data-processing:job-binary:update")
@v.validate(v_j_b_schema.JOB_BINARY_UPDATE_SCHEMA, v_j_b.check_job_binary)
@v.validate_request_params([])
def job_binary_update(job_binary_id, data):

View File

@ -31,7 +31,7 @@ def _replace_tenant_id_project_id_job_binary(jb_list):
@rest.get('/job-templates')
@acl.enforce("data-processing:job-templates:get_all")
@acl.enforce("data-processing:job-template:list")
@v.check_exists(api.get_job_template, 'marker')
@v.validate(None, v.validate_pagination_limit,
v.validate_sorting_jobs)
@ -46,7 +46,7 @@ def job_templates_list():
@rest.post('/job-templates')
@acl.enforce("data-processing:job-templates:create")
@acl.enforce("data-processing:job-template:create")
@v.validate(v_j_schema.JOB_SCHEMA, v_j.check_mains_libs, v_j.check_interface)
@v.validate_request_params([])
def job_templates_create(data):
@ -58,7 +58,7 @@ def job_templates_create(data):
@rest.get('/job-templates/<job_templates_id>')
@acl.enforce("data-processing:job-templates:get")
@acl.enforce("data-processing:job-template:get")
@v.check_exists(api.get_job_template, id='job_templates_id')
@v.validate_request_params([])
def job_templates_get(job_templates_id):
@ -71,7 +71,7 @@ def job_templates_get(job_templates_id):
@rest.patch('/job-templates/<job_templates_id>')
@acl.enforce("data-processing:jobs:modify")
@acl.enforce("data-processing:job-template:update")
@v.check_exists(api.get_job_template, id='job_templates_id')
@v.validate(v_j_schema.JOB_UPDATE_SCHEMA)
@v.validate_request_params([])
@ -85,7 +85,7 @@ def job_templates_update(job_templates_id, data):
@rest.delete('/job-templates/<job_templates_id>')
@acl.enforce("data-processing:jobs:delete")
@acl.enforce("data-processing:job-template:delete")
@v.check_exists(api.get_job_template, id='job_templates_id')
@v.validate_request_params([])
def job_templates_delete(job_templates_id):
@ -94,7 +94,7 @@ def job_templates_delete(job_templates_id):
@rest.get('/job-templates/config-hints/<job_type>')
@acl.enforce("data-processing:jobs:get_config_hints")
@acl.enforce("data-processing:job-template:get-config-hints")
@v.check_exists(api.get_job_config_hints, job_type='job_type')
@v.validate_request_params([])
def job_config_hints_get(job_type):

View File

@ -23,7 +23,7 @@ rest = u.RestV2('job-types', __name__)
@rest.get('/job-types')
@acl.enforce("data-processing:job-types:get_all")
@acl.enforce("data-processing:job-type:list")
@v.validate_request_params(['type', 'plugin_name', 'plugin_version'])
def job_types_get():
# We want to use flat=False with to_dict() so that

View File

@ -32,7 +32,7 @@ def _replace_job_id_job_template_id(job_obj):
@rest.get('/jobs')
@acl.enforce("data-processing:job-executions:get_all")
@acl.enforce("data-processing:job:list")
@v.check_exists(api.get_job_execution, 'marker')
@v.validate(None, v.validate_pagination_limit,
v.validate_sorting_job_executions)
@ -50,7 +50,7 @@ def jobs_list():
@rest.post('/jobs')
@acl.enforce("data-processing:jobs:execute")
@acl.enforce("data-processing:job:execute")
@v.validate(v_j_e_schema.JOB_EXEC_SCHEMA_V2, v_j_e.check_job_execution)
@v.validate_request_params([])
def jobs_execute(data):
@ -64,7 +64,7 @@ def jobs_execute(data):
@rest.get('/jobs/<job_id>')
@acl.enforce("data-processing:job-executions:get")
@acl.enforce("data-processing:job:get")
@v.check_exists(api.get_job_execution, id='job_id')
@v.validate_request_params([])
def jobs_get(job_id):
@ -79,7 +79,7 @@ def jobs_get(job_id):
@rest.patch('/jobs/<job_id>')
@acl.enforce("data-processing:job-executions:modify")
@acl.enforce("data-processing:job:update")
@v.check_exists(api.get_job_execution, id='job_id')
@v.validate(
v_j_e_schema.JOB_EXEC_UPDATE_SCHEMA, v_j_e.check_job_execution_update)
@ -93,7 +93,7 @@ def jobs_update(job_id, data):
@rest.delete('/jobs/<job_id>')
@acl.enforce("data-processing:job-executions:delete")
@acl.enforce("data-processing:job:delete")
@v.check_exists(api.get_job_execution, id='job_id')
@v.validate(None, v_j_e.check_job_execution_delete)
@v.validate_request_params([])

View File

@ -26,7 +26,7 @@ rest = u.RestV2('node-group-templates', __name__)
@rest.get('/node-group-templates')
@acl.enforce("data-processing:node-group-templates:get_all")
@acl.enforce("data-processing:node-group-template:list")
@v.check_exists(api.get_node_group_template, 'marker')
@v.validate(None, v.validate_pagination_limit,
v.validate_sorting_node_group_templates)
@ -44,7 +44,7 @@ def node_group_templates_list():
@rest.post('/node-group-templates')
@acl.enforce("data-processing:node-group-templates:create")
@acl.enforce("data-processing:node-group-template:create")
@v.validate(ngt_schema.NODE_GROUP_TEMPLATE_SCHEMA_V2,
v_ngt.check_node_group_template_create)
@v.validate_request_params([])
@ -60,7 +60,7 @@ def node_group_templates_create(data):
@rest.get('/node-group-templates/<node_group_template_id>')
@acl.enforce("data-processing:node-group-templates:get")
@acl.enforce("data-processing:node-group-template:get")
@v.check_exists(api.get_node_group_template, 'node_group_template_id')
@v.validate_request_params([])
def node_group_templates_get(node_group_template_id):
@ -72,7 +72,7 @@ def node_group_templates_get(node_group_template_id):
@rest.patch('/node-group-templates/<node_group_template_id>')
@acl.enforce("data-processing:node-group-templates:modify")
@acl.enforce("data-processing:node-group-template:update")
@v.check_exists(api.get_node_group_template, 'node_group_template_id')
@v.validate(ngt_schema.NODE_GROUP_TEMPLATE_UPDATE_SCHEMA_V2,
v_ngt.check_node_group_template_update)
@ -89,7 +89,7 @@ def node_group_templates_update(node_group_template_id, data):
@rest.delete('/node-group-templates/<node_group_template_id>')
@acl.enforce("data-processing:node-group-templates:delete")
@acl.enforce("data-processing:node-group-template:delete")
@v.check_exists(api.get_node_group_template, 'node_group_template_id')
@v.validate(None, v_ngt.check_node_group_template_usage)
@v.validate_request_params([])
@ -111,7 +111,7 @@ def _node_group_template_export_helper(template):
@rest.get('/node-group-templates/<node_group_template_id>/export')
@acl.enforce("data-processing:node-group-templates:get")
@acl.enforce("data-processing:node-group-template:get")
@v.check_exists(api.get_node_group_template, 'node_group_template_id')
@v.validate_request_params([])
def node_group_template_export(node_group_template_id):

View File

@ -24,14 +24,14 @@ rest = u.RestV2('plugins', __name__)
@rest.get('/plugins')
@acl.enforce("data-processing:plugins:get_all")
@acl.enforce("data-processing:plugin:list")
@v.validate_request_params([])
def plugins_list():
return u.render(plugins=[p.dict for p in api.get_plugins()])
@rest.get('/plugins/<plugin_name>')
@acl.enforce("data-processing:plugins:get")
@acl.enforce("data-processing:plugin:get")
@v.check_exists(api.get_plugin, plugin_name='plugin_name')
@v.validate_request_params([])
def plugins_get(plugin_name):
@ -39,7 +39,7 @@ def plugins_get(plugin_name):
@rest.get('/plugins/<plugin_name>/<version>')
@acl.enforce("data-processing:plugins:get_version")
@acl.enforce("data-processing:plugin:get-version")
@v.check_exists(api.get_plugin, plugin_name='plugin_name', version='version')
@v.validate_request_params([])
def plugins_get_version(plugin_name, version):
@ -47,7 +47,7 @@ def plugins_get_version(plugin_name, version):
@rest.patch('/plugins/<plugin_name>')
@acl.enforce("data-processing:plugins:patch")
@acl.enforce("data-processing:plugin:update")
@v.check_exists(api.get_plugin, plugin_name='plugin_name')
@v.validate(v_p.plugin_update_validation_jsonschema(), v_p.check_plugin_update)
@v.validate_request_params([])

View File

@ -13,17 +13,26 @@
import itertools
from sahara.common.policies import base
from sahara.common.policies import cluster
from sahara.common.policies import cluster_template
from sahara.common.policies import cluster_templates
from sahara.common.policies import clusters
from sahara.common.policies import data_source
from sahara.common.policies import data_sources
from sahara.common.policies import image
from sahara.common.policies import images
from sahara.common.policies import job
from sahara.common.policies import job_binaries
from sahara.common.policies import job_binary
from sahara.common.policies import job_binary_internals
from sahara.common.policies import job_executions
from sahara.common.policies import job_templates
from sahara.common.policies import job_template
from sahara.common.policies import job_type
from sahara.common.policies import job_types
from sahara.common.policies import jobs
from sahara.common.policies import node_group_template
from sahara.common.policies import node_group_templates
from sahara.common.policies import plugin
from sahara.common.policies import plugins
@ -38,8 +47,17 @@ def list_rules():
job_binary_internals.list_rules(),
job_executions.list_rules(),
job_types.list_rules(),
job_templates.list_rules(),
jobs.list_rules(),
node_group_templates.list_rules(),
plugins.list_rules()
plugins.list_rules(),
cluster.list_rules(),
cluster_template.list_rules(),
data_source.list_rules(),
image.list_rules(),
job_binary.list_rules(),
job_type.list_rules(),
job.list_rules(),
node_group_template.list_rules(),
plugin.list_rules(),
job_template.list_rules()
)

View File

@ -19,7 +19,6 @@ DATA_PROCESSING_DATA_SOURCES = DATA_PROCESSING % 'data-sources:%s'
DATA_PROCESSING_IMAGES = DATA_PROCESSING % 'images:%s'
DATA_PROCESSING_JOB_BINARIES = DATA_PROCESSING % 'job-binaries:%s'
DATA_PROCESSING_JOB_EXECUTIONS = DATA_PROCESSING % 'job-executions:%s'
DATA_PROCESSING_JOB_TEMPLATES = DATA_PROCESSING % 'job-templates:%s'
DATA_PROCESSING_JOB_TYPES = DATA_PROCESSING % 'job-types:%s'
DATA_PROCESSING_JOBS = DATA_PROCESSING % 'jobs:%s'
DATA_PROCESSING_PLUGINS = DATA_PROCESSING % 'plugins:%s'
@ -27,6 +26,18 @@ DATA_PROCESSING_NODE_GROUP_TEMPLATES = (
DATA_PROCESSING % 'node-group-templates:%s')
DATA_PROCESSING_JOB_BINARY_INTERNALS = (
DATA_PROCESSING % 'job-binary-internals:%s')
DATA_PROCESSING_CLUSTER = DATA_PROCESSING % 'cluster:%s'
DATA_PROCESSING_CLUSTER_TEMPLATE = DATA_PROCESSING % 'cluster-template:%s'
DATA_PROCESSING_DATA_SOURCE = DATA_PROCESSING % 'data-source:%s'
DATA_PROCESSING_IMAGE = DATA_PROCESSING % 'image:%s'
DATA_PROCESSING_JOB_BINARY = DATA_PROCESSING % 'job-binary:%s'
DATA_PROCESSING_JOB_TEMPLATE = DATA_PROCESSING % 'job-template:%s'
DATA_PROCESSING_JOB_TYPE = DATA_PROCESSING % 'job-type:%s'
DATA_PROCESSING_JOB = DATA_PROCESSING % 'job:%s'
DATA_PROCESSING_PLUGIN = DATA_PROCESSING % 'plugin:%s'
DATA_PROCESSING_NODE_GROUP_TEMPLATE = (
DATA_PROCESSING % 'node-group-template:%s')
UNPROTECTED = ''
ROLE_ADMIN = 'role:admin'

View File

@ -0,0 +1,60 @@
# 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.
from oslo_policy import policy
from sahara.common.policies import base
clusters_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER % 'scale',
check_str=base.UNPROTECTED,
description='Scale cluster.',
operations=[{'path': '/v2/clusters/{cluster_id}',
'method': 'PUT'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER % 'list',
check_str=base.UNPROTECTED,
description='List available clusters',
operations=[{'path': '/v2/clusters',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER % 'create',
check_str=base.UNPROTECTED,
description='Create cluster.',
operations=[{'path': '/v2/clusters',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER % 'get',
check_str=base.UNPROTECTED,
description='Show details of a cluster.',
operations=[{'path': '/v2/clusters/{cluster_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER % 'update',
check_str=base.UNPROTECTED,
description='Updates a cluster.',
operations=[{'path': '/v2/clusters/{cluster_id}',
'method': 'PATCH'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER % 'delete',
check_str=base.UNPROTECTED,
description='Delete a cluster.',
operations=[{'path': '/v2/clusters/{cluster_id}',
'method': 'DELETE'}]),
]
def list_rules():
return clusters_policies

View File

@ -0,0 +1,57 @@
# 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.
from oslo_policy import policy
from sahara.common.policies import base
cluster_templates_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER_TEMPLATE % 'create',
check_str=base.UNPROTECTED,
description='Create cluster template.',
operations=[{'path': '/v2/cluster-templates',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER_TEMPLATE % 'delete',
check_str=base.UNPROTECTED,
description='Delete a cluster template.',
operations=[
{'path': '/v2/cluster-templates/{cluster_temp_id}',
'method': 'DELETE'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER_TEMPLATE % 'update',
check_str=base.UNPROTECTED,
description='Update cluster template.',
operations=[
{'path': '/v2/cluster-templates/{cluster_temp_id}',
'method': 'PATCH'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER_TEMPLATE % 'get',
check_str=base.UNPROTECTED,
description='Show cluster template details.',
operations=[
{'path': '/v2/cluster-templates/{cluster_temp_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER_TEMPLATE % 'list',
check_str=base.UNPROTECTED,
description='List cluster templates.',
operations=[{'path': '/v2/cluster-templates',
'method': 'GET'}]),
]
def list_rules():
return cluster_templates_policies

View File

@ -22,8 +22,6 @@ cluster_templates_policies = [
check_str=base.UNPROTECTED,
description='Create cluster template.',
operations=[{'path': '/v1.1/{project_id}/cluster-templates',
'method': 'POST'},
{'path': '/v2/cluster-templates',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER_TEMPLATES % 'delete',
@ -31,8 +29,6 @@ cluster_templates_policies = [
description='Delete a cluster template.',
operations=[
{'path': '/v1.1/{project_id}/cluster-templates/{cluster_temp_id}',
'method': 'DELETE'},
{'path': '/v2/cluster-templates/{cluster_temp_id}',
'method': 'DELETE'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER_TEMPLATES % 'modify',
@ -40,25 +36,19 @@ cluster_templates_policies = [
description='Update cluster template.',
operations=[
{'path': '/v1.1/{project_id}/cluster-templates/{cluster_temp_id}',
'method': 'PUT'},
{'path': '/v2/cluster-templates/{cluster_temp_id}',
'method': 'PATCH'}]),
'method': 'PUT'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER_TEMPLATES % 'get',
check_str=base.UNPROTECTED,
description='Show cluster template details.',
operations=[
{'path': '/v1.1/{project_id}/cluster-templates/{cluster_temp_id}',
'method': 'GET'},
{'path': '/v2/cluster-templates/{cluster_temp_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTER_TEMPLATES % 'get_all',
check_str=base.UNPROTECTED,
description='List cluster templates.',
operations=[{'path': '/v1.1/{project_id}/cluster-templates',
'method': 'GET'},
{'path': '/v2/cluster-templates',
'method': 'GET'}]),
]

View File

@ -22,48 +22,36 @@ clusters_policies = [
check_str=base.UNPROTECTED,
description='Scale cluster.',
operations=[{'path': '/v1.1/{project_id}/clusters/{cluster_id}',
'method': 'PUT'},
{'path': '/v2/clusters/{cluster_id}',
'method': 'PUT'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTERS % 'get_all',
check_str=base.UNPROTECTED,
description='List available clusters',
operations=[{'path': '/v1.1/{project_id}/clusters',
'method': 'GET'},
{'path': '/v2/clusters',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTERS % 'create',
check_str=base.UNPROTECTED,
description='Create cluster.',
operations=[{'path': '/v1.1/{project_id}/clusters',
'method': 'POST'},
{'path': '/v2/clusters',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTERS % 'get',
check_str=base.UNPROTECTED,
description='Show details of a cluster.',
operations=[{'path': '/v1.1/{project_id}/clusters/{cluster_id}',
'method': 'GET'},
{'path': '/v2/clusters/{cluster_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTERS % 'modify',
check_str=base.UNPROTECTED,
description='Modify a cluster.',
operations=[{'path': '/v1.1/{project_id}/clusters/{cluster_id}',
'method': 'PATCH'},
{'path': '/v2/clusters/{cluster_id}',
'method': 'PATCH'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_CLUSTERS % 'delete',
check_str=base.UNPROTECTED,
description='Delete a cluster.',
operations=[{'path': '/v1.1/{project_id}/clusters/{cluster_id}',
'method': 'DELETE'},
{'path': '/v2/clusters/{cluster_id}',
'method': 'DELETE'}]),
]

View File

@ -0,0 +1,57 @@
# 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.
from oslo_policy import policy
from sahara.common.policies import base
data_sources_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_DATA_SOURCE % 'list',
check_str=base.UNPROTECTED,
description='List data sources.',
operations=[{'path': '/v2/data-sources',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_DATA_SOURCE % 'get',
check_str=base.UNPROTECTED,
description='Show data source details.',
operations=[
{'path': '/v2/data-sources/{data_source_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_DATA_SOURCE % 'register',
check_str=base.UNPROTECTED,
description='Create data source.',
operations=[{'path': '/v2/data-sources',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_DATA_SOURCE % 'update',
check_str=base.UNPROTECTED,
description='Update data source.',
operations=[
{'path': '/v2/data-sources/{data_source_id}',
'method': 'PATCH'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_DATA_SOURCE % 'delete',
check_str=base.UNPROTECTED,
description='Delete data source.',
operations=[
{'path': '/v2/data-sources/{data_source_id}',
'method': 'DELETE'}]),
]
def list_rules():
return data_sources_policies

View File

@ -22,8 +22,6 @@ data_sources_policies = [
check_str=base.UNPROTECTED,
description='List data sources.',
operations=[{'path': '/v1.1/{project_id}/data-sources',
'method': 'GET'},
{'path': '/v2/data-sources',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_DATA_SOURCES % 'get',
@ -31,16 +29,12 @@ data_sources_policies = [
description='Show data source details.',
operations=[
{'path': '/v1.1/{project_id}/data-sources/{data_source_id}',
'method': 'GET'},
{'path': '/v2/data-sources/{data_source_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_DATA_SOURCES % 'register',
check_str=base.UNPROTECTED,
description='Create data source.',
operations=[{'path': '/v1.1/{project_id}/data-sources',
'method': 'POST'},
{'path': '/v2/data-sources',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_DATA_SOURCES % 'modify',
@ -48,17 +42,13 @@ data_sources_policies = [
description='Update data source.',
operations=[
{'path': '/v1.1/{project_id}/data-sources/{data_source_id}',
'method': 'PUT'},
{'path': '/v2/data-sources/{data_source_id}',
'method': 'PATCH'}]),
'method': 'PUT'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_DATA_SOURCES % 'delete',
check_str=base.UNPROTECTED,
description='Delete data source.',
operations=[
{'path': '/v1.1/{project_id}/data-sources/{data_source_id}',
'method': 'DELETE'},
{'path': '/v2/data-sources/{data_source_id}',
'method': 'DELETE'}]),
]

View File

@ -0,0 +1,65 @@
# 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.
from oslo_policy import policy
from sahara.common.policies import base
images_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGE % 'set-tags',
check_str=base.UNPROTECTED,
description='Add tags to image.',
operations=[{'path': '/v2/images/{image_id}/tags',
'method': 'PUT'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGE % 'register',
check_str=base.UNPROTECTED,
description='Register image.',
operations=[{'path': '/v2/images/{image_id}',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGE % 'list',
check_str=base.UNPROTECTED,
description='List images.',
operations=[{'path': '/v2/images', 'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGE % 'unregister',
check_str=base.UNPROTECTED,
description='Unregister image.',
operations=[{'path': '/v2/images/{image_id}',
'method': 'DELETE'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGE % 'get',
check_str=base.UNPROTECTED,
description='Show image details.',
operations=[{'path': '/v2/images/{image_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGE % 'remove-tags',
check_str=base.UNPROTECTED,
description='Remove tags from image.',
operations=[{'path': '/v2/images/{image_id}/tags',
'method': 'DELETE'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGE % 'get-tags',
check_str=base.UNPROTECTED,
description='List tags on an image.',
operations=[{'path': '/v2/images/{image_id}/tags',
'method': 'GET'}]),
]
def list_rules():
return images_policies

View File

@ -17,12 +17,6 @@ from sahara.common.policies import base
images_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGES % 'set_tags',
check_str=base.UNPROTECTED,
description='Add tags to image.',
operations=[{'path': '/v2/images/{image_id}/tags',
'method': 'PUT'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGES % 'add_tags',
check_str=base.UNPROTECTED,
@ -34,45 +28,30 @@ images_policies = [
check_str=base.UNPROTECTED,
description='Register image.',
operations=[{'path': '/v1.1/{project_id}/images/{image_id}',
'method': 'POST'},
{'path': '/v2/images/{image_id}',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGES % 'get_all',
check_str=base.UNPROTECTED,
description='List images.',
operations=[{'path': '/v1.1/{project_id}/images', 'method': 'GET'},
{'path': '/v2/images', 'method': 'GET'}]),
operations=[{'path': '/v1.1/{project_id}/images', 'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGES % 'unregister',
check_str=base.UNPROTECTED,
description='Unregister image.',
operations=[{'path': '/v1.1/{project_id}/images/{image_id}',
'method': 'POST'},
{'path': '/v2/images/{image_id}',
'method': 'DELETE'}]),
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGES % 'get',
check_str=base.UNPROTECTED,
description='Show image details.',
operations=[{'path': '/v1.1/{project_id}/images/{image_id}',
'method': 'GET'},
{'path': '/v2/images/{image_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGES % 'remove_tags',
check_str=base.UNPROTECTED,
description='Remove tags from image.',
operations=[{'path': '/v1.1/{project_id}/images/{image_id}/untag',
'method': 'POST'},
{'path': '/v2/images/{image_id}/tags',
'method': 'DELETE'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_IMAGES % 'get_tags',
check_str=base.UNPROTECTED,
description='List tags on an image.',
operations=[{'path': '/v2/images/{image_id}/tags',
'method': 'GET'}]),
'method': 'POST'}]),
]

View File

@ -0,0 +1,49 @@
# 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.
from oslo_policy import policy
from sahara.common.policies import base
job_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB % 'execute',
check_str=base.UNPROTECTED,
description='Run job.',
operations=[{'path': '/v2/jobs', 'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB % 'get',
check_str=base.UNPROTECTED,
description='Show jobs details.',
operations=[{'path': '/v2/jobs/{job_id}', 'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB % 'update',
check_str=base.UNPROTECTED,
description='Update job.',
operations=[{'path': '/v2/jobs/{job_id}', 'method': 'PATCH'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB % 'list',
check_str=base.UNPROTECTED,
description='List jobs.',
operations=[{'path': '/v2/jobs', 'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB % 'delete',
check_str=base.UNPROTECTED,
description='Delete job.',
operations=[{'path': '/v2/jobs/{job_id}', 'method': 'DELETE'}]),
]
def list_rules():
return job_policies

View File

@ -22,16 +22,12 @@ job_binaries_policies = [
check_str=base.UNPROTECTED,
description='List job binaries.',
operations=[{'path': '/v1.1/{project_id}/job-binaries',
'method': 'GET'},
{'path': '/v2/job-binaries',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARIES % 'create',
check_str=base.UNPROTECTED,
description='Create job binary.',
operations=[{'path': '/v1.1/{project_id}/job-binaries',
'method': 'POST'},
{'path': '/v2/job-binaries',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARIES % 'get_data',
@ -39,8 +35,6 @@ job_binaries_policies = [
description='Show job binary data.',
operations=[
{'path': '/v1.1/{project_id}/job-binaries/{job-binary_id}/data',
'method': 'POST'},
{'path': '/v2/job-binaries/{job-binary_id}/data',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARIES % 'modify',
@ -48,24 +42,18 @@ job_binaries_policies = [
description='Update job binary.',
operations=[
{'path': '/v1.1/{project_id}/job-binaries/{job-binary_id}',
'method': 'PUT'},
{'path': '/v2/job-binaries/{job-binary_id}',
'method': 'PATCH'}]),
'method': 'PUT'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARIES % 'get',
check_str=base.UNPROTECTED,
description='Show job binary details.',
operations=[{'path': '/v1.1/{project_id}/job-binaries/{job_binary_id}',
'method': 'GET'},
{'path': '/v2/job-binaries/{job_binary_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARIES % 'delete',
check_str=base.UNPROTECTED,
description='Delete job binary.',
operations=[{'path': '/v1.1/{project_id}/job-binaries/{job_binary_id}',
'method': 'DELETE'},
{'path': '/v2/job-binaries/{job_binary_id}',
'method': 'DELETE'}]),
]

View File

@ -0,0 +1,62 @@
# 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.
from oslo_policy import policy
from sahara.common.policies import base
job_binaries_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARY % 'list',
check_str=base.UNPROTECTED,
description='List job binaries.',
operations=[{'path': '/v2/job-binaries',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARY % 'create',
check_str=base.UNPROTECTED,
description='Create job binary.',
operations=[{'path': '/v2/job-binaries',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARY % 'get-data',
check_str=base.UNPROTECTED,
description='Show job binary data.',
operations=[
{'path': '/v2/job-binaries/{job_binary_id}/data',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARY % 'update',
check_str=base.UNPROTECTED,
description='Update job binary.',
operations=[
{'path': '/v2/job-binaries/{job_binary_id}',
'method': 'PATCH'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARY % 'get',
check_str=base.UNPROTECTED,
description='Show job binary details.',
operations=[{'path': '/v2/job-binaries/{job_binary_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_BINARY % 'delete',
check_str=base.UNPROTECTED,
description='Delete job binary.',
operations=[{'path': '/v2/job-binaries/{job_binary_id}',
'method': 'DELETE'}]),
]
def list_rules():
return job_binaries_policies

View File

@ -18,38 +18,38 @@ from sahara.common.policies import base
job_templates_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_TEMPLATES % 'get',
name=base.DATA_PROCESSING_JOB_TEMPLATE % 'get',
check_str=base.UNPROTECTED,
description='Show job template details.',
operations=[{'path': '/v2/job-templates/{job_temp_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_TEMPLATES % 'create',
name=base.DATA_PROCESSING_JOB_TEMPLATE % 'create',
check_str=base.UNPROTECTED,
description='Create job templates.',
operations=[{'path': '/v2/job-templates',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_TEMPLATES % 'get_all',
name=base.DATA_PROCESSING_JOB_TEMPLATE % 'list',
check_str=base.UNPROTECTED,
description='List job templates.',
operations=[{'path': '/v2/job-templates',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_TEMPLATES % 'modify',
name=base.DATA_PROCESSING_JOB_TEMPLATE % 'update',
check_str=base.UNPROTECTED,
description='Update job template.',
operations=[{'path': '/v2/job-templates/{job_temp_id}',
'method': 'PATCH'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_TEMPLATES % 'get_config_hints',
name=base.DATA_PROCESSING_JOB_TEMPLATE % 'get-config-hints',
check_str=base.UNPROTECTED,
description='Get job template config hints.',
operations=[
{'path': '/v2/job-templates/config-hints/{job_type}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_TEMPLATES % 'delete',
name=base.DATA_PROCESSING_JOB_TEMPLATE % 'delete',
check_str=base.UNPROTECTED,
description='Remove job template.',
operations=[{'path': '/v2/job-templates/{job_temp_id}',

View File

@ -0,0 +1,30 @@
# 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.
from oslo_policy import policy
from sahara.common.policies import base
job_types_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOB_TYPE % 'list',
check_str=base.UNPROTECTED,
description='List job types.',
operations=[{'path': '/v2/job-types',
'method': 'GET'}]),
]
def list_rules():
return job_types_policies

View File

@ -22,8 +22,6 @@ job_types_policies = [
check_str=base.UNPROTECTED,
description='List job types.',
operations=[{'path': '/v1.1/{project_id}/job-types',
'method': 'GET'},
{'path': '/v2/job-types',
'method': 'GET'}]),
]

View File

@ -22,16 +22,12 @@ jobs_policies = [
check_str=base.UNPROTECTED,
description='Run job.',
operations=[{'path': '/v1.1/{project_id}/jobs/{job_id}/execute',
'method': 'POST'},
{'path': '/v2/jobs',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOBS % 'get',
check_str=base.UNPROTECTED,
description='Show job details.',
operations=[{'path': '/v1.1/{project_id}/jobs/{job_id}',
'method': 'GET'},
{'path': '/v2/jobs/{job_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOBS % 'create',
@ -42,15 +38,12 @@ jobs_policies = [
name=base.DATA_PROCESSING_JOBS % 'get_all',
check_str=base.UNPROTECTED,
description='List jobs.',
operations=[{'path': '/v1.1/{project_id}/jobs', 'method': 'GET'},
{'path': '/v2/jobs', 'method': 'GET'}]),
operations=[{'path': '/v1.1/{project_id}/jobs', 'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOBS % 'modify',
check_str=base.UNPROTECTED,
description='Update job object.',
operations=[{'path': '/v1.1/{project_id}/jobs/{job_id}',
'method': 'PATCH'},
{'path': '/v2/jobs/{job_id}',
'method': 'PATCH'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_JOBS % 'get_config_hints',
@ -64,8 +57,6 @@ jobs_policies = [
check_str=base.UNPROTECTED,
description='Remove job.',
operations=[{'path': '/v1.1/{project_id}/jobs/{job_id}',
'method': 'DELETE'},
{'path': '/v2/jobs/{job_id}',
'method': 'DELETE'}]),
]

View File

@ -0,0 +1,57 @@
# 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.
from oslo_policy import policy
from sahara.common.policies import base
node_group_templates_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_NODE_GROUP_TEMPLATE % 'list',
check_str=base.UNPROTECTED,
description='List node group templates.',
operations=[{'path': '/v2/node-group-templates',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_NODE_GROUP_TEMPLATE % 'create',
check_str=base.UNPROTECTED,
description='Create node group template.',
operations=[{'path': '/v2/node-group-templates',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_NODE_GROUP_TEMPLATE % 'get',
check_str=base.UNPROTECTED,
description='Show node group template details.',
operations=[
{'path': '/v2/node-group-templates/{node_group_temp_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_NODE_GROUP_TEMPLATE % 'update',
check_str=base.UNPROTECTED,
description='Update node group template.',
operations=[
{'path': '/v2/node-group-templates/{node_group_temp_id}',
'method': 'PATCH'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_NODE_GROUP_TEMPLATE % 'delete',
check_str=base.UNPROTECTED,
description='Delete node group template.',
operations=[
{'path': '/v2/node-group-templates/{node_group_temp_id}',
'method': 'DELETE'}]),
]
def list_rules():
return node_group_templates_policies

View File

@ -22,16 +22,12 @@ node_group_templates_policies = [
check_str=base.UNPROTECTED,
description='List node group templates.',
operations=[{'path': '/v1.1/{project_id}/node-group-templates',
'method': 'GET'},
{'path': '/v2/node-group-templates',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_NODE_GROUP_TEMPLATES % 'create',
check_str=base.UNPROTECTED,
description='Create node group template.',
operations=[{'path': '/v1.1/{project_id}/node-group-templates',
'method': 'POST'},
{'path': '/v2/node-group-templates',
'method': 'POST'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_NODE_GROUP_TEMPLATES % 'get',
@ -40,8 +36,6 @@ node_group_templates_policies = [
operations=[
{'path':
'/v1.1/{project_id}/node-group-templates/{node_group_temp_id}',
'method': 'GET'},
{'path': '/v2/node-group-templates/{node_group_temp_id}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_NODE_GROUP_TEMPLATES % 'modify',
@ -50,9 +44,7 @@ node_group_templates_policies = [
operations=[
{'path':
'/v1.1/{project_id}/node-group-templates/{node_group_temp_id}',
'method': 'PUT'},
{'path': '/v2/node-group-templates/{node_group_temp_id}',
'method': 'PATCH'}]),
'method': 'PUT'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_NODE_GROUP_TEMPLATES % 'delete',
check_str=base.UNPROTECTED,
@ -60,8 +52,6 @@ node_group_templates_policies = [
operations=[
{'path':
'/v1.1/{project_id}/node-group-templates/{node_group_temp_id}',
'method': 'DELETE'},
{'path': '/v2/node-group-templates/{node_group_temp_id}',
'method': 'DELETE'}]),
]

View File

@ -0,0 +1,49 @@
# 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.
from oslo_policy import policy
from sahara.common.policies import base
plugins_policies = [
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_PLUGIN % 'list',
check_str=base.UNPROTECTED,
description='List plugins.',
operations=[{'path': '/v2/plugins',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_PLUGIN % 'get-version',
check_str=base.UNPROTECTED,
description='Show plugins version details.',
operations=[
{'path': '/v2/plugins/{plugin_name}/{version}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_PLUGIN % 'get',
check_str=base.UNPROTECTED,
description='Show plugin details.',
operations=[{'path': '/v2/plugins/{plugin_name}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_PLUGIN % 'update',
check_str=base.ROLE_ADMIN,
description='Update plugin details.',
operations=[{'path': '/v2/plugins/{plugin_name}',
'method': 'PATCH'}]),
]
def list_rules():
return plugins_policies

View File

@ -22,8 +22,6 @@ plugins_policies = [
check_str=base.UNPROTECTED,
description='List plugins.',
operations=[{'path': '/v1.1/{project_id}/plugins',
'method': 'GET'},
{'path': '/v2/plugins',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_PLUGINS % 'get_version',
@ -31,16 +29,12 @@ plugins_policies = [
description='Show plugins version details.',
operations=[
{'path': '/v1.1/{project_id}/plugins/{plugin_name}/{version}',
'method': 'GET'},
{'path': '/v2/plugins/{plugin_name}/{version}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_PLUGINS % 'get',
check_str=base.UNPROTECTED,
description='Show plugin details.',
operations=[{'path': '/v1.1/{project_id}/plugins/{plugin_name}',
'method': 'GET'},
{'path': '/v2/plugins/{plugin_name}',
'method': 'GET'}]),
policy.DocumentedRuleDefault(
name=base.DATA_PROCESSING_PLUGINS % 'convert_config',
@ -55,8 +49,6 @@ plugins_policies = [
check_str=base.ROLE_ADMIN,
description='Update plugin details.',
operations=[{'path': '/v1.1/{project_id}/plugins/{plugin_name}',
'method': 'PATCH'},
{'path': '/v2/plugins/{plugin_name}',
'method': 'PATCH'}]),
]