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 "github.com/go-openapi/errors" 24 "github.com/go-openapi/strfmt" 25 "github.com/go-openapi/swag" 26 "github.com/go-openapi/validate" 27) 28 29// Matcher matcher 30// 31// swagger:model matcher 32type Matcher struct { 33 34 // is equal 35 IsEqual *bool `json:"isEqual,omitempty"` 36 37 // is regex 38 // Required: true 39 IsRegex *bool `json:"isRegex"` 40 41 // name 42 // Required: true 43 Name *string `json:"name"` 44 45 // value 46 // Required: true 47 Value *string `json:"value"` 48} 49 50// Validate validates this matcher 51func (m *Matcher) Validate(formats strfmt.Registry) error { 52 var res []error 53 54 if err := m.validateIsRegex(formats); err != nil { 55 res = append(res, err) 56 } 57 58 if err := m.validateName(formats); err != nil { 59 res = append(res, err) 60 } 61 62 if err := m.validateValue(formats); err != nil { 63 res = append(res, err) 64 } 65 66 if len(res) > 0 { 67 return errors.CompositeValidationError(res...) 68 } 69 return nil 70} 71 72func (m *Matcher) validateIsRegex(formats strfmt.Registry) error { 73 74 if err := validate.Required("isRegex", "body", m.IsRegex); err != nil { 75 return err 76 } 77 78 return nil 79} 80 81func (m *Matcher) validateName(formats strfmt.Registry) error { 82 83 if err := validate.Required("name", "body", m.Name); err != nil { 84 return err 85 } 86 87 return nil 88} 89 90func (m *Matcher) validateValue(formats strfmt.Registry) error { 91 92 if err := validate.Required("value", "body", m.Value); err != nil { 93 return err 94 } 95 96 return nil 97} 98 99// MarshalBinary interface implementation 100func (m *Matcher) MarshalBinary() ([]byte, error) { 101 if m == nil { 102 return nil, nil 103 } 104 return swag.WriteJSON(m) 105} 106 107// UnmarshalBinary interface implementation 108func (m *Matcher) UnmarshalBinary(b []byte) error { 109 var res Matcher 110 if err := swag.ReadJSON(b, &res); err != nil { 111 return err 112 } 113 *m = res 114 return nil 115} 116