...

Source file src/github.com/sigstore/rekor/pkg/generated/models/inactive_shard_log_info.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  // InactiveShardLogInfo inactive shard log info
    34  //
    35  // swagger:model InactiveShardLogInfo
    36  type InactiveShardLogInfo struct {
    37  
    38  	// The current hash value stored at the root of the merkle tree
    39  	// Required: true
    40  	// Pattern: ^[0-9a-fA-F]{64}$
    41  	RootHash *string `json:"rootHash"`
    42  
    43  	// The current signed tree head
    44  	// Required: true
    45  	SignedTreeHead *string `json:"signedTreeHead"`
    46  
    47  	// The current treeID
    48  	// Required: true
    49  	// Pattern: ^[0-9]+$
    50  	TreeID *string `json:"treeID"`
    51  
    52  	// The current number of nodes in the merkle tree
    53  	// Required: true
    54  	// Minimum: 1
    55  	TreeSize *int64 `json:"treeSize"`
    56  }
    57  
    58  // Validate validates this inactive shard log info
    59  func (m *InactiveShardLogInfo) Validate(formats strfmt.Registry) error {
    60  	var res []error
    61  
    62  	if err := m.validateRootHash(formats); err != nil {
    63  		res = append(res, err)
    64  	}
    65  
    66  	if err := m.validateSignedTreeHead(formats); err != nil {
    67  		res = append(res, err)
    68  	}
    69  
    70  	if err := m.validateTreeID(formats); err != nil {
    71  		res = append(res, err)
    72  	}
    73  
    74  	if err := m.validateTreeSize(formats); err != nil {
    75  		res = append(res, err)
    76  	}
    77  
    78  	if len(res) > 0 {
    79  		return errors.CompositeValidationError(res...)
    80  	}
    81  	return nil
    82  }
    83  
    84  func (m *InactiveShardLogInfo) validateRootHash(formats strfmt.Registry) error {
    85  
    86  	if err := validate.Required("rootHash", "body", m.RootHash); err != nil {
    87  		return err
    88  	}
    89  
    90  	if err := validate.Pattern("rootHash", "body", *m.RootHash, `^[0-9a-fA-F]{64}$`); err != nil {
    91  		return err
    92  	}
    93  
    94  	return nil
    95  }
    96  
    97  func (m *InactiveShardLogInfo) validateSignedTreeHead(formats strfmt.Registry) error {
    98  
    99  	if err := validate.Required("signedTreeHead", "body", m.SignedTreeHead); err != nil {
   100  		return err
   101  	}
   102  
   103  	return nil
   104  }
   105  
   106  func (m *InactiveShardLogInfo) validateTreeID(formats strfmt.Registry) error {
   107  
   108  	if err := validate.Required("treeID", "body", m.TreeID); err != nil {
   109  		return err
   110  	}
   111  
   112  	if err := validate.Pattern("treeID", "body", *m.TreeID, `^[0-9]+$`); err != nil {
   113  		return err
   114  	}
   115  
   116  	return nil
   117  }
   118  
   119  func (m *InactiveShardLogInfo) validateTreeSize(formats strfmt.Registry) error {
   120  
   121  	if err := validate.Required("treeSize", "body", m.TreeSize); err != nil {
   122  		return err
   123  	}
   124  
   125  	if err := validate.MinimumInt("treeSize", "body", *m.TreeSize, 1, false); err != nil {
   126  		return err
   127  	}
   128  
   129  	return nil
   130  }
   131  
   132  // ContextValidate validates this inactive shard log info based on context it is used
   133  func (m *InactiveShardLogInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   134  	return nil
   135  }
   136  
   137  // MarshalBinary interface implementation
   138  func (m *InactiveShardLogInfo) MarshalBinary() ([]byte, error) {
   139  	if m == nil {
   140  		return nil, nil
   141  	}
   142  	return swag.WriteJSON(m)
   143  }
   144  
   145  // UnmarshalBinary interface implementation
   146  func (m *InactiveShardLogInfo) UnmarshalBinary(b []byte) error {
   147  	var res InactiveShardLogInfo
   148  	if err := swag.ReadJSON(b, &res); err != nil {
   149  		return err
   150  	}
   151  	*m = res
   152  	return nil
   153  }
   154  

View as plain text