...

Source file src/github.com/prometheus/alertmanager/api/v2/models/version_info.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  // VersionInfo version info
    32  //
    33  // swagger:model versionInfo
    34  type VersionInfo struct {
    35  
    36  	// branch
    37  	// Required: true
    38  	Branch *string `json:"branch"`
    39  
    40  	// build date
    41  	// Required: true
    42  	BuildDate *string `json:"buildDate"`
    43  
    44  	// build user
    45  	// Required: true
    46  	BuildUser *string `json:"buildUser"`
    47  
    48  	// go version
    49  	// Required: true
    50  	GoVersion *string `json:"goVersion"`
    51  
    52  	// revision
    53  	// Required: true
    54  	Revision *string `json:"revision"`
    55  
    56  	// version
    57  	// Required: true
    58  	Version *string `json:"version"`
    59  }
    60  
    61  // Validate validates this version info
    62  func (m *VersionInfo) Validate(formats strfmt.Registry) error {
    63  	var res []error
    64  
    65  	if err := m.validateBranch(formats); err != nil {
    66  		res = append(res, err)
    67  	}
    68  
    69  	if err := m.validateBuildDate(formats); err != nil {
    70  		res = append(res, err)
    71  	}
    72  
    73  	if err := m.validateBuildUser(formats); err != nil {
    74  		res = append(res, err)
    75  	}
    76  
    77  	if err := m.validateGoVersion(formats); err != nil {
    78  		res = append(res, err)
    79  	}
    80  
    81  	if err := m.validateRevision(formats); err != nil {
    82  		res = append(res, err)
    83  	}
    84  
    85  	if err := m.validateVersion(formats); err != nil {
    86  		res = append(res, err)
    87  	}
    88  
    89  	if len(res) > 0 {
    90  		return errors.CompositeValidationError(res...)
    91  	}
    92  	return nil
    93  }
    94  
    95  func (m *VersionInfo) validateBranch(formats strfmt.Registry) error {
    96  
    97  	if err := validate.Required("branch", "body", m.Branch); err != nil {
    98  		return err
    99  	}
   100  
   101  	return nil
   102  }
   103  
   104  func (m *VersionInfo) validateBuildDate(formats strfmt.Registry) error {
   105  
   106  	if err := validate.Required("buildDate", "body", m.BuildDate); err != nil {
   107  		return err
   108  	}
   109  
   110  	return nil
   111  }
   112  
   113  func (m *VersionInfo) validateBuildUser(formats strfmt.Registry) error {
   114  
   115  	if err := validate.Required("buildUser", "body", m.BuildUser); err != nil {
   116  		return err
   117  	}
   118  
   119  	return nil
   120  }
   121  
   122  func (m *VersionInfo) validateGoVersion(formats strfmt.Registry) error {
   123  
   124  	if err := validate.Required("goVersion", "body", m.GoVersion); err != nil {
   125  		return err
   126  	}
   127  
   128  	return nil
   129  }
   130  
   131  func (m *VersionInfo) validateRevision(formats strfmt.Registry) error {
   132  
   133  	if err := validate.Required("revision", "body", m.Revision); err != nil {
   134  		return err
   135  	}
   136  
   137  	return nil
   138  }
   139  
   140  func (m *VersionInfo) validateVersion(formats strfmt.Registry) error {
   141  
   142  	if err := validate.Required("version", "body", m.Version); err != nil {
   143  		return err
   144  	}
   145  
   146  	return nil
   147  }
   148  
   149  // ContextValidate validates this version info based on context it is used
   150  func (m *VersionInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   151  	return nil
   152  }
   153  
   154  // MarshalBinary interface implementation
   155  func (m *VersionInfo) MarshalBinary() ([]byte, error) {
   156  	if m == nil {
   157  		return nil, nil
   158  	}
   159  	return swag.WriteJSON(m)
   160  }
   161  
   162  // UnmarshalBinary interface implementation
   163  func (m *VersionInfo) UnmarshalBinary(b []byte) error {
   164  	var res VersionInfo
   165  	if err := swag.ReadJSON(b, &res); err != nil {
   166  		return err
   167  	}
   168  	*m = res
   169  	return nil
   170  }
   171  

View as plain text