...

Source file src/github.com/sigstore/rekor/pkg/generated/models/rfc3161_v001_schema.go

Documentation: github.com/sigstore/rekor/pkg/generated/models

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  //
     4  // Copyright 2021 The Sigstore Authors.
     5  //
     6  // Licensed under the Apache License, Version 2.0 (the "License");
     7  // you may not use this file except in compliance with the License.
     8  // You may obtain a copy of the License at
     9  //
    10  //     http://www.apache.org/licenses/LICENSE-2.0
    11  //
    12  // Unless required by applicable law or agreed to in writing, software
    13  // distributed under the License is distributed on an "AS IS" BASIS,
    14  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15  // See the License for the specific language governing permissions and
    16  // limitations under the License.
    17  //
    18  
    19  package models
    20  
    21  // This file was generated by the swagger tool.
    22  // Editing this file might prove futile when you re-run the swagger generate command
    23  
    24  import (
    25  	"context"
    26  
    27  	"github.com/go-openapi/errors"
    28  	"github.com/go-openapi/strfmt"
    29  	"github.com/go-openapi/swag"
    30  	"github.com/go-openapi/validate"
    31  )
    32  
    33  // Rfc3161V001Schema Timestamp v0.0.1 Schema
    34  //
    35  // # Schema for RFC3161 entries
    36  //
    37  // swagger:model rfc3161V001Schema
    38  type Rfc3161V001Schema struct {
    39  
    40  	// tsr
    41  	// Required: true
    42  	Tsr *Rfc3161V001SchemaTsr `json:"tsr"`
    43  }
    44  
    45  // Validate validates this rfc3161 v001 schema
    46  func (m *Rfc3161V001Schema) Validate(formats strfmt.Registry) error {
    47  	var res []error
    48  
    49  	if err := m.validateTsr(formats); err != nil {
    50  		res = append(res, err)
    51  	}
    52  
    53  	if len(res) > 0 {
    54  		return errors.CompositeValidationError(res...)
    55  	}
    56  	return nil
    57  }
    58  
    59  func (m *Rfc3161V001Schema) validateTsr(formats strfmt.Registry) error {
    60  
    61  	if err := validate.Required("tsr", "body", m.Tsr); err != nil {
    62  		return err
    63  	}
    64  
    65  	if m.Tsr != nil {
    66  		if err := m.Tsr.Validate(formats); err != nil {
    67  			if ve, ok := err.(*errors.Validation); ok {
    68  				return ve.ValidateName("tsr")
    69  			} else if ce, ok := err.(*errors.CompositeError); ok {
    70  				return ce.ValidateName("tsr")
    71  			}
    72  			return err
    73  		}
    74  	}
    75  
    76  	return nil
    77  }
    78  
    79  // ContextValidate validate this rfc3161 v001 schema based on the context it is used
    80  func (m *Rfc3161V001Schema) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    81  	var res []error
    82  
    83  	if err := m.contextValidateTsr(ctx, formats); err != nil {
    84  		res = append(res, err)
    85  	}
    86  
    87  	if len(res) > 0 {
    88  		return errors.CompositeValidationError(res...)
    89  	}
    90  	return nil
    91  }
    92  
    93  func (m *Rfc3161V001Schema) contextValidateTsr(ctx context.Context, formats strfmt.Registry) error {
    94  
    95  	if m.Tsr != nil {
    96  
    97  		if err := m.Tsr.ContextValidate(ctx, formats); err != nil {
    98  			if ve, ok := err.(*errors.Validation); ok {
    99  				return ve.ValidateName("tsr")
   100  			} else if ce, ok := err.(*errors.CompositeError); ok {
   101  				return ce.ValidateName("tsr")
   102  			}
   103  			return err
   104  		}
   105  	}
   106  
   107  	return nil
   108  }
   109  
   110  // MarshalBinary interface implementation
   111  func (m *Rfc3161V001Schema) MarshalBinary() ([]byte, error) {
   112  	if m == nil {
   113  		return nil, nil
   114  	}
   115  	return swag.WriteJSON(m)
   116  }
   117  
   118  // UnmarshalBinary interface implementation
   119  func (m *Rfc3161V001Schema) UnmarshalBinary(b []byte) error {
   120  	var res Rfc3161V001Schema
   121  	if err := swag.ReadJSON(b, &res); err != nil {
   122  		return err
   123  	}
   124  	*m = res
   125  	return nil
   126  }
   127  
   128  // Rfc3161V001SchemaTsr Information about the tsr file associated with the entry
   129  //
   130  // swagger:model Rfc3161V001SchemaTsr
   131  type Rfc3161V001SchemaTsr struct {
   132  
   133  	// Specifies the tsr file content inline within the document
   134  	// Required: true
   135  	// Format: byte
   136  	Content *strfmt.Base64 `json:"content"`
   137  }
   138  
   139  // Validate validates this rfc3161 v001 schema tsr
   140  func (m *Rfc3161V001SchemaTsr) Validate(formats strfmt.Registry) error {
   141  	var res []error
   142  
   143  	if err := m.validateContent(formats); err != nil {
   144  		res = append(res, err)
   145  	}
   146  
   147  	if len(res) > 0 {
   148  		return errors.CompositeValidationError(res...)
   149  	}
   150  	return nil
   151  }
   152  
   153  func (m *Rfc3161V001SchemaTsr) validateContent(formats strfmt.Registry) error {
   154  
   155  	if err := validate.Required("tsr"+"."+"content", "body", m.Content); err != nil {
   156  		return err
   157  	}
   158  
   159  	return nil
   160  }
   161  
   162  // ContextValidate validates this rfc3161 v001 schema tsr based on context it is used
   163  func (m *Rfc3161V001SchemaTsr) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   164  	return nil
   165  }
   166  
   167  // MarshalBinary interface implementation
   168  func (m *Rfc3161V001SchemaTsr) MarshalBinary() ([]byte, error) {
   169  	if m == nil {
   170  		return nil, nil
   171  	}
   172  	return swag.WriteJSON(m)
   173  }
   174  
   175  // UnmarshalBinary interface implementation
   176  func (m *Rfc3161V001SchemaTsr) UnmarshalBinary(b []byte) error {
   177  	var res Rfc3161V001SchemaTsr
   178  	if err := swag.ReadJSON(b, &res); err != nil {
   179  		return err
   180  	}
   181  	*m = res
   182  	return nil
   183  }
   184  

View as plain text