Generates the meta descriptor for the resource listing api.
508310
def get_listing_api(self, resource):
        

        get_all_params = self.get_listing_parameters(resource)

        get_all_api = {
            'path': '/%s/' % resource.get_api_name(),
            'description': 'Operations on %s' % resource.model.__name__,
            'operations': [
                {
                    'httpMethod': 'GET',
                    'nickname': 'list%ss' % resource.model
                    .__name__,
                    'summary': 'Find %ss' % resource.model.__name__,
                    'parameters': get_all_params,
                }
            ]
        }

        return get_all_api
744720
def determine_metadata(self, request, view):
        """"""
        metadata = super(
            DynamicMetadata,
            self).determine_metadata(
            request,
            view)
        metadata['features'] = getattr(view, 'features', [])
        if hasattr(view, 'get_serializer'):
            serializer = view.get_serializer(dynamic=False)
            if hasattr(serializer, 'get_name'):
                metadata['resource_name'] = serializer.get_name()
            if hasattr(serializer, 'get_plural_name'):
                metadata['resource_name_plural'] = serializer.get_plural_name()
        metadata['properties'] = self.get_serializer_info(serializer)
        return metadata
1183272
def describe_api_resource(restApiId, path,
                          region=None, key=None, keyid=None, profile=None):
    '''
    

    '''
    r = describe_api_resources(restApiId, region=region, key=key, keyid=keyid, profile=profile)
    resources = r.get('resources')
    if resources is None:
        return r
    for resource in resources:
        if resource['path'] == path:
            return {'resource': resource}
    return {'resource': None}
24608
def index():
    """"""
    classes = []
    with app.app_context():
        classes = set(current_app.class_references.values())
    if _get_acceptable_response_type() == JSON:
        meta_data = {}
        for cls in classes:
            meta_data[cls.endpoint()] = {
                'link': '/' + cls.endpoint(),
                'meta': '/' + cls.endpoint() + '/meta'
                }
        return jsonify(meta_data)
    else:
        return render_template('index.html', classes=classes)
478438
def extract_meta(cls, serializer, resource):
        
        if hasattr(serializer, 'child'):
            meta = getattr(serializer.child, 'Meta', None)
        else:
            meta = getattr(serializer, 'Meta', None)
        meta_fields = getattr(meta, 'meta_fields', [])
        data = OrderedDict()
        for field_name in meta_fields:
            data.update({
                field_name: resource.get(field_name)
            })
        return data
392023
def _to_swagger(base=None, description=None, resource=None, options=None):
    # type: (Dict[str, str], str, Resource, Dict[str, str]) -> Dict[str, str]
    
    definition = dict_filter(base or {}, options or {})

    if description:
        definition['description'] = description.format(
            name=getmeta(resource).name if resource else "UNKNOWN"
        )

    if resource:
        definition['schema'] = {
            '$ref': '#/definitions/{}'.format(getmeta(resource).resource_name)
        }

    return definition
599543
function build_meta_information(object) {
      var res = {
        "timestamp": object.timestamp,
        "version": object.version,
        "changeset": object.changeset,
        "user": object.user,
        "uid": object.uid
      };
      for (var k in res)
        if (res[k] === undefined)
          delete res[k];
      return res;
    }
1236299
function RestListMetadata(list, listMeta) {
    var pool = {};

    var profiles = Object.getOwnPropertyNames(listMeta);
    while (profiles.length) {
        var p = profiles.shift();

        if (p == "isAdmin") {
            utils.deprecated("Profile 'isAdmin' is deprecated, please use 'admin' instead. Admin access to resource " + list.key + " is disabled.");
        }
        var meta = listMeta[p];
        var metaBase;

        // check for circular inheritance or non-existing.
        if (meta.hasOwnProperty('__extends__')) {
            var metaBaseName = meta["__extends__"];
            if (! pool.hasOwnProperty(metaBaseName)) {
                if (listMeta.hasOwnProperty(metaBaseName)) {
                    var checkCircular = listMeta[metaBaseName]['__extends__'] || undefined;
                    if (checkCircular == p) {
                        throw new Error("Circular inheritance for RestListMetadata profiles " + p + " & " + metaBaseName + " in Model " + list.key + ".")
                    }
                    profiles.push(p);
                    continue;
                }
                else {
                    throw new Error("RestListMetadata profile " + p + " extends a non-existing profile " + metaBaseName + " in Model " + list.key + ".")
                }
            }
            // were ok, set inheritance.
            delete meta["__extends__"];
            metaBase =  _.extend({}, pool[metaBaseName]);
        }
        pool[p] = compile_meta_module(list, meta, metaBase || defaultConfig(list))

    }

    this.fieldsByTypes = groupFieldsByType(list);
    this.pool = pool;
}
1038223
def get_create_api(self, resource):
        

        create_api = {
            'path': '/%s/' % resource.get_api_name(),
            'description': 'Operations on %s' % resource.model.__name__,
            'operations': [
                {
                    'httpMethod': 'POST',
                    'nickname': 'create%ss' % resource.model
                    .__name__,
                    'summary': 'Create %ss' % resource.model.__name__,
                    'parameters': [{
                        'description': '%s object' % (resource.model.__name__),
                        'paramType': 'body',
                        'required': True,
                        'allowMultiple': False,
                        'dataType': resource.model.__name__
                    }]
                }
            ]
        }

        return create_api
