Best Python code snippet using localstack_python
routers.py
Source: routers.py
1# -*- coding: utf-8 -*-2# Copyright 2013 Metacloud, Inc.3# Copyright 2012 OpenStack Foundation4#5# Licensed under the Apache License, Version 2.0 (the "License"); you may6# not use this file except in compliance with the License. You may obtain7# a copy of the License at8#9# http://www.apache.org/licenses/LICENSE-2.010#11# Unless required by applicable law or agreed to in writing, software12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the14# License for the specific language governing permissions and limitations15# under the License.16"""WSGI Routers for the Assignment service."""17from keystone.assignment import controllers18from keystone.common import router19from keystone.common import wsgi20from keystone import config21class Public(wsgi.ComposableRouter):22 def add_routes(self, mapper):23 tenant_controller = controllers.Tenant()24 mapper.connect('/tenants',25 controller=tenant_controller,26 action='get_projects_for_token',27 conditions=dict(method=['GET']))28class Admin(wsgi.ComposableRouter):29 def add_routes(self, mapper):30 # Tenant Operations31 tenant_controller = controllers.Tenant()32 mapper.connect('/tenants',33 controller=tenant_controller,34 action='get_all_projects',35 conditions=dict(method=['GET']))36 mapper.connect('/tenants/{tenant_id}',37 controller=tenant_controller,38 action='get_project',39 conditions=dict(method=['GET']))40 # Role Operations41 roles_controller = controllers.Role()42 mapper.connect('/tenants/{tenant_id}/users/{user_id}/roles',43 controller=roles_controller,44 action='get_user_roles',45 conditions=dict(method=['GET']))46 mapper.connect('/users/{user_id}/roles',47 controller=roles_controller,48 action='get_user_roles',49 conditions=dict(method=['GET']))50def append_v3_routers(mapper, routers):51 routers.append(52 router.Router(controllers.DomainV3(),53 'domains', 'domain'))54 project_controller = controllers.ProjectV3()55 routers.append(56 router.Router(project_controller,57 'projects', 'project'))58 mapper.connect('/users/{user_id}/projects',59 controller=project_controller,60 action='list_user_projects',61 conditions=dict(method=['GET']))62 role_controller = controllers.RoleV3()63 routers.append(router.Router(role_controller, 'roles', 'role'))64 mapper.connect('/projects/{project_id}/users/{user_id}/roles/{role_id}',65 controller=role_controller,66 action='create_grant',67 conditions=dict(method=['PUT']))68 mapper.connect('/projects/{project_id}/groups/{group_id}/roles/{role_id}',69 controller=role_controller,70 action='create_grant',71 conditions=dict(method=['PUT']))72 mapper.connect('/projects/{project_id}/users/{user_id}/roles/{role_id}',73 controller=role_controller,74 action='check_grant',75 conditions=dict(method=['GET', 'HEAD']))76 mapper.connect('/projects/{project_id}/groups/{group_id}/roles/{role_id}',77 controller=role_controller,78 action='check_grant',79 conditions=dict(method=['GET', 'HEAD']))80 mapper.connect('/projects/{project_id}/users/{user_id}/roles',81 controller=role_controller,82 action='list_grants',83 conditions=dict(method=['GET']))84 mapper.connect('/projects/{project_id}/groups/{group_id}/roles',85 controller=role_controller,86 action='list_grants',87 conditions=dict(method=['GET']))88 mapper.connect('/projects/{project_id}/users/{user_id}/roles/{role_id}',89 controller=role_controller,90 action='revoke_grant',91 conditions=dict(method=['DELETE']))92 mapper.connect('/projects/{project_id}/groups/{group_id}/roles/{role_id}',93 controller=role_controller,94 action='revoke_grant',95 conditions=dict(method=['DELETE']))96 mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',97 controller=role_controller,98 action='create_grant',99 conditions=dict(method=['PUT']))100 mapper.connect('/domains/{domain_id}/groups/{group_id}/roles/{role_id}',101 controller=role_controller,102 action='create_grant',103 conditions=dict(method=['PUT']))104 mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',105 controller=role_controller,106 action='check_grant',107 conditions=dict(method=['GET', 'HEAD']))108 mapper.connect('/domains/{domain_id}/groups/{group_id}/roles/{role_id}',109 controller=role_controller,110 action='check_grant',111 conditions=dict(method=['GET', 'HEAD']))112 mapper.connect('/domains/{domain_id}/users/{user_id}/roles',113 controller=role_controller,114 action='list_grants',115 conditions=dict(method=['GET']))116 mapper.connect('/domains/{domain_id}/groups/{group_id}/roles',117 controller=role_controller,118 action='list_grants',119 conditions=dict(method=['GET']))120 mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',121 controller=role_controller,122 action='revoke_grant',123 conditions=dict(method=['DELETE']))124 mapper.connect('/domains/{domain_id}/groups/{group_id}/roles/{role_id}',125 controller=role_controller,126 action='revoke_grant',127 conditions=dict(method=['DELETE']))128 if config.CONF.os_inherit.enabled:129 mapper.connect(('/OS-INHERIT/domains/{domain_id}/users/{user_id}'130 '/roles/{role_id}/inherited_to_projects'),131 controller=role_controller,132 action='create_grant',133 conditions=dict(method=['PUT']))134 mapper.connect(('/OS-INHERIT/domains/{domain_id}/groups/{group_id}'135 '/roles/{role_id}/inherited_to_projects'),136 controller=role_controller,137 action='create_grant',138 conditions=dict(method=['PUT']))139 mapper.connect(('/OS-INHERIT/domains/{domain_id}/users/{user_id}'140 '/roles/{role_id}/inherited_to_projects'),141 controller=role_controller,142 action='check_grant',143 conditions=dict(method=['GET', 'HEAD']))144 mapper.connect(('/OS-INHERIT/domains/{domain_id}/groups/{group_id}'145 '/roles/{role_id}/inherited_to_projects'),146 controller=role_controller,147 action='check_grant',148 conditions=dict(method=['GET', 'HEAD']))149 mapper.connect(('/OS-INHERIT/domains/{domain_id}/users/{user_id}'150 '/roles/inherited_to_projects'),151 controller=role_controller,152 action='list_grants',153 conditions=dict(method=['GET']))154 mapper.connect(('/OS-INHERIT/domains/{domain_id}/groups/{group_id}'155 '/roles/inherited_to_projects'),156 controller=role_controller,157 action='list_grants',158 conditions=dict(method=['GET']))159 mapper.connect(('/OS-INHERIT/domains/{domain_id}/users/{user_id}'160 '/roles/{role_id}/inherited_to_projects'),161 controller=role_controller,162 action='revoke_grant',163 conditions=dict(method=['DELETE']))164 mapper.connect(('/OS-INHERIT/domains/{domain_id}/groups/{group_id}'165 '/roles/{role_id}/inherited_to_projects'),166 controller=role_controller,167 action='revoke_grant',168 conditions=dict(method=['DELETE']))169 routers.append(170 router.Router(controllers.RoleAssignmentV3(),...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!