blob: 740c074860e4a00df16c39b4310c036779dcdbec [file] [log] [blame]
// Code generated by go-swagger; DO NOT EDIT.
// Copyright 2018 The go-netbox Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
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"
"github.com/go-openapi/validate"
)
// ExportTemplate export template
// swagger:model ExportTemplate
type ExportTemplate struct {
// Content type
// Required: true
ContentType *int64 `json:"content_type"`
// Description
// Max Length: 200
Description string `json:"description,omitempty"`
// File extension
// Max Length: 15
FileExtension string `json:"file_extension,omitempty"`
// ID
// Read Only: true
ID int64 `json:"id,omitempty"`
// Mime type
// Max Length: 15
MimeType string `json:"mime_type,omitempty"`
// Name
// Required: true
// Max Length: 100
Name *string `json:"name"`
// Template code
// Required: true
TemplateCode *string `json:"template_code"`
}
// Validate validates this export template
func (m *ExportTemplate) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateContentType(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateDescription(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateFileExtension(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateMimeType(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateTemplateCode(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ExportTemplate) validateContentType(formats strfmt.Registry) error {
if err := validate.Required("content_type", "body", m.ContentType); err != nil {
return err
}
return nil
}
func (m *ExportTemplate) validateDescription(formats strfmt.Registry) error {
if swag.IsZero(m.Description) { // not required
return nil
}
if err := validate.MaxLength("description", "body", string(m.Description), 200); err != nil {
return err
}
return nil
}
func (m *ExportTemplate) validateFileExtension(formats strfmt.Registry) error {
if swag.IsZero(m.FileExtension) { // not required
return nil
}
if err := validate.MaxLength("file_extension", "body", string(m.FileExtension), 15); err != nil {
return err
}
return nil
}
func (m *ExportTemplate) validateMimeType(formats strfmt.Registry) error {
if swag.IsZero(m.MimeType) { // not required
return nil
}
if err := validate.MaxLength("mime_type", "body", string(m.MimeType), 15); err != nil {
return err
}
return nil
}
func (m *ExportTemplate) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
if err := validate.MaxLength("name", "body", string(*m.Name), 100); err != nil {
return err
}
return nil
}
func (m *ExportTemplate) validateTemplateCode(formats strfmt.Registry) error {
if err := validate.Required("template_code", "body", m.TemplateCode); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *ExportTemplate) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ExportTemplate) UnmarshalBinary(b []byte) error {
var res ExportTemplate
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}