"Fossies" - the Fresh Open Source Software Archive

Member "solum-12.0.0/solum/api/controllers/camp/v1_1/datamodel/parameter_definitions.py" (30 Mar 2022, 1832 Bytes) of package /linux/misc/openstack/solum-12.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "parameter_definitions.py" see the Fossies "Dox" file reference documentation.

    1 #
    2 # Licensed under the Apache License, Version 2.0 (the "License"); you may
    3 # not use this file except in compliance with the License. You may obtain
    4 # a copy of the License at
    5 #
    6 #      http://www.apache.org/licenses/LICENSE-2.0
    7 #
    8 # Unless required by applicable law or agreed to in writing, software
    9 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   10 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   11 # License for the specific language governing permissions and limitations
   12 # under the License.
   13 
   14 import copy
   15 
   16 from wsme import types as wtypes
   17 
   18 from solum.api.controllers.camp.v1_1 import uris
   19 from solum.api.controllers import common_types
   20 from solum.api.controllers.v1.datamodel import types as api_types
   21 
   22 
   23 class ParameterDefinitionLink(common_types.Link):
   24     """CAMP v1.1 ParameterLink attribute type."""
   25 
   26     required = bool
   27     """Indicates whether the parameter referenced by this Link is required."""
   28 
   29     default_value = wtypes.Base
   30     """Default value for the parameter referenced by this Link."""
   31 
   32 
   33 class ParameterDefinitions(api_types.Base):
   34     """CAMP v1.1 parameter_definitions resource model."""
   35 
   36     parameter_definition_links = [ParameterDefinitionLink]
   37     """The value of the parameter_definition_links attribute is an array of
   38        extended Link elements that reference parameter_definition resources.
   39      """
   40 
   41     def __init__(self, **kwds):
   42         super(ParameterDefinitions, self).__init__(**kwds)
   43 
   44     def fix_uris(self, host_url):
   45         """Update URIs to reflect a host URL."""
   46 
   47         ret_val = copy.deepcopy(self)
   48         ret_val.uri = uris.PARAM_DEFS_URI_STR % (host_url, ret_val.uri)
   49         for pd_link in ret_val.parameter_definition_links:
   50             pd_link.href = uris.PARAM_DEF_URI_STR % (host_url, pd_link.href)
   51 
   52         return ret_val