1143181
def metaseries_description_metadata(description):
    """"""
    if not description.startswith('<MetaData>'):
        raise ValueError('invalid MetaSeries image description')

    from xml.etree import cElementTree as etree  # delayed import
    root = etree.fromstring(description)
    types = {'float': float, 'int': int,
             'bool': lambda x: asbool(x, 'on', 'off')}

    def parse(root, result):
        # recursive
        for child in root:
            attrib = child.attrib
            if not attrib:
                result[child.tag] = parse(child, {})
                continue
            if 'id' in attrib:
                i = attrib['id']
                t = attrib['type']
                v = attrib['value']
                if t in types:
                    result[i] = types[t](v)
                else:
                    result[i] = v
        return result

    adict = parse(root, {})
    if 'Description' in adict:
        adict['Description'] = adict['Description'].replace('&#13;&#10;', '\n')
    return adict
1250571
def listing(callback=None, path=None, method=Method.GET, resource=None, tags=None, summary="List resources",
            middleware=None, default_limit=50, max_limit=None, use_wrapper=True):
    # type: (Callable, Path, Methods, Resource, Tags, str, List[Any], int, int) -> Operation
    
    op_type = WrappedListOperation if use_wrapper else ListOperation

    def inner(c):
        op = op_type(c, path or NoPath, method, resource, tags, summary, middleware,
                     default_limit=default_limit, max_limit=max_limit)
        op.responses.add(Response(HTTPStatus.OK, "Listing of resources", Listing))
        return op
    return inner(callback) if callback else inner
109577
def _make_api(self, service_name):
        '''
        
        '''

        resources = [resource for resource, resource_details in
                     service_definitions.get(service_name, {}).get("resources", {}).items()]

        for resource in resources:
            setattr(self, 'list_{0}' . format(resource), self.list)
            setattr(self, 'get_{0}' . format(resource), self.get)
            setattr(self, 'create_{0}' . format(resource), self.create)
            setattr(self, 'update_{0}' . format(resource), self.update)
            setattr(self, 'delete_{0}' . format(resource), self.delete)
276771
def set_meta(self, **kwargs):
        """"""
        for param in self.to_list():
            for k, v in kwargs.items():
                # Here we'll set the attributes (_context, _qualifier, etc)
                if getattr(param, '_{}'.format(k)) is None:
                    setattr(param, '_{}'.format(k), v)
341395
def build_metadata_class(specfile):
    """"""
    with open(specfile) as f:
        spec = json.load(f)
        name = os.path.basename(specfile).split('.')[0]
        spec['name'] = name

        env = get_jinja_env()

        metadata_template = env.get_template('metadata.py.jinja2')
        with open('pycanvas/meta/{}.py'.format(name), 'w') as t:
            t.write(metadata_template.render(spec=spec))
1084813
def generatemetadata(self, parameters, parentfile, relevantinputfiles, provenancedata = None):
        """"""
        assert isinstance(provenancedata,CLAMProvenanceData) or provenancedata is None

        data = {}

        if self.copymetadata:
            #Copy parent metadata
            for key, value in parentfile.metadata.items():
                data[key] = value

        for metafield in self.metafields:
            if isinstance(metafield, ParameterCondition):
                metafield = metafield.evaluate(parameters)
                if not metafield:
                    continue
            assert isinstance(metafield, AbstractMetaField)
            metafield.resolve(data, parameters, parentfile, relevantinputfiles)

        if provenancedata:
            data['provenance'] = provenancedata

        return self.formatclass(None, **data)
788268
def resource_list(cls):
        
        items = cls.list({'items_per_page': 500})
        ret = [str(ip['id']) for ip in items]
        ret.extend([ip['ip'] for ip in items])
        return ret
107467
def to_api_repr(self):
        """"""

        source_refs = [
            {
                "projectId": table.project,
                "datasetId": table.dataset_id,
                "tableId": table.table_id,
            }
            for table in self.sources
        ]

        configuration = self._configuration.to_api_repr()
        _helpers._set_sub_prop(configuration, ["copy", "sourceTables"], source_refs)
        _helpers._set_sub_prop(
            configuration,
            ["copy", "destinationTable"],
            {
                "projectId": self.destination.project,
                "datasetId": self.destination.dataset_id,
                "tableId": self.destination.table_id,
            },
        )

        return {
            "jobReference": self._properties["jobReference"],
            "configuration": configuration,
        }