jkawamoto/roadie

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

Summary

Maintainability
A
3 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/swag"

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

// PoolStatistics Contains utilization and resource usage statistics for the lifetime of a pool.
// swagger:model PoolStatistics
type PoolStatistics struct {

    // The time at which the statistics were last updated. All statistics are limited to the range between startTime and lastUpdateTime.
    // Required: true
    LastUpdateTime *strfmt.DateTime `json:"lastUpdateTime"`

    // Statistics related to resource consumption by compute nodes in the pool.
    ResourceStats *ResourceStatistics `json:"resourceStats,omitempty"`

    // The start time of the time range covered by the statistics.
    // Required: true
    StartTime *strfmt.DateTime `json:"startTime"`

    // The URL for the statistics.
    // Required: true
    URL *string `json:"url"`

    // Statistics related to pool usage, such as the amount of core-time used.
    UsageStats *UsageStatistics `json:"usageStats,omitempty"`
}

// Validate validates this pool statistics
func (m *PoolStatistics) Validate(formats strfmt.Registry) error {
    var res []error

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

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

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

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

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

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

func (m *PoolStatistics) validateLastUpdateTime(formats strfmt.Registry) error {

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

    return nil
}

func (m *PoolStatistics) validateResourceStats(formats strfmt.Registry) error {

    if swag.IsZero(m.ResourceStats) { // not required
        return nil
    }

    if m.ResourceStats != nil {

        if err := m.ResourceStats.Validate(formats); err != nil {
            return err
        }
    }

    return nil
}

func (m *PoolStatistics) validateStartTime(formats strfmt.Registry) error {

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

    return nil
}

func (m *PoolStatistics) validateURL(formats strfmt.Registry) error {

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

    return nil
}

func (m *PoolStatistics) validateUsageStats(formats strfmt.Registry) error {

    if swag.IsZero(m.UsageStats) { // not required
        return nil
    }

    if m.UsageStats != nil {

        if err := m.UsageStats.Validate(formats); err != nil {
            return err
        }
    }

    return nil
}