$schema: 'http://support.riverbed.com/apis/service_def/2.2'
id: 'http://support.riverbed.com/apis/cmc.qos/2.0'
provider: 'riverbed'
name: "cmc.qos"
version: "2.0"
title: "REST API for SCC QoS"

###############################################################################
#
# Types
#
###############################################################################

types:
    identifier:
        description: "Generic numeric identifier"
        type: integer
        minimum: 1
        readOnly: true

    dscp_rule:
        description: "For extended DSCP fields. Used for the DSCP passed to    \
                      the data-path. It can assume values from 0 to 63 and      \
                      values to trigger some extra actions on DSCP:             \
                         * 255 to `reflect` or `preserve` the DSCP from innner  \
                           to outer channel and the other way around."
        type: integer
        minimum: 0
        maximum: 255

    empty_collection:
        description: "Empty collection used to partially clear a collection"
        anyOf:
            - type: array
              maxItems: 0
              items:
                  type: 'null'
            # XXX: this is needed as a temporary workaround for a sleepwalker
            #      bug that prevents passing an empty array. So we pass an array with
            #      just an element that is the empty string.
            - type: array
              maxItems: 1
              minItems: 1
              items:
                  type: string
                  maxLength: 0

    wan_interface:
        description: wan interface
        type: string
        pattern: '^wan\d_\d'
    primary_interface:
        description: primary interface
        type: string
        pattern: 'primary'

    percentage:
        type: number
        minimum: 0
        maximum: 100

    name:
        description: "Generic name field. Only alphanumeric '-' and '_' is allowed"
        type: string
        pattern: '^[a-zA-Z0-9_-]+$'
        minLength: 3
        maxLength: 30

    unrestricted_name:
        description: "Generic name field, all characters allowed except for leading and trailing whitespace."
        type: string
        pattern: '^(\S.*)?\S$'
        minLength: 1
        maxLength: 255

    all:
        type: string
        enum: ["All"]

    classes_tree:
        type: object
        properties:
            id:
               $merge:
                   source: { $ref: '#/types/identifier' }
                   with: { description: "Class ID" }
            name:
               $merge:
                   source: { $ref: '#/types/unrestricted_name' }
                   with: { description: "Class Name" }
            is_default_class:
               type: boolean
               description: >
                   Is this class the default class in the tree?
            children:
               type: array
               items:
                   $ref: "#/types/classes_tree"
        additionalProperties: false


