Exemple #1
0
def _addCommonGetTagProperties(usage, category):
    possibleActions = ', '.join(permissions.actionsByCategory[category])
    usage.addArgument(Argument(
        actionArg,
        """The action whose permissions information is
        sought. Possible values are: """ + possibleActions + '.',
        'string',
        mandatory=True))

    apiDoc.addMissingIntermediateNs(usage)

    apiDoc.addNoSuchTag(usage)

    apiDoc.addNeedTagPermOrAdmin(usage, apiDoc.CONTROL)

    usage.addReturn(Return(
        apiDoc.BAD_REQUEST,
        'If the %s argument is missing or invalid.' % actionArg))

    apiDoc.addCannotRespondWithPayload(usage)

    apiDoc.addOkOtherwise(usage)

    responsePayload = JSONPayload()
    responsePayload.addField(PayloadField(
        'policy', unicode,
        """The policy (either 'open' or 'closed')."""))
    responsePayload.addField(PayloadField(
        'exceptions', list,
        'The names of the users who are exceptions to the policy.',
        listType=unicode))
    usage.addResponsePayload(responsePayload)
Exemple #2
0
def _addCommonGetTagProperties(usage, category):
    possibleActions = ', '.join(permissions.actionsByCategory[category])
    usage.addArgument(
        Argument(actionArg,
                 """The action whose permissions information is
        sought. Possible values are: """ + possibleActions + '.',
                 'string',
                 mandatory=True))

    apiDoc.addMissingIntermediateNs(usage)

    apiDoc.addNoSuchTag(usage)

    apiDoc.addNeedTagPermOrAdmin(usage, apiDoc.CONTROL)

    usage.addReturn(
        Return(apiDoc.BAD_REQUEST,
               'If the %s argument is missing or invalid.' % actionArg))

    apiDoc.addCannotRespondWithPayload(usage)

    apiDoc.addOkOtherwise(usage)

    responsePayload = JSONPayload()
    responsePayload.addField(
        PayloadField('policy', unicode,
                     """The policy (either 'open' or 'closed')."""))
    responsePayload.addField(
        PayloadField(
            'exceptions',
            list,
            'The names of the users who are exceptions to the policy.',
            listType=unicode))
    usage.addResponsePayload(responsePayload)
Exemple #3
0
# ------------------------------ Objects POST -----------------------------
topLevel = HTTPTopLevel(httpObjectCategoryName, 'POST')
topLevel.description = "Create a new Fluidinfo object."
registry.register(topLevel)

# --- POST /objects -------------------------------------------------------

usage = HTTPUsage('', 'Create a new object. You must provide credentials for '
                      'this call to succeed.')
topLevel.addUsage(usage)
usage.resourceClass = ObjectsResource
usage.successCode = http.CREATED

apiDoc.addBadRequestPayload(usage)

apiDoc.addCannotRespondWithPayload(usage)

usage.addReturn(Return(apiDoc.UNAUTHORIZED,
                       'If valid credentials are not provided.'))

usage.addReturn(Return(
    apiDoc.httpCode(usage.successCode),
    'A new object was created without error.'))

requestPayload = JSONPayload()
requestPayload.addField(PayloadField(
    aboutArg,
    unicode,
    """The value for the %(about)s tag. If you do not want an
    an %(about)s tag on this object, omit this field.
    """ %
Exemple #4
0
        apiDoc.REQUEST_ENTITY_TOO_LARGE,
        """If the query (or any of its sub-parts) results in too many
    matching objects. The current limit is 1 million objects."""))

usage.addReturn(
    Return(
        apiDoc.UNAUTHORIZED,
        'If the requesting user does not have ' + apiDoc.READ +
        ' permission on a tag whose value is needed to satisfy the query.'))

usage.addReturn(
    Return(
        apiDoc.UNAUTHORIZED, 'If the requesting user does not have ' +
        apiDoc.READ + ' permission on a tag whose value is requested.'))

apiDoc.addCannotRespondWithPayload(usage)

usage.addReturn(
    Return(apiDoc.httpCode(usage.successCode), 'No error occurred.'))

responsePayload = JSONPayload()
responsePayload.addField(
    PayloadField(
        resultsKey,
        dict,
        # TODO: describe this better, point to as-implemented version of
        # the original spec/draft.
        '''A dictionary containing information about the requested tag values
    on objects that match the query. See example below.'''))

usage.addResponsePayload(responsePayload)