104 lines
2.1 KiB
Go
104 lines
2.1 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
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"
|
|
)
|
|
|
|
// PostableSilence postable silence
|
|
// swagger:model postableSilence
|
|
type PostableSilence struct {
|
|
|
|
// id
|
|
ID string `json:"id,omitempty"`
|
|
|
|
Silence
|
|
}
|
|
|
|
// UnmarshalJSON unmarshals this object from a JSON structure
|
|
func (m *PostableSilence) UnmarshalJSON(raw []byte) error {
|
|
// AO0
|
|
var dataAO0 struct {
|
|
ID string `json:"id,omitempty"`
|
|
}
|
|
if err := swag.ReadJSON(raw, &dataAO0); err != nil {
|
|
return err
|
|
}
|
|
|
|
m.ID = dataAO0.ID
|
|
|
|
// AO1
|
|
var aO1 Silence
|
|
if err := swag.ReadJSON(raw, &aO1); err != nil {
|
|
return err
|
|
}
|
|
m.Silence = aO1
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON marshals this object to a JSON structure
|
|
func (m PostableSilence) MarshalJSON() ([]byte, error) {
|
|
_parts := make([][]byte, 0, 2)
|
|
|
|
var dataAO0 struct {
|
|
ID string `json:"id,omitempty"`
|
|
}
|
|
|
|
dataAO0.ID = m.ID
|
|
|
|
jsonDataAO0, errAO0 := swag.WriteJSON(dataAO0)
|
|
if errAO0 != nil {
|
|
return nil, errAO0
|
|
}
|
|
_parts = append(_parts, jsonDataAO0)
|
|
|
|
aO1, err := swag.WriteJSON(m.Silence)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
_parts = append(_parts, aO1)
|
|
|
|
return swag.ConcatJSON(_parts...), nil
|
|
}
|
|
|
|
// Validate validates this postable silence
|
|
func (m *PostableSilence) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
// validation for a type composition with Silence
|
|
if err := m.Silence.Validate(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *PostableSilence) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *PostableSilence) UnmarshalBinary(b []byte) error {
|
|
var res PostableSilence
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|