alertmanager/api/v2/models/postable_silence.go
Paul Gier 458f1d646b Makefile improvements
- make clean shouldn't print errors when files/directories have already
been removed
- add copyright header to generated api files to pass license check

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-03-11 10:45:45 -05:00

118 lines
2.6 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
// Copyright Prometheus Team
// 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"
)
// 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
}