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
def _addCommonPutTagProperties(usage, category):
    possibleActions = ', '.join(permissions.actionsByCategory[category])
    usage.addArgument(
        Argument(actionArg,
                 """The action whose permissions information is
        to be updated. Possible values are: """ + possibleActions + '.',
                 'string',
                 mandatory=True))

    apiDoc.addMissingIntermediateNs(usage)

    apiDoc.addNoSuchTag(usage)

    apiDoc.addNeedTagPermOrAdmin(usage, apiDoc.CONTROL)

    apiDoc.addUnknownExceptionUser(usage)

    usage.addReturn(
        Return(
            apiDoc.BAD_REQUEST, 'If the policy is not %r or %r.' %
            (permissions.OPEN, permissions.CLOSED)))

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

    apiDoc.addBadRequestPayload(usage)

    usage.addReturn(
        Return(apiDoc.NO_CONTENT, 'If permissions are changed successfully.'))

    requestPayload = JSONPayload()
    requestPayload.addField(
        PayloadField(
            'policy', unicode, 'The policy (either %r or %r).' %
            (permissions.OPEN, permissions.CLOSED)))
    requestPayload.addField(
        PayloadField(
            'exceptions',
            list,
            'The names of the users who are exceptions to the policy.',
            listType=unicode))
    usage.addRequestPayload(requestPayload)
Exemple #4
0
def _addCommonPutTagProperties(usage, category):
    possibleActions = ', '.join(permissions.actionsByCategory[category])
    usage.addArgument(Argument(
        actionArg,
        """The action whose permissions information is
        to be updated. Possible values are: """ + possibleActions + '.',
        'string',
        mandatory=True))

    apiDoc.addMissingIntermediateNs(usage)

    apiDoc.addNoSuchTag(usage)

    apiDoc.addNeedTagPermOrAdmin(usage, apiDoc.CONTROL)

    apiDoc.addUnknownExceptionUser(usage)

    usage.addReturn(Return(
        apiDoc.BAD_REQUEST,
        'If the policy is not %r or %r.' % (
            permissions.OPEN, permissions.CLOSED)))

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

    apiDoc.addBadRequestPayload(usage)

    usage.addReturn(Return(
        apiDoc.NO_CONTENT,
        'If permissions are changed successfully.'))

    requestPayload = JSONPayload()
    requestPayload.addField(PayloadField(
        'policy', unicode,
        'The policy (either %r or %r).' % (
            permissions.OPEN, permissions.CLOSED)))
    requestPayload.addField(PayloadField(
        'exceptions', list,
        'The names of the users who are exceptions to the policy.',
        listType=unicode))
    usage.addRequestPayload(requestPayload)
Exemple #5
0
registry.register(topLevel)

# --- DELETE /objects/ID/NAMESPACE1/NAMESPACE2/TAG ------------------

usage = HTTPUsage(apiDoc.ID_NS_NS_TAG, 'Delete a tag from an object.')
usage.resourceClass = TagInstanceResource
usage.successCode = http.NO_CONTENT
topLevel.addUsage(usage)

usage.addReturn(Return(
    apiDoc.NOT_FOUND,
    'If the object id is malformed.'))

apiDoc.addMissingIntermediateNs(usage)

apiDoc.addNoSuchTag(usage)

usage.addReturn(Return(
    apiDoc.UNAUTHORIZED,
    'If the user does not have ' + apiDoc.DELETE + ' permission on the tag.'))

usage.addReturn(Return(
    apiDoc.httpCode(usage.successCode),
    'The tag is successfully deleted from the object.'))

usage.addNote(Note(
    'You will receive a ' + apiDoc.NO_CONTENT +
    ' status even if the object has no instance of the tag.'))

request = """DELETE /objects/5a4823a4-26b4-495c-9a29-a1e830a1b153/
test/quz HTTP/1.1
Exemple #6
0
    <a href="http://doc.fluidinfo.com/fluidDB/
    objects.html#objects-are-never-deleted">
    it is not possible to delete a Fluidinfo object</a>.''')

registry.register(topLevel)

# --- DELETE /about/aboutstr/NAMESPACE1/NAMESPACE2/TAG ------------------

usage = HTTPUsage(apiDoc.ABOUTSTR_NS_NS_TAG, 'Delete a tag from an object.')
usage.resourceClass = AboutTagInstanceResource
usage.successCode = http.NO_CONTENT
topLevel.addUsage(usage)

apiDoc.addMissingIntermediateNs(usage)

apiDoc.addNoSuchTag(usage)

usage.addReturn(
    Return(apiDoc.BAD_REQUEST,
           'The ' + apiDoc.ABOUTSTR + ' argument was not valid UTF-8.'))

usage.addReturn(
    Return(apiDoc.NOT_FOUND, 'No object with the given about value exists.'))

usage.addReturn(
    Return(
        apiDoc.UNAUTHORIZED, 'If the user does not have ' + apiDoc.DELETE +
        ' permission on the tag.'))

usage.addReturn(
    Return(apiDoc.httpCode(usage.successCode),