jkawamoto/roadie

View on GitHub
cloud/azure/resource/models/tag_value.go

Summary

Maintainability
A
1 hr
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/swag"
)

// TagValue Tag information.
// swagger:model TagValue
type TagValue struct {

    // The tag value count.
    Count *TagCount `json:"count,omitempty"`

    // The tag ID.
    ID string `json:"id,omitempty"`

    // The tag value.
    TagValue string `json:"tagValue,omitempty"`
}

// Validate validates this tag value
func (m *TagValue) Validate(formats strfmt.Registry) error {
    var res []error

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

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

func (m *TagValue) validateCount(formats strfmt.Registry) error {

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

    if m.Count != nil {

        if err := m.Count.Validate(formats); err != nil {
            if ve, ok := err.(*errors.Validation); ok {
                return ve.ValidateName("count")
            }
            return err
        }
    }

    return nil
}