...

Source file src/github.com/prometheus/alertmanager/api/v2/models/peer_status.go

Documentation: github.com/prometheus/alertmanager/api/v2/models

     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  
    17  package 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  
    22  import (
    23  	"context"
    24  
    25  	"github.com/go-openapi/errors"
    26  	"github.com/go-openapi/strfmt"
    27  	"github.com/go-openapi/swag"
    28  	"github.com/go-openapi/validate"
    29  )
    30  
    31  // PeerStatus peer status
    32  //
    33  // swagger:model peerStatus
    34  type PeerStatus struct {
    35  
    36  	// address
    37  	// Required: true
    38  	Address *string `json:"address"`
    39  
    40  	// name
    41  	// Required: true
    42  	Name *string `json:"name"`
    43  }
    44  
    45  // Validate validates this peer status
    46  func (m *PeerStatus) Validate(formats strfmt.Registry) error {
    47  	var res []error
    48  
    49  	if err := m.validateAddress(formats); err != nil {
    50  		res = append(res, err)
    51  	}
    52  
    53  	if err := m.validateName(formats); err != nil {
    54  		res = append(res, err)
    55  	}
    56  
    57  	if len(res) > 0 {
    58  		return errors.CompositeValidationError(res...)
    59  	}
    60  	return nil
    61  }
    62  
    63  func (m *PeerStatus) validateAddress(formats strfmt.Registry) error {
    64  
    65  	if err := validate.Required("address", "body", m.Address); err != nil {
    66  		return err
    67  	}
    68  
    69  	return nil
    70  }
    71  
    72  func (m *PeerStatus) validateName(formats strfmt.Registry) error {
    73  
    74  	if err := validate.Required("name", "body", m.Name); err != nil {
    75  		return err
    76  	}
    77  
    78  	return nil
    79  }
    80  
    81  // ContextValidate validates this peer status based on context it is used
    82  func (m *PeerStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    83  	return nil
    84  }
    85  
    86  // MarshalBinary interface implementation
    87  func (m *PeerStatus) MarshalBinary() ([]byte, error) {
    88  	if m == nil {
    89  		return nil, nil
    90  	}
    91  	return swag.WriteJSON(m)
    92  }
    93  
    94  // UnmarshalBinary interface implementation
    95  func (m *PeerStatus) UnmarshalBinary(b []byte) error {
    96  	var res PeerStatus
    97  	if err := swag.ReadJSON(b, &res); err != nil {
    98  		return err
    99  	}
   100  	*m = res
   101  	return nil
   102  }
   103  

View as plain text