1// Code generated by go-swagger; DO NOT EDIT. 2 3// Copyright Prometheus Team 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package models 18 19// This file was generated by the swagger tool. 20// Editing this file might prove futile when you re-run the swagger generate command 21 22import ( 23 strfmt "github.com/go-openapi/strfmt" 24 25 "github.com/go-openapi/errors" 26 "github.com/go-openapi/swag" 27 "github.com/go-openapi/validate" 28) 29 30// Receiver receiver 31// swagger:model receiver 32type Receiver struct { 33 34 // name 35 // Required: true 36 Name *string `json:"name"` 37} 38 39// Validate validates this receiver 40func (m *Receiver) Validate(formats strfmt.Registry) error { 41 var res []error 42 43 if err := m.validateName(formats); err != nil { 44 res = append(res, err) 45 } 46 47 if len(res) > 0 { 48 return errors.CompositeValidationError(res...) 49 } 50 return nil 51} 52 53func (m *Receiver) validateName(formats strfmt.Registry) error { 54 55 if err := validate.Required("name", "body", m.Name); err != nil { 56 return err 57 } 58 59 return nil 60} 61 62// MarshalBinary interface implementation 63func (m *Receiver) MarshalBinary() ([]byte, error) { 64 if m == nil { 65 return nil, nil 66 } 67 return swag.WriteJSON(m) 68} 69 70// UnmarshalBinary interface implementation 71func (m *Receiver) UnmarshalBinary(b []byte) error { 72 var res Receiver 73 if err := swag.ReadJSON(b, &res); err != nil { 74 return err 75 } 76 *m = res 77 return nil 78} 79