# 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 keystone.common.policies import base

mapping_policies = [
    policy.RuleDefault(
        name=base.IDENTITY % 'create_mapping',
        check_str=base.RULE_ADMIN_REQUIRED),
    policy.RuleDefault(
        name=base.IDENTITY % 'get_mapping',
        check_str=base.RULE_ADMIN_REQUIRED),
    policy.RuleDefault(
        name=base.IDENTITY % 'list_mappings',
        check_str=base.RULE_ADMIN_REQUIRED),
    policy.RuleDefault(
        name=base.IDENTITY % 'delete_mapping',
        check_str=base.RULE_ADMIN_REQUIRED),
    policy.RuleDefault(
        name=base.IDENTITY % 'update_mapping',
        check_str=base.RULE_ADMIN_REQUIRED)
]


def list_rules():
    return mapping_policies

@@ -638,32 +638,42 @@
  = %5B%0A    policy.
+Documented
 RuleDefault(%0A   
@@ -750,32 +750,262 @@
 E_ADMIN_REQUIRED
+,%0A        description=('Create a new federated mapping containing one or '%0A                     'more sets of rules.'),%0A        operations=%5B%7B'path': '/v3/OS-FEDERATION/mappings/%7Bmapping_id%7D',%0A                     'method': 'PUT'%7D%5D
 ),%0A    policy.Ru
@@ -994,32 +994,42 @@
 %7D%5D),%0A    policy.
+Documented
 RuleDefault(%0A   
@@ -1103,32 +1103,192 @@
 E_ADMIN_REQUIRED
+,%0A        description='Get a federated mapping.',%0A        operations=%5B%7B'path': '/v3/OS-FEDERATION/mappings/%7Bmapping_id%7D',%0A                     'method': 'GET'%7D%5D
 ),%0A    policy.Ru
@@ -1277,32 +1277,42 @@
 %7D%5D),%0A    policy.
+Documented
 RuleDefault(%0A   
@@ -1388,32 +1388,179 @@
 E_ADMIN_REQUIRED
+,%0A        description='List federated mappings.',%0A        operations=%5B%7B'path': '/v3/OS-FEDERATION/mappings',%0A                     'method': 'GET'%7D%5D
 ),%0A    policy.Ru
@@ -1549,32 +1549,42 @@
 %7D%5D),%0A    policy.
+Documented
 RuleDefault(%0A   
@@ -1669,16 +1669,182 @@
 REQUIRED
+,%0A        description='Delete a federated mapping.',%0A        operations=%5B%7B'path': '/v3/OS-FEDERATION/mappings/%7Bmapping_id%7D',%0A                     'method': 'DELETE'%7D%5D
 ),%0A    p
@@ -1849,16 +1849,26 @@
  policy.
+Documented
 RuleDefa
@@ -1961,16 +1961,181 @@
 REQUIRED
+,%0A        description='Update a federated mapping.',%0A        operations=%5B%7B'path': '/v3/OS-FEDERATION/mappings/%7Bmapping_id%7D',%0A                     'method': 'PATCH'%7D%5D
 )%0A%5D%0A%0A%0Ade

Move mapping to DocumentedRuleDefault