示例#1
0
def get_machine_tags(request):
    """
    Tags: tags
    ---
    Lists tags of a machine.
    READ permission required on CLOUD.
    READ permission required on MACHINE
    ---
    cloud_id:
      in: path
      required: true
      type: string
    machine:
      in: path
      required: true
      type: string
    """
    auth_context = auth_context_from_request(request)
    machine_id = request.matchdict["machine_id"]
    cloud_id = request.matchdict["cloud_id"]
    auth_context.check_perm("cloud", "read", cloud_id)

    auth_context.check_perm('cloud', 'read', cloud_id)
    # SEC
    auth_context.check_perm("machine", "read", machine_id)

    return resolve_id_and_get_tags(auth_context.owner,
                                   'machine',
                                   machine_id,
                                   cloud_id=cloud_id)
示例#2
0
def get_network_tags(request):
    """
    Tags: tags
    ---
    Lists tags of a network.
    READ permission required on CLOUD.
    READ permission required on NETWORK
    ---
    cloud_id:
      in: path
      required: true
      type: string
    network_id:
      in: path
      required: true
      type: string
    """
    auth_context = auth_context_from_request(request)
    network_id = request.matchdict["network_id"]
    cloud_id = request.params.get("cloud_id")

    auth_context.check_perm('cloud', 'read', cloud_id)
    # SEC require READ permission on network
    auth_context.check_perm('network', 'read', network_id)

    return resolve_id_and_get_tags(auth_context.owner,
                                   'network',
                                   network_id,
                                   cloud_id=cloud_id)
示例#3
0
def get_schedule_tags(request):
    auth_context = auth_context_from_request(request)
    schedule_id = request.matchdict["schedule_id"]

    # SEC require READ permission on script
    auth_context.check_perm("schedule", "read", schedule_id)

    return resolve_id_and_get_tags(auth_context.owner, 'schedule', schedule_id)
示例#4
0
def get_key_tags(request):
    """
    List tags of an ssh keypair
    READ permission required on KEY
    ---
    key_id:
      in: path
      required: true
      type: string
    """
    auth_context = auth_context_from_request(request)
    key_id = request.matchdict["key_id"]

    # SEC require READ permission on key
    auth_context.check_perm("key", "read", key_id)

    return resolve_id_and_get_tags(auth_context.owner, 'key', key_id)
示例#5
0
def get_script_tags(request):
    """
    List tags of a script
    READ permission required on SCRIPT
    ---
    script_id:
      in: path
      required: true
      type: string
    """
    auth_context = auth_context_from_request(request)
    script_id = request.matchdict["script_id"]

    # SEC require READ permission on script
    auth_context.check_perm("script", "read", script_id)

    return resolve_id_and_get_tags(auth_context.owner, 'script', script_id)
示例#6
0
def get_cloud_tags(request):
    """
    List tags of a cloud
    READ permission required on CLOUD
    ---
    cloud_id:
      in: path
      required: true
      type: string
    """
    auth_context = auth_context_from_request(request)
    cloud_id = request.matchdict["cloud_id"]

    # SEC require READ permission on cloud
    auth_context.check_perm("cloud", "read", cloud_id)

    return resolve_id_and_get_tags(auth_context.owner, 'cloud', cloud_id)
示例#7
0
def get_schedule_tags(request):
    """
    Tags: tags
    ---
    Lists tags of a schedule.
    READ permission required on SCHEDULE
    ---
    schedule_id:
      in: path
      required: true
      type: string
    """
    auth_context = auth_context_from_request(request)
    schedule_id = request.matchdict["schedule_id"]

    # SEC require READ permission on script
    auth_context.check_perm("schedule", "read", schedule_id)

    return resolve_id_and_get_tags(auth_context.owner, 'schedule', schedule_id)