Source code for octavia.api.v2.types.flavor_profile
# Copyright 2014 Rackspace
#
# 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 wsme import types as wtypes
from octavia.api.common import types
[docs]
class BaseFlavorProfileType(types.BaseType):
_type_to_model_map = {}
_child_map = {}
[docs]
class FlavorProfileResponse(BaseFlavorProfileType):
"""Defines which attributes are to be shown on any response."""
id = wtypes.wsattr(wtypes.UuidType())
name = wtypes.wsattr(wtypes.StringType())
provider_name = wtypes.wsattr(wtypes.StringType())
flavor_data = wtypes.wsattr(wtypes.StringType())
[docs]
@classmethod
def from_data_model(cls, data_model, children=False):
flavorprofile = super().from_data_model(
data_model, children=children)
return flavorprofile
[docs]
class FlavorProfileRootResponse(types.BaseType):
flavorprofile = wtypes.wsattr(FlavorProfileResponse)
[docs]
class FlavorProfilesRootResponse(types.BaseType):
flavorprofiles = wtypes.wsattr([FlavorProfileResponse])
flavorprofile_links = wtypes.wsattr([types.PageType])
[docs]
class FlavorProfilePOST(BaseFlavorProfileType):
"""Defines mandatory and optional attributes of a POST request."""
name = wtypes.wsattr(wtypes.StringType(max_length=255), mandatory=True)
provider_name = wtypes.wsattr(wtypes.StringType(max_length=255),
mandatory=True)
flavor_data = wtypes.wsattr(wtypes.StringType(max_length=4096),
mandatory=True)
[docs]
class FlavorProfileRootPOST(types.BaseType):
flavorprofile = wtypes.wsattr(FlavorProfilePOST)
[docs]
class FlavorProfilePUT(BaseFlavorProfileType):
"""Defines the attributes of a PUT request."""
name = wtypes.wsattr(wtypes.StringType(max_length=255))
provider_name = wtypes.wsattr(wtypes.StringType(max_length=255))
flavor_data = wtypes.wsattr(wtypes.StringType(max_length=4096))
[docs]
class FlavorProfileRootPUT(types.BaseType):
flavorprofile = wtypes.wsattr(FlavorProfilePUT)