def get(self): host_url = pecan.request.application_url.rstrip('/') puri = uris.PLANS_URI_STR % host_url pdef_uri = uris.DEPLOY_PARAMS_URI % host_url desc = "Solum CAMP API plans collection resource." handler = plan_handler.PlanHandler(pecan.request.security_context) plan_objs = handler.get_all() p_links = [] for m in plan_objs: p_links.append(common_types.Link(href=uris.PLAN_URI_STR % (host_url, m.uuid), target_name=m.name)) # if there aren't any plans, avoid returning a resource with an # empty plan_links array if len(p_links) > 0: res = model.Plans(uri=puri, name='Solum_CAMP_plans', type='plans', description=desc, parameter_definitions_uri=pdef_uri, plan_links=p_links) else: res = model.Plans(uri=puri, name='Solum_CAMP_plans', type='plans', description=desc, parameter_definitions_uri=pdef_uri) return res
def get(self): euri = uris.EXTNS_URI_STR % pecan.request.host_url desc = "Solum CAMP API extensions collection resource." handlr = (extension_handler. ExtensionHandler(pecan.request.security_context)) ext_objs = handlr.get_all() e_links = [] for m in ext_objs: e_links.append(common_types.Link(href=uris.EXTN_URI_STR % (pecan.request.host_url, m.uuid), target_name=m.name)) # if there aren't any extensions, avoid returning a resource with an # empty extension_links array if len(e_links) > 0: res = model.Extensions(uri=euri, name="Solum_CAMP_extensions", type='extensions', description=desc, extension_links=e_links) else: res = model.Extensions(uri=euri, name="Solum_CAMP_extensions", type='extensions', description=desc) return res
def get(self): host_url = pecan.request.application_url.rstrip('/') suri = uris.SERVS_URI_STR % host_url desc = "Solum CAMP API services collection resource." handlr = service_handler.ServiceHandler(pecan.request.security_context) service_objs = handlr.get_all() s_links = [] for m in service_objs: s_links.append( common_types.Link(href=uris.SERV_URI_STR % (host_url, m.uuid), target_name=m.name)) # if there aren't any services, avoid returning a resource with an # empty service_links array if len(s_links) > 0: res = model.Services(uri=suri, name='Solum_CAMP_services', type='services', description=desc, service_links=s_links) else: res = model.Services(uri=suri, name='Solum_CAMP_services', type='services', description=desc) return res
def get(self): auri = uris.ASSEMS_URI_STR % pecan.request.host_url pdef_uri = uris.DEPLOY_PARAMS_URI % pecan.request.host_url desc = "Solum CAMP API assemblies collection resource" handler = (assembly_handler.AssemblyHandler( pecan.request.security_context)) asem_objs = handler.get_all() a_links = [] for m in asem_objs: a_links.append( common_types.Link(href=uris.ASSEM_URI_STR % (pecan.request.host_url, m.uuid), target_name=m.name)) # if there aren't any assemblies, avoid returning a resource with an # empty assembly_links array if len(a_links) > 0: res = model.Assemblies(uri=auri, name='Solum_CAMP_assemblies', type='assemblies', description=desc, parameter_definitions_uri=pdef_uri, assembly_links=a_links) else: res = model.Assemblies(uri=auri, name='Solum_CAMP_assemblies', type='assemblies', description=desc, parameter_definitions_uri=pdef_uri) return res
def index(self): host_url = '%s/%s' % (pecan.request.host_url, 'v1') v1 = Version(id='v1.0', status='CURRENT', link=common_types.Link(target_name='v1', href=host_url)) return [v1]
def index(self): base_url = pecan.request.application_url.rstrip('/') host_url = '%s/%s' % (base_url, 'v1') v1 = Version(id='v1.0', status='CURRENT', link=common_types.Link(target_name='v1', href=host_url)) return [v1]
def get(self): links = [ common_types.Link(href=endpoint.URI_STRING % pecan.request.host_url, target_name=endpoint.NAME_STRING) ] return model.PlatformEndpoints(uri=URI_STRING % pecan.request.host_url, name='Solum_CAMP_endpoints', type='platform_endpoints', description=DESCRIPTION_STRING, platform_endpoint_links=links)
def get(self): """Return the formats resource.""" host_url = pecan.request.application_url.rstrip('/') links = [ common_types.Link(href=uris.JSON_FORMAT_URI_STR % host_url, target_name=uris.JSON_FORMAT_NAME_STR) ] return formats.Formats(uri=uris.FORMATS_URI_STR % host_url, name='Solum_CAMP_formats', type='formats', description=DESCRIPTION_STRING, format_links=links)
def get(self): links = [] handler = (type_definition_handler. TypeDefinitionHandler(pecan.request.security_context)) def_list = handler.get_all() host_url = pecan.request.application_url.rstrip('/') for tdef in def_list: links.append(common_types.Link(href=uris.TYPE_DEF_URI_STR % (host_url, tdef.uri), target_name=tdef.name)) return model.TypeDefinitions(uri=uris.TYPE_DEFS_URI_STR % host_url, name='Solum_CAMP_type_definitions', type='type_definitions', description=DESCRIPTION_STRING, type_definition_links=links)
def from_json(cls, dct): ret_val = cls() for key, value in dct.items(): if key == 'inherits_from': inherit_links = [] for l_dict in value: link = common_types.Link(href=l_dict['href'], target_name=l_dict['target_name']) inherit_links.append(link) setattr(ret_val, 'inherits_from', inherit_links) elif key == 'attribute_definition_links': ad_links = [] for ad_dct in value: ad_link = AttributeLink.from_json(ad_dct) ad_links.append(ad_link) setattr(ret_val, 'attribute_definition_links', ad_links) elif hasattr(ret_val, key): setattr(ret_val, key, value) else: core.abort(500, 'internal metadata is incorrect') return ret_val
def sample(cls): return cls(id='v1.0', status='CURRENT', link=common_types.Link(target_name='v1', href='http://example.com:9777/v1'))