resources:
#-------------------------------------------------------------------------------
# REST API for QoS and Path Profiles
#-------------------------------------------------------------------------------

    class:
        type: object
        description: "QoS Class"
        additionalProperties: false
        properties:
            id:
                $merge:
                    source: { $ref: '#/types/identifier' }
                    with: { description: "Class ID" }
            qos_profile_id:
                type: number
                description: "Reference to the QoS Profile"
            name:
                $merge:
                    source: { $ref: '#/types/unrestricted_name' }
                    with: { description: "Class Name" }
            parent_id:
                type: number
                description: "Reference to the Parent Class ID"
            is_leaf:
                type: boolean
                description: "Is this class a leaf class or inner class?"
                readOnly: true
            is_default_class:
                type: boolean
                readOnly: true
                description: >
                    Is this class the default class in the QoS Profile?
        required: [ name, qos_profile_id, parent_id ]
        links:
            self:
                path: "$/classes/items/{id}"
            get:
                description: "Get the data representation of a QoS Class."
                method: GET
                response:
                    $ref: '#/resources/class'
            set:
                description: "Replace the data representation of a QoS Class."
                method: PUT
                request:
                    $ref: '#/resources/class'
                response:
                    $ref: '#/resources/class'
            delete:
                description: "Delete a QoS Class instance indexed by the ID."
                method: DELETE
        relations:
            # The list of all classes
            instances:
                resource: '#/resources/classes'
            # Link to the class set of this class
            qos_profile:
                resource: '#/resources/qos_profile'
                vars:
                    id: "0/qos_profile_id"
            # Link to the parent-class of this class
            parent:
                resource: '#/resources/class'
                vars:
                    id: "0/parent_id"

    classes:
        type: array
        description: "List of QoS Class IDs and names."
        items:
            type: object
            additionalProperties: false
            properties:
                id:
                    $merge:
                        source: { $ref: '#/types/identifier' }
                        with: { description: "Class ID" }
                qos_profile_id:
                    type: number
                    description: "Reference to the QoS Profile"
                name:
                    $merge:
                        source: { $ref: '#/types/unrestricted_name' }
                        with: { description: "Class Name" }
                parent_id:
                    type: number
                    description: "Reference to the Parent Class ID"
                is_leaf:
                    type: boolean
                    description: "Is this class a leaf class or inner class?"
                    readOnly: true
                is_default_class:
                    type: boolean
                    readOnly: true
                    description: >
                        Is this class the default class in the QoS Profile?
            relations:
                full:
                    resource: '#/resources/class'
                    vars: {id: "0/id"}
        links:
            self:
                path: "$/classes"
                params:
                    # Allow filtering by class name
                    name:
                        $ref: '#/types/unrestricted_name'
                    # Allow filtering by class set id
                    qos_profile_id:
                        type: number
            set:
                description: "Delete all the Class instances (except for default root class in default class set)."
                method: PUT
                request:
                    $ref: '#/types/empty_collection'
            get:
                method: GET
                response:
                    $ref: '#/resources/classes'
            create:
                method: POST
                request:
                    $ref: '#/resources/class'
                response:
                    $ref: '#/resources/class'

    queue_type:
        type: object
        description: "QoS Queue"
        additionalProperties: false
        properties:
            id:
                $merge:
                    source: { $ref: '#/types/identifier' }
                    with: { description: "Queue Type ID" }
            name:
                $merge:
                    source: { $ref: '#/types/name' }
                    with: { description: "Queue Type Name" }
        required: [ name ]
        links:
            self:
                path: "$/queue_types/items/{id}"
            get:
                method: GET
                response:
                    $ref: '#/resources/queue_type'
        relations:
            # The list of all queue_types
            instances:
                resource: '#/resources/queue_types'

    queue_types:
        type: array
        description: "List of QoS Queues"
        items:
            type: object
            additionalProperties: false
            properties:
                id:
                    $merge:
                        source: { $ref: '#/types/identifier' }
                        with: { description: "Queue Type ID" }
                name:
                    $merge:
                        source: { $ref: '#/types/name' }
                        with: { description: "Queue Type Name" }
            relations:
                full:
                    resource: '#/resources/queue_type'
                    vars: { id: "0/id" }
        links:
            self:
                path: "$/queue_types"
                params:
                    # Allow filtering by queue_type name
                    name:
                        $ref: '#/types/name'
            get:
                method: GET
                response:
                    $ref: '#/resources/queue_types'
    qos_profile:
        type: object
        description: "QoS Profile"
        additionalProperties: false
        properties:
            id:
                $merge:
                    source: { $ref: '#/types/identifier' }
                    with: { description: "QoS Profile ID" }
            name:
                $merge:
                    source: { $ref: '#/types/unrestricted_name' }
                    with: { description: "QoS Profile Name" }
            is_built_in:
                type: boolean
                description: "This tells if qos-profile is built-in or not."
                readOnly: true
            classes_tree:
                $merge:
                    source: { $ref: '#/types/classes_tree' }
                    with: { readOnly: True }

        required: [ name ]
        links:
            self:
                path: "$/qos_profiles/items/{id}"
            get:
                description: "Get the data representation of a QoS Class Set."
                method: GET
                response:
                    $ref: '#/resources/qos_profile'
            set:
                method: PUT
                description: "Modifies qos_profile. This change will not affect qos_policy."
                request:
                    $ref: '#/resources/qos_profile'
                response:
                    $ref: '#/resources/qos_profile'
            delete:
                description: "Delete a QoS Class Set instance indexed by the ID."
                # URI defaults to "self"
                method: DELETE
        relations:
            # The list of all class sets
            instances:
                resource: '#/resources/qos_profiles'

    qos_profiles:
        type: array
        description: "List of QoS Profile IDs and names."
        items:
            type: object
            additionalProperties: false
            properties:
                id:
                    $merge:
                        source: { $ref: '#/types/identifier' }
                        with: { description: "QoS Profile ID" }
                name:
                    $merge:
                        source: { $ref: '#/types/unrestricted_name' }
                        with: { description: "QoS Profile Name" }
                is_built_in:
                    type: boolean
                    readOnly: true
                    description: "This tells if a qos-profile built_in or not."
            relations:
                full:
                    resource: '#/resources/qos_profile'
                    vars: { id: "0/id" }
        links:
            self:
                path: "$/qos_profiles"
                params:
                    # Allow filtering by class set name
                    name:
                        $ref: '#/types/unrestricted_name'
                    src_site_id:
                        type: integer
                    src_site_type_id:
                        type: integer
                    all_src_sites:
                        $ref: '#/types/all'
                    dest_site_id:
                        type: integer
                    dest_site_type_id:
                        type: integer
                    all_dest_sites:
                        $ref: '#/types/all'
            get:
                method: GET
                response:
                    $ref: '#/resources/qos_profiles'
            set:
                description: "Delete all the Class Set instances (except for default class set)."
                method: PUT
                request:
                    $ref: '#/types/empty_collection'
            create:
                method: POST
                description: "Creates qos_profile. This change will not affect qos_policy."
                request:
                    $ref: '#/resources/qos_profile'
                response:
                    $ref: '#/resources/qos_profile'
            copy:
                method: POST
                path: "$/qos_profiles/copy"
                request:
                    type: object
                    additionalProperties: false
                    properties:
                        name:
                            $merge:
                                source: { $ref: '#/types/unrestricted_name' }
                                with: { description: "QoS Profile Name" }
                        qos_profile_id:
                            $ref: '#/types/identifier'
                    required: [name, qos_profile_id]
                response:
                    # return new qos_profile
                    $ref: '#/resources/qos_profile'

    uplink_variation:
        type: object
        description: "Uplink Variation"
        additionalProperties: false
        properties:
            id:
                $merge:
                    source: { $ref: '#/types/identifier' }
                    with: { description: "Uplink Variation ID" }
            name:
                $merge:
                    source: { $ref: '#/types/unrestricted_name' }
                    with: { description: "Uplink Variation Name" }
            uplink_type_id:
                anyOf:
                    - $ref: '#/types/identifier'
                    - $ref: '#/types/all'
                description: "Reference to the Uplink type"
            qos_profile_id:
                type: number
                description: "Reference to QoS Profile ID"
            class_params:
                type: array
                description: >
                    List of all QoS Class Parameters associated
                    to this Uplink Variation
                items:
                    type: object
                    description: "QoS Class Parameters"
                    additionalProperties: false
                    properties:
                        class_id:
                            type: number
                            description: "Reference to the QoS Class"
                        ob_queue_type_id:
                            type: number
                            description: >
                                Reference to the Queue Type of
                                an Outbound Class
                        ob_queue_length:
                            type: number
                            description: "Length of the Outbound QoS Queue"
                        ib_queue_length:
                            type: number
                            description: "Length of the Inbound QoS Queue"
                        min_bw:
                            $merge:
                                source: { $ref: '#/types/percentage' }
                                with: { description: "Minimum Bandwidth" }
                        max_bw:
                            $merge:
                                source: { $ref: '#/types/percentage' }
                                with: { description: "Maximum Bandwidth" }
                        ls_weight:
                            $merge:
                                source: { $ref: '#/types/percentage' }
                                with: { description: "HFSC link share weight" }
                        dscp:
                            $merge:
                                source: { $ref: '#/types/dscp_rule' }
                                with: { description: "Default DSCP" }
                        priority:
                            type: number
                            minimum: 1
                            maximum: 6
                            description: "Latency Priority"
                        connection_limit:
                            type: number
                            description: "Maximum number of connections"
                        ib_flow_padding_enable:
                            type: boolean
                            description: >
                                Enable/Disable inbound QoS Flow Padding
                                feature, default is enabled.
                        ib_flow_padding_override:
                            type: boolean
                            description: >
                                Whether or not override the global
                                Inbound QoS Flow Padding configuration.
                        ib_flow_padding_timeout:
                            $merge:
                                source: { $ref: '#/types/percentage' }
                                with:
                                    description: >
                                        Timeout for Deque/Link-Sharing Phantoms
                                        as a percentage fraction of average TCP
                                        round-trip time.
                        ib_tcp_control_enable:
                            type: boolean
                            description: >
                                Enable/Disable inbound QoS TCP Control
                                feature, default is enabled.
                        ib_tcp_control_override:
                            type: boolean
                            description: >
                                Whether or not override the global Inbound
                                QoS TCP Control configuration.
                        ib_tcp_control_fssdetect:
                            $merge:
                                source: { $ref: '#/types/percentage' }
                                with: { description: "False slow start detection settings" }
                        ib_tcp_control_idledetect:
                            $merge:
                                source: { $ref: '#/types/percentage' }
                                with: { description: "TCP idle restart detection settings" }
                        ib_tcp_control_weight:
                            $merge:
                                source: { $ref: '#/types/percentage' }
                                with:
                                    description: >
                                        TCP Slow-Start phantom weight as a percentage
                                        fraction of the real packet.
                    required: [ class_id ]
                    relations:
                        # Link to the class that this class-profile is about
                        class:
                            resource: '#/resources/class'
                            vars:
                                id: "0/class_id"
                        # Link to the queue_type that should be used by the class
                        queue_type:
                            resource: '#/resources/queue_type'
                            vars:
                                id: "0/queue_type_id"
        required: [ name, qos_profile_id, class_params ]
        links:
            self:
                path: "$/uplink_variations/items/{id}"
            get:
                method: GET
                response:
                    $ref: '#/resources/uplink_variation'
            set:
                method: PUT
                request:
                    $ref: '#/resources/uplink_variation'
                response:
                    $ref: '#/resources/uplink_variation'
        relations:
            # the entire list of uplink variations
            instances:
                resource: '#/resources/uplink_variations'
            qos_profile:
                resource: '#/resources/qos_profile'
                vars:
                    id: "0/qos_profile_id"
            # TODO provide external reference to uplink_type

    uplink_variations:
        type: array
        description: "List of Uplink Variations"
        items:
            type: object
            additionalProperties: false
            properties:
                id:
                    $merge:
                        source: { $ref: '#/types/identifier' }
                        with: { description: "Uplink Variation ID" }
                name:
                    $merge:
                        source: { $ref: '#/types/name' }
                        with: { description: "Uplink Variation Name" }
            relations:
                full:
                    resource: '#/resources/uplink_variation'
                    vars:
                        id: "0/id"
        links:
            self:
                path: "$/uplink_variations"
                params:
                    # Allow filtering by uplink_variation name
                    name:
                        $ref: '#/types/name'
                    # Allow filtering by QoS Profile id
                    qos_profile_id:
                        type: number
            get:
                method: GET
                response:
                    $ref: '#/resources/uplink_variations'
            create:
                method: POST
                request:
                    $ref: '#/resources/uplink_variation'
                response:
                    $ref: '#/resources/uplink_variation'


    qos_policy:
        type: object
        description: "QoS Policy"
        additionalProperties: false
        properties:
            id:
                $merge:
                    source: { $ref: '#/types/identifier' }
                    with: { description: "QoS policy id" }
            is_built_in:
                type: boolean
                description: "This tells if qos-policy is built-in or not"
                readOnly: true
            src_site_id:
                type: array
                items:
                    type: integer
                description: "Source Site ID"
            src_site_type_id:
                type: array
                items:
                    type: integer
                description: "Source Site type ID"
            all_src_sites:
                $merge:
                    source: { $ref: '#/types/all' }
                    with: { description: "Representation for all the source sites" }
            dest_site_id:
                type: array
                items:
                    type: integer
                description: "Destination Site ID"
            dest_site_type_id:
                type: array
                items:
                    type: integer
                description: "Destination Site type ID"
            all_dest_sites:
                $merge:
                    source: { $ref: '#/types/all' }
                    with: { description: "Representation for all the destination sites" }
            qos_profile_id:
                type: integer
                description: "Reference to QoS Profile ID"

        required: [qos_profile_id]
        links:
            self:
                path: "$/qos_policies/items/{id}"
            get:
                method: GET
                response:
                    $ref: '#/resources/qos_policy'
            set:
                method: PUT
                description: "Modifies qos_policy. After modifying qos_policy, it is recommended to change 'name' in qos_profile with new 'src to dest'"
                request:
                    $ref: '#/resources/qos_policy'
                response:
                    $ref: '#/resources/qos_policy'
            delete:
                method: DELETE

        relations:
            # the entire list of qos_polices
            instances:
                resource: '#/resources/qos_policies'
            # Link to the class set of this class
            qos_profile:
                resource: '#/resources/qos_profile'
                vars:
                    id: "0/qos_profile_id"

    qos_policies:
        type: array
        description: "List of QoS Class Policies"
        items:
            $merge:
                source: { $ref: '#/resources/qos_policy' }
                with:
                    relations:
                        full:
                            resource: '#/resources/qos_policy'
                            vars:
                                id: "0/id"
        links:
            self:
                path: "$/qos_policies"
                params:
                    # Allow filtering by QoS Profile id
                    qos_profile_id:
                        type: integer
                    src_site_id:
                        type: integer
                    src_site_type_id:
                        type: integer
                    all_src_sites:
                        $ref: '#/types/all'
                    dest_site_id:
                        type: integer
                    dest_site_type_id:
                        type: integer
                    all_dest_sites:
                        $ref: '#/types/all'
            get:
                method: GET
                response:
                    $ref: '#/resources/qos_policies'
            set:
                description: "Delete all the QoS policies."
                method: PUT
                request:
                    $ref: '#/types/empty_collection'
            create:
                method: POST
                description: "Creates new qos_policy. After creating qos_policy, it is recommended to change 'name' in qos_profile with new 'src to dest'."
                request:
                    $ref: '#/resources/qos_policy'
                response:
                    $ref: '#/resources/qos_policy'


    qos_rules:
        description: "List of QoS Rules"
        type: array
        items:
           $merge:
               source: { $ref: '#/resources/qos_rule' }
               with:
                   relations:
                        full:
                            resource: '#/resources/qos_rule'
                            vars: {id: "0/id"}
        links:
            self:
                path: "$/qos_rules"
                params:
                    # allow filtering by the following fields
                    qos_profile_id:
                        $ref: '#/types/identifier'
                    app_id:
                        $ref: '#/types/identifier'
                    apptag_id:
                        $ref: '#/types/identifier'
                    site_id:
                        $ref: '#/types/identifier'
                    site_type_id:
                        $ref: '#/types/identifier'

            create:
                description: "Create a new QoS Rule instance."
                method: POST
                request:
                    $ref: '#/resources/qos_rule'
                response:
                    $ref: '#/resources/qos_rule'

            get:
                description: "Get a list of references to QoS Rule instances."
                method: GET
                response:
                    $ref: '#/resources/qos_rules'

            set:
                description: "Remove all QoS Rules."
                method: PUT
                path: "$/qos_rules"
                request:
                    $ref: '#/types/empty_collection'

            move:
                description: "Update the positions of the QoS rules."
                method: PUT
                path: "$/qos_rules/move"
                request:
                    type: array
                    items:
                        $ref: '#/types/identifier'
                response:
                    $ref: '#/resources/qos_rules'

    qos_rule:
        description: "Quality of Service (QoS) Rule object"
        type: object
        additionalProperties: false
        required: [qos_profile_id]
        properties:
            id:
                $ref: '#/types/identifier'
            qos_profile_id:
                description: "ID of associated class set"
                type: integer
            app_id:
                description: "Application ID. Either Application ID or ApplicationTag ID can be specified, not both."
                anyOf:
                    - type: integer
                    - type: "null"
            apptag_id:
                description: "ApplicationTag ID. Either Application ID or ApplicationTag ID can be specified, not both."
                anyOf:
                    - type: integer
                    - type: "null"
            dscp:
                $merge:
                    source: { $ref: '#/types/dscp_rule' }
                    with: { description: "DSCP value to be set for QoS marking." }
            class_id:
                description: "Class ID for shaping purposes"
                anyOf:
                    - type: integer
                    - type: "null"
            is_default:
                type: boolean
                readOnly: true
            position:
                type: integer
                readOnly: true

        relations:
            instances:
                resource: '#/resources/qos_rules'

            # link to the qos_profile resource
            qos_profile:
                resource: '#/resources/qos_profile'
                vars:
                    id: "0/qos_profile_id"

            # Link to the class that this class-profile is about
            class:
                resource: '#/resources/class'
                vars:
                    id: "0/class_id"
        links:
            self:
                description: "Base URI for an instance of a QoS Rule"
                path: "$/qos_rules/items/{id}"

            get:
                description: "Retrieve a data representation of a QoS Rule."
                method: GET
                response:
                    $ref: '#/resources/qos_rule'

            set:
                description: "Replace the data representation for a QoS Rule"
                method: PUT
                request:
                    $ref: '#/resources/qos_rule'
                response:
                    $ref: '#/resources/qos_rule'

            delete:
                description: "Delete a QoS Rule instance."
                method: DELETE

    global_qos_config:
        description: "Global QoS config"
        type: object
        additionalProperties: false
        required: [enable_ob_qos, enable_ib_qos, enable_shaping, enable_dscp_marking]
        properties:
            enable_ob_qos:
                type: boolean
                description: "Enable Outbound QoS"
            enable_ib_qos:
                type: boolean
                description: "Enable Inbound QoS"
            enable_shaping:
                type: boolean
                description: "Enable Shaping"
            enable_dscp_marking:
                type: boolean
                description: "Enable DSCP Marking"

        links:
            self:
                path: "$/global_qos_config"
            get:
                description: "Get global QoS configuration."
                method: GET
                response:
                    $ref: '#/resources/global_qos_config'
            set:
                description: "Modify global QoS configuration."
                method: PUT
                request:
                    $ref: '#/resources/global_qos_config'
                response:
                    $ref: '#/resources/global_qos_config'

    site_qos_configs:
        description: "List of site_qos_configs"
        type: array
        items:
            type: object
            properties:
                id:
                    $merge:
                        source: { $ref: '#/types/identifier' }
                        with: { readOnly: true }
                site_id:
                    type: integer
                    description: "Source Site ID"
                site_type_id:
                    type: integer
                    description: "Source Site ID"
                enable_ob_qos:
                    type: boolean
                    description: "Enable Outbound QoS"
                enable_ib_qos:
                    type: boolean
                    description: "Enable Inbound QoS"
                enable_dscp_marking:
                    type: boolean
                    description: "Enable Shaping"

                interfaces:
                    type: array
                    items:
                        type: object
                        properties:
                            name:
                                $ref: '#/types/primary_interface'
                                $ref: '#/types/wan_interface'
                            value:
                                type: boolean
                                description: "Enable/Disable interface"
            relations:
                full:
                    resource: '#/resources/site_qos_config'
                    vars: {id: "0/id"}
        links:
            self:
                path: "$/site_qos_configs"
                params:
                    site_id:
                        $ref: '#/types/identifier'
                    site_type_id:
                        $ref: '#/types/identifier'
            create:
                description: "Create a new site_qos_config instance."
                method: POST
                request:
                    $ref: '#/resources/site_qos_config'
                response:
                    $ref: '#/resources/site_qos_config'

            get:
                description: "Get a list of references to QoS Rule instances."
                method: GET
                response:
                    $ref: '#/resources/site_qos_configs'

    site_qos_config:
        description: "Site specific qos_config"
        type: object
        additionalProperties: false
        required: [enable_ob_qos, enable_ib_qos, enable_dscp_marking]
        properties:
            id:
                $merge:
                    source: { $ref: '#/types/identifier' }
                    with: { readOnly: true }
            site_id:
                type: integer
                description: "Source Site ID"
            site_type_id:
                type: integer
                description: "Source Site ID"
            enable_ob_qos:
                type: boolean
                description: "Enable Outbound QoS"
            enable_ib_qos:
                type: boolean
                description: "Enable Inbound QoS"
            enable_dscp_marking:
                type: boolean
                description: "Enable Shaping"

            interfaces:
                type: array
                items:
                    type: object
                    additionalProperties: false
                    required: [name]
                    properties:
                        name:
                            description: "Name of Interface"
                            oneOf:
                                - $ref: '#/types/primary_interface'
                                - $ref: '#/types/wan_interface'
                        value:
                            type: boolean
                            description: "Enable/Disable interface"
        oneOf:
            - type: object
              required: [site_id]
            - type: object
              required: [site_type_id]

        relations:
            instances:
                resource: '#/resources/site_qos_configs'

        links:
            self:
                description: "Base URI for an instance of site_qos_config"
                path: "$/site_qos_configs/items/{id}"

            get:
                description: "Retrieve data representation of site_qos_config."
                method: GET
                response:
                    $ref: '#/resources/site_qos_config'

            set:
                description: "Replace the data representation for a QoS Rule."
                method: PUT
                request:
                    $ref: '#/resources/site_qos_config'
                response:
                    $ref: '#/resources/site_qos_config'

            delete:
                description: "Delete an QoS Rule instance."
                method: DELETE

    qos_policies_conflict:
        type: array
        description: "Find QoS Policy conflict"
        items:
            type: object
            additionalProperties: false
            properties:
                src_site_id:
                    type: integer
                src_site_type_id:
                    type: integer
                all_src_sites:
                    $ref: '#/types/all'
                dest_site_id:
                    type: integer
                dest_site_type_id:
                    type: integer
                all_dest_sites:
                    $ref: '#/types/all'
                qos_profile_id:
                    readOnly: true
                    type: integer
                qos_profile_name:
                    readOnly: true
                    type: string

            allOf:
                - oneOf:
                    - type: object
                      required: [src_site_id]
                    - type: object
                      required: [src_site_type_id]
                    - type: object
                      required: [all_src_sites]

                - oneOf:
                    - type: object
                      required: [dest_site_id]
                    - type: object
                      required: [dest_site_type_id]
                    - type: object
                      required: [all_dest_sites]

        links:
            self:
                path: "$/qos_policies_conflict"
            find:
                method: POST
                request:
                    $ref: '#/resources/qos_policies_conflict'
                response:
                    $ref: '#/resources/qos_policies_conflict'

    appliance_shaper_ids:
        type: object
        description: QoS shaper id and class names for a given appliance
        additionalProperties: false
        properties:
            serial:
                $merge:
                    source: { $ref: '#/types/identifier' }
                    with: { description: "Serial number of the appliance." }
            direction:
                type: string
                enum: ["outbound", "inbound"]
            data:
                type: array
                items:
                    type: object
                    required: [shaper_id, class_name]
                    additionalProperties: false
                    properties:
                        shaper_id:
                            $merge:
                                source: { $ref: '#/types/identifier' }
                                with: { description: "Reference to the Class." }
                        class_name:
                            type: string
                            description: The class name of the QoS Rule.
        links:
            self:
                path: "$/appliance_shaper_ids/{serial}/{direction}"
            get:
                description: Get a list of QoS class id's and names on an appliance.
                method: GET
                response:
                    $ref: '#/resources/appliance_shaper_ids'
