|
| 1 | +# coding=utf-8 |
| 2 | +# |
| 3 | +# Copyright 2017 F5 Networks Inc. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | + |
| 18 | + |
| 19 | +from f5.bigip.resource import Collection |
| 20 | +from f5.bigip.resource import OrganizingCollection |
| 21 | +from f5.bigip.resource import Resource |
| 22 | +from f5.sdk_exception import UnsupportedMethod |
| 23 | + |
| 24 | + |
| 25 | +class System(OrganizingCollection): |
| 26 | + def __init__(self, shared): |
| 27 | + super(System, self).__init__(shared) |
| 28 | + self._meta_data['allowed_lazy_attributes'] = [ |
| 29 | + Authn |
| 30 | + ] |
| 31 | + |
| 32 | + |
| 33 | +class Authn(OrganizingCollection): |
| 34 | + def __init__(self, system): |
| 35 | + super(Authn, self).__init__(system) |
| 36 | + self._meta_data['allowed_lazy_attributes'] = [ |
| 37 | + Providers |
| 38 | + ] |
| 39 | + |
| 40 | + |
| 41 | +class Providers(OrganizingCollection): |
| 42 | + def __init__(self, authn): |
| 43 | + super(Providers, self).__init__(authn) |
| 44 | + self._meta_data['allowed_lazy_attributes'] = [ |
| 45 | + Tmos_s |
| 46 | + ] |
| 47 | + |
| 48 | + |
| 49 | +class Tmos_s(Collection): |
| 50 | + def __init__(self, providers): |
| 51 | + super(Tmos_s, self).__init__(providers) |
| 52 | + self._meta_data['required_json_kind'] = 'cm:system:authn:providers:tmos:mcpremoteprovidercollectionstate' |
| 53 | + self._meta_data['allowed_lazy_attributes'] = [Tmos] |
| 54 | + self._meta_data['attribute_registry'] = { |
| 55 | + 'cm:system:authn:providers:tmos:mcpremoteproviderstate': Tmos |
| 56 | + } |
| 57 | + |
| 58 | + |
| 59 | +class Tmos(Resource): |
| 60 | + def __init__(self, tokens): |
| 61 | + super(Tmos, self).__init__(tokens) |
| 62 | + self._meta_data['required_json_kind'] = 'cm:system:authn:providers:tmos:mcpremoteproviderstate' |
| 63 | + self._meta_data['required_load_parameters'] = set(('id',)) |
| 64 | + |
| 65 | + def create(self, **kwargs): |
| 66 | + raise UnsupportedMethod( |
| 67 | + "Only a single remote mcp auth provider allowed." |
| 68 | + ) |
| 69 | + |
| 70 | + def update(self, **kwargs): |
| 71 | + # You can technically do this, but it will really screw up the system |
| 72 | + raise UnsupportedMethod |
| 73 | + |
| 74 | + def modify(self, **kwargs): |
| 75 | + # You can technically do this, but it will really screw up the system |
| 76 | + raise UnsupportedMethod |
| 77 | + |
| 78 | + def delete(self, **kwargs): |
| 79 | + # You can technically do this, but it will really screw up the system |
| 80 | + raise UnsupportedMethod |
0 commit comments