jkawamoto/roadie

View on GitHub
cloud/azure/batch/models/task_id_range.go

Summary

Maintainability
B
4 hrs
Test Coverage
package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
    strfmt "github.com/go-openapi/strfmt"

    "github.com/go-openapi/errors"
    "github.com/go-openapi/validate"
)

// TaskIDRange A range of task IDs that a task can depend on. All tasks with IDs in the range must complete successfully before the dependent task can be scheduled.
//
// The start and end of the range are inclusive. For example, if a range has start 9 and end 12, then it represents tasks '9', '10', '11' and '12'.
// swagger:model TaskIdRange
type TaskIDRange struct {

    // The last task ID in the range.
    // Required: true
    End *int32 `json:"end"`

    // The first task ID in the range.
    // Required: true
    Start *int32 `json:"start"`
}

// Validate validates this task Id range
func (m *TaskIDRange) Validate(formats strfmt.Registry) error {
    var res []error

    if err := m.validateEnd(formats); err != nil {
        // prop
        res = append(res, err)
    }

    if err := m.validateStart(formats); err != nil {
        // prop
        res = append(res, err)
    }

    if len(res) > 0 {
        return errors.CompositeValidationError(res...)
    }
    return nil
}

func (m *TaskIDRange) validateEnd(formats strfmt.Registry) error {

    if err := validate.Required("end", "body", m.End); err != nil {
        return err
    }

    return nil
}

func (m *TaskIDRange) validateStart(formats strfmt.Registry) error {

    if err := validate.Required("start", "body", m.Start); err != nil {
        return err
    }

    return nil
}