...

Source file src/github.com/sigstore/rekor/pkg/generated/models/helm_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  	"encoding/json"
    27  
    28  	"github.com/go-openapi/errors"
    29  	"github.com/go-openapi/strfmt"
    30  	"github.com/go-openapi/swag"
    31  	"github.com/go-openapi/validate"
    32  )
    33  
    34  // HelmV001Schema Helm v0.0.1 Schema
    35  //
    36  // # Schema for Helm object
    37  //
    38  // swagger:model helmV001Schema
    39  type HelmV001Schema struct {
    40  
    41  	// chart
    42  	// Required: true
    43  	Chart *HelmV001SchemaChart `json:"chart"`
    44  
    45  	// public key
    46  	// Required: true
    47  	PublicKey *HelmV001SchemaPublicKey `json:"publicKey"`
    48  }
    49  
    50  // Validate validates this helm v001 schema
    51  func (m *HelmV001Schema) Validate(formats strfmt.Registry) error {
    52  	var res []error
    53  
    54  	if err := m.validateChart(formats); err != nil {
    55  		res = append(res, err)
    56  	}
    57  
    58  	if err := m.validatePublicKey(formats); err != nil {
    59  		res = append(res, err)
    60  	}
    61  
    62  	if len(res) > 0 {
    63  		return errors.CompositeValidationError(res...)
    64  	}
    65  	return nil
    66  }
    67  
    68  func (m *HelmV001Schema) validateChart(formats strfmt.Registry) error {
    69  
    70  	if err := validate.Required("chart", "body", m.Chart); err != nil {
    71  		return err
    72  	}
    73  
    74  	if m.Chart != nil {
    75  		if err := m.Chart.Validate(formats); err != nil {
    76  			if ve, ok := err.(*errors.Validation); ok {
    77  				return ve.ValidateName("chart")
    78  			} else if ce, ok := err.(*errors.CompositeError); ok {
    79  				return ce.ValidateName("chart")
    80  			}
    81  			return err
    82  		}
    83  	}
    84  
    85  	return nil
    86  }
    87  
    88  func (m *HelmV001Schema) validatePublicKey(formats strfmt.Registry) error {
    89  
    90  	if err := validate.Required("publicKey", "body", m.PublicKey); err != nil {
    91  		return err
    92  	}
    93  
    94  	if m.PublicKey != nil {
    95  		if err := m.PublicKey.Validate(formats); err != nil {
    96  			if ve, ok := err.(*errors.Validation); ok {
    97  				return ve.ValidateName("publicKey")
    98  			} else if ce, ok := err.(*errors.CompositeError); ok {
    99  				return ce.ValidateName("publicKey")
   100  			}
   101  			return err
   102  		}
   103  	}
   104  
   105  	return nil
   106  }
   107  
   108  // ContextValidate validate this helm v001 schema based on the context it is used
   109  func (m *HelmV001Schema) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   110  	var res []error
   111  
   112  	if err := m.contextValidateChart(ctx, formats); err != nil {
   113  		res = append(res, err)
   114  	}
   115  
   116  	if err := m.contextValidatePublicKey(ctx, formats); err != nil {
   117  		res = append(res, err)
   118  	}
   119  
   120  	if len(res) > 0 {
   121  		return errors.CompositeValidationError(res...)
   122  	}
   123  	return nil
   124  }
   125  
   126  func (m *HelmV001Schema) contextValidateChart(ctx context.Context, formats strfmt.Registry) error {
   127  
   128  	if m.Chart != nil {
   129  
   130  		if err := m.Chart.ContextValidate(ctx, formats); err != nil {
   131  			if ve, ok := err.(*errors.Validation); ok {
   132  				return ve.ValidateName("chart")
   133  			} else if ce, ok := err.(*errors.CompositeError); ok {
   134  				return ce.ValidateName("chart")
   135  			}
   136  			return err
   137  		}
   138  	}
   139  
   140  	return nil
   141  }
   142  
   143  func (m *HelmV001Schema) contextValidatePublicKey(ctx context.Context, formats strfmt.Registry) error {
   144  
   145  	if m.PublicKey != nil {
   146  
   147  		if err := m.PublicKey.ContextValidate(ctx, formats); err != nil {
   148  			if ve, ok := err.(*errors.Validation); ok {
   149  				return ve.ValidateName("publicKey")
   150  			} else if ce, ok := err.(*errors.CompositeError); ok {
   151  				return ce.ValidateName("publicKey")
   152  			}
   153  			return err
   154  		}
   155  	}
   156  
   157  	return nil
   158  }
   159  
   160  // MarshalBinary interface implementation
   161  func (m *HelmV001Schema) MarshalBinary() ([]byte, error) {
   162  	if m == nil {
   163  		return nil, nil
   164  	}
   165  	return swag.WriteJSON(m)
   166  }
   167  
   168  // UnmarshalBinary interface implementation
   169  func (m *HelmV001Schema) UnmarshalBinary(b []byte) error {
   170  	var res HelmV001Schema
   171  	if err := swag.ReadJSON(b, &res); err != nil {
   172  		return err
   173  	}
   174  	*m = res
   175  	return nil
   176  }
   177  
   178  // HelmV001SchemaChart Information about the Helm chart associated with the entry
   179  //
   180  // swagger:model HelmV001SchemaChart
   181  type HelmV001SchemaChart struct {
   182  
   183  	// hash
   184  	Hash *HelmV001SchemaChartHash `json:"hash,omitempty"`
   185  
   186  	// provenance
   187  	// Required: true
   188  	Provenance *HelmV001SchemaChartProvenance `json:"provenance"`
   189  }
   190  
   191  // Validate validates this helm v001 schema chart
   192  func (m *HelmV001SchemaChart) Validate(formats strfmt.Registry) error {
   193  	var res []error
   194  
   195  	if err := m.validateHash(formats); err != nil {
   196  		res = append(res, err)
   197  	}
   198  
   199  	if err := m.validateProvenance(formats); err != nil {
   200  		res = append(res, err)
   201  	}
   202  
   203  	if len(res) > 0 {
   204  		return errors.CompositeValidationError(res...)
   205  	}
   206  	return nil
   207  }
   208  
   209  func (m *HelmV001SchemaChart) validateHash(formats strfmt.Registry) error {
   210  	if swag.IsZero(m.Hash) { // not required
   211  		return nil
   212  	}
   213  
   214  	if m.Hash != nil {
   215  		if err := m.Hash.Validate(formats); err != nil {
   216  			if ve, ok := err.(*errors.Validation); ok {
   217  				return ve.ValidateName("chart" + "." + "hash")
   218  			} else if ce, ok := err.(*errors.CompositeError); ok {
   219  				return ce.ValidateName("chart" + "." + "hash")
   220  			}
   221  			return err
   222  		}
   223  	}
   224  
   225  	return nil
   226  }
   227  
   228  func (m *HelmV001SchemaChart) validateProvenance(formats strfmt.Registry) error {
   229  
   230  	if err := validate.Required("chart"+"."+"provenance", "body", m.Provenance); err != nil {
   231  		return err
   232  	}
   233  
   234  	if m.Provenance != nil {
   235  		if err := m.Provenance.Validate(formats); err != nil {
   236  			if ve, ok := err.(*errors.Validation); ok {
   237  				return ve.ValidateName("chart" + "." + "provenance")
   238  			} else if ce, ok := err.(*errors.CompositeError); ok {
   239  				return ce.ValidateName("chart" + "." + "provenance")
   240  			}
   241  			return err
   242  		}
   243  	}
   244  
   245  	return nil
   246  }
   247  
   248  // ContextValidate validate this helm v001 schema chart based on the context it is used
   249  func (m *HelmV001SchemaChart) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   250  	var res []error
   251  
   252  	if err := m.contextValidateHash(ctx, formats); err != nil {
   253  		res = append(res, err)
   254  	}
   255  
   256  	if err := m.contextValidateProvenance(ctx, formats); err != nil {
   257  		res = append(res, err)
   258  	}
   259  
   260  	if len(res) > 0 {
   261  		return errors.CompositeValidationError(res...)
   262  	}
   263  	return nil
   264  }
   265  
   266  func (m *HelmV001SchemaChart) contextValidateHash(ctx context.Context, formats strfmt.Registry) error {
   267  
   268  	if m.Hash != nil {
   269  
   270  		if swag.IsZero(m.Hash) { // not required
   271  			return nil
   272  		}
   273  
   274  		if err := m.Hash.ContextValidate(ctx, formats); err != nil {
   275  			if ve, ok := err.(*errors.Validation); ok {
   276  				return ve.ValidateName("chart" + "." + "hash")
   277  			} else if ce, ok := err.(*errors.CompositeError); ok {
   278  				return ce.ValidateName("chart" + "." + "hash")
   279  			}
   280  			return err
   281  		}
   282  	}
   283  
   284  	return nil
   285  }
   286  
   287  func (m *HelmV001SchemaChart) contextValidateProvenance(ctx context.Context, formats strfmt.Registry) error {
   288  
   289  	if m.Provenance != nil {
   290  
   291  		if err := m.Provenance.ContextValidate(ctx, formats); err != nil {
   292  			if ve, ok := err.(*errors.Validation); ok {
   293  				return ve.ValidateName("chart" + "." + "provenance")
   294  			} else if ce, ok := err.(*errors.CompositeError); ok {
   295  				return ce.ValidateName("chart" + "." + "provenance")
   296  			}
   297  			return err
   298  		}
   299  	}
   300  
   301  	return nil
   302  }
   303  
   304  // MarshalBinary interface implementation
   305  func (m *HelmV001SchemaChart) MarshalBinary() ([]byte, error) {
   306  	if m == nil {
   307  		return nil, nil
   308  	}
   309  	return swag.WriteJSON(m)
   310  }
   311  
   312  // UnmarshalBinary interface implementation
   313  func (m *HelmV001SchemaChart) UnmarshalBinary(b []byte) error {
   314  	var res HelmV001SchemaChart
   315  	if err := swag.ReadJSON(b, &res); err != nil {
   316  		return err
   317  	}
   318  	*m = res
   319  	return nil
   320  }
   321  
   322  // HelmV001SchemaChartHash Specifies the hash algorithm and value for the chart
   323  //
   324  // swagger:model HelmV001SchemaChartHash
   325  type HelmV001SchemaChartHash struct {
   326  
   327  	// The hashing function used to compute the hash value
   328  	// Required: true
   329  	// Enum: [sha256]
   330  	Algorithm *string `json:"algorithm"`
   331  
   332  	// The hash value for the chart
   333  	// Required: true
   334  	Value *string `json:"value"`
   335  }
   336  
   337  // Validate validates this helm v001 schema chart hash
   338  func (m *HelmV001SchemaChartHash) Validate(formats strfmt.Registry) error {
   339  	var res []error
   340  
   341  	if err := m.validateAlgorithm(formats); err != nil {
   342  		res = append(res, err)
   343  	}
   344  
   345  	if err := m.validateValue(formats); err != nil {
   346  		res = append(res, err)
   347  	}
   348  
   349  	if len(res) > 0 {
   350  		return errors.CompositeValidationError(res...)
   351  	}
   352  	return nil
   353  }
   354  
   355  var helmV001SchemaChartHashTypeAlgorithmPropEnum []interface{}
   356  
   357  func init() {
   358  	var res []string
   359  	if err := json.Unmarshal([]byte(`["sha256"]`), &res); err != nil {
   360  		panic(err)
   361  	}
   362  	for _, v := range res {
   363  		helmV001SchemaChartHashTypeAlgorithmPropEnum = append(helmV001SchemaChartHashTypeAlgorithmPropEnum, v)
   364  	}
   365  }
   366  
   367  const (
   368  
   369  	// HelmV001SchemaChartHashAlgorithmSha256 captures enum value "sha256"
   370  	HelmV001SchemaChartHashAlgorithmSha256 string = "sha256"
   371  )
   372  
   373  // prop value enum
   374  func (m *HelmV001SchemaChartHash) validateAlgorithmEnum(path, location string, value string) error {
   375  	if err := validate.EnumCase(path, location, value, helmV001SchemaChartHashTypeAlgorithmPropEnum, true); err != nil {
   376  		return err
   377  	}
   378  	return nil
   379  }
   380  
   381  func (m *HelmV001SchemaChartHash) validateAlgorithm(formats strfmt.Registry) error {
   382  
   383  	if err := validate.Required("chart"+"."+"hash"+"."+"algorithm", "body", m.Algorithm); err != nil {
   384  		return err
   385  	}
   386  
   387  	// value enum
   388  	if err := m.validateAlgorithmEnum("chart"+"."+"hash"+"."+"algorithm", "body", *m.Algorithm); err != nil {
   389  		return err
   390  	}
   391  
   392  	return nil
   393  }
   394  
   395  func (m *HelmV001SchemaChartHash) validateValue(formats strfmt.Registry) error {
   396  
   397  	if err := validate.Required("chart"+"."+"hash"+"."+"value", "body", m.Value); err != nil {
   398  		return err
   399  	}
   400  
   401  	return nil
   402  }
   403  
   404  // ContextValidate validate this helm v001 schema chart hash based on the context it is used
   405  func (m *HelmV001SchemaChartHash) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   406  	var res []error
   407  
   408  	if len(res) > 0 {
   409  		return errors.CompositeValidationError(res...)
   410  	}
   411  	return nil
   412  }
   413  
   414  // MarshalBinary interface implementation
   415  func (m *HelmV001SchemaChartHash) MarshalBinary() ([]byte, error) {
   416  	if m == nil {
   417  		return nil, nil
   418  	}
   419  	return swag.WriteJSON(m)
   420  }
   421  
   422  // UnmarshalBinary interface implementation
   423  func (m *HelmV001SchemaChartHash) UnmarshalBinary(b []byte) error {
   424  	var res HelmV001SchemaChartHash
   425  	if err := swag.ReadJSON(b, &res); err != nil {
   426  		return err
   427  	}
   428  	*m = res
   429  	return nil
   430  }
   431  
   432  // HelmV001SchemaChartProvenance The provenance entry associated with the signed Helm Chart
   433  //
   434  // swagger:model HelmV001SchemaChartProvenance
   435  type HelmV001SchemaChartProvenance struct {
   436  
   437  	// Specifies the content of the provenance file inline within the document
   438  	// Format: byte
   439  	Content strfmt.Base64 `json:"content,omitempty"`
   440  
   441  	// signature
   442  	Signature *HelmV001SchemaChartProvenanceSignature `json:"signature,omitempty"`
   443  }
   444  
   445  // Validate validates this helm v001 schema chart provenance
   446  func (m *HelmV001SchemaChartProvenance) Validate(formats strfmt.Registry) error {
   447  	var res []error
   448  
   449  	if err := m.validateSignature(formats); err != nil {
   450  		res = append(res, err)
   451  	}
   452  
   453  	if len(res) > 0 {
   454  		return errors.CompositeValidationError(res...)
   455  	}
   456  	return nil
   457  }
   458  
   459  func (m *HelmV001SchemaChartProvenance) validateSignature(formats strfmt.Registry) error {
   460  	if swag.IsZero(m.Signature) { // not required
   461  		return nil
   462  	}
   463  
   464  	if m.Signature != nil {
   465  		if err := m.Signature.Validate(formats); err != nil {
   466  			if ve, ok := err.(*errors.Validation); ok {
   467  				return ve.ValidateName("chart" + "." + "provenance" + "." + "signature")
   468  			} else if ce, ok := err.(*errors.CompositeError); ok {
   469  				return ce.ValidateName("chart" + "." + "provenance" + "." + "signature")
   470  			}
   471  			return err
   472  		}
   473  	}
   474  
   475  	return nil
   476  }
   477  
   478  // ContextValidate validate this helm v001 schema chart provenance based on the context it is used
   479  func (m *HelmV001SchemaChartProvenance) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   480  	var res []error
   481  
   482  	if err := m.contextValidateSignature(ctx, formats); err != nil {
   483  		res = append(res, err)
   484  	}
   485  
   486  	if len(res) > 0 {
   487  		return errors.CompositeValidationError(res...)
   488  	}
   489  	return nil
   490  }
   491  
   492  func (m *HelmV001SchemaChartProvenance) contextValidateSignature(ctx context.Context, formats strfmt.Registry) error {
   493  
   494  	if m.Signature != nil {
   495  
   496  		if swag.IsZero(m.Signature) { // not required
   497  			return nil
   498  		}
   499  
   500  		if err := m.Signature.ContextValidate(ctx, formats); err != nil {
   501  			if ve, ok := err.(*errors.Validation); ok {
   502  				return ve.ValidateName("chart" + "." + "provenance" + "." + "signature")
   503  			} else if ce, ok := err.(*errors.CompositeError); ok {
   504  				return ce.ValidateName("chart" + "." + "provenance" + "." + "signature")
   505  			}
   506  			return err
   507  		}
   508  	}
   509  
   510  	return nil
   511  }
   512  
   513  // MarshalBinary interface implementation
   514  func (m *HelmV001SchemaChartProvenance) MarshalBinary() ([]byte, error) {
   515  	if m == nil {
   516  		return nil, nil
   517  	}
   518  	return swag.WriteJSON(m)
   519  }
   520  
   521  // UnmarshalBinary interface implementation
   522  func (m *HelmV001SchemaChartProvenance) UnmarshalBinary(b []byte) error {
   523  	var res HelmV001SchemaChartProvenance
   524  	if err := swag.ReadJSON(b, &res); err != nil {
   525  		return err
   526  	}
   527  	*m = res
   528  	return nil
   529  }
   530  
   531  // HelmV001SchemaChartProvenanceSignature Information about the included signature in the provenance file
   532  //
   533  // swagger:model HelmV001SchemaChartProvenanceSignature
   534  type HelmV001SchemaChartProvenanceSignature struct {
   535  
   536  	// Specifies the signature embedded within the provenance file
   537  	// Required: true
   538  	// Read Only: true
   539  	// Format: byte
   540  	Content strfmt.Base64 `json:"content"`
   541  }
   542  
   543  // Validate validates this helm v001 schema chart provenance signature
   544  func (m *HelmV001SchemaChartProvenanceSignature) Validate(formats strfmt.Registry) error {
   545  	var res []error
   546  
   547  	if err := m.validateContent(formats); err != nil {
   548  		res = append(res, err)
   549  	}
   550  
   551  	if len(res) > 0 {
   552  		return errors.CompositeValidationError(res...)
   553  	}
   554  	return nil
   555  }
   556  
   557  func (m *HelmV001SchemaChartProvenanceSignature) validateContent(formats strfmt.Registry) error {
   558  
   559  	if err := validate.Required("chart"+"."+"provenance"+"."+"signature"+"."+"content", "body", strfmt.Base64(m.Content)); err != nil {
   560  		return err
   561  	}
   562  
   563  	return nil
   564  }
   565  
   566  // ContextValidate validate this helm v001 schema chart provenance signature based on the context it is used
   567  func (m *HelmV001SchemaChartProvenanceSignature) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   568  	var res []error
   569  
   570  	if err := m.contextValidateContent(ctx, formats); err != nil {
   571  		res = append(res, err)
   572  	}
   573  
   574  	if len(res) > 0 {
   575  		return errors.CompositeValidationError(res...)
   576  	}
   577  	return nil
   578  }
   579  
   580  func (m *HelmV001SchemaChartProvenanceSignature) contextValidateContent(ctx context.Context, formats strfmt.Registry) error {
   581  
   582  	if err := validate.ReadOnly(ctx, "chart"+"."+"provenance"+"."+"signature"+"."+"content", "body", strfmt.Base64(m.Content)); err != nil {
   583  		return err
   584  	}
   585  
   586  	return nil
   587  }
   588  
   589  // MarshalBinary interface implementation
   590  func (m *HelmV001SchemaChartProvenanceSignature) MarshalBinary() ([]byte, error) {
   591  	if m == nil {
   592  		return nil, nil
   593  	}
   594  	return swag.WriteJSON(m)
   595  }
   596  
   597  // UnmarshalBinary interface implementation
   598  func (m *HelmV001SchemaChartProvenanceSignature) UnmarshalBinary(b []byte) error {
   599  	var res HelmV001SchemaChartProvenanceSignature
   600  	if err := swag.ReadJSON(b, &res); err != nil {
   601  		return err
   602  	}
   603  	*m = res
   604  	return nil
   605  }
   606  
   607  // HelmV001SchemaPublicKey The public key that can verify the package signature
   608  //
   609  // swagger:model HelmV001SchemaPublicKey
   610  type HelmV001SchemaPublicKey struct {
   611  
   612  	// Specifies the content of the public key inline within the document
   613  	// Required: true
   614  	// Format: byte
   615  	Content *strfmt.Base64 `json:"content"`
   616  }
   617  
   618  // Validate validates this helm v001 schema public key
   619  func (m *HelmV001SchemaPublicKey) Validate(formats strfmt.Registry) error {
   620  	var res []error
   621  
   622  	if err := m.validateContent(formats); err != nil {
   623  		res = append(res, err)
   624  	}
   625  
   626  	if len(res) > 0 {
   627  		return errors.CompositeValidationError(res...)
   628  	}
   629  	return nil
   630  }
   631  
   632  func (m *HelmV001SchemaPublicKey) validateContent(formats strfmt.Registry) error {
   633  
   634  	if err := validate.Required("publicKey"+"."+"content", "body", m.Content); err != nil {
   635  		return err
   636  	}
   637  
   638  	return nil
   639  }
   640  
   641  // ContextValidate validates this helm v001 schema public key based on context it is used
   642  func (m *HelmV001SchemaPublicKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   643  	return nil
   644  }
   645  
   646  // MarshalBinary interface implementation
   647  func (m *HelmV001SchemaPublicKey) MarshalBinary() ([]byte, error) {
   648  	if m == nil {
   649  		return nil, nil
   650  	}
   651  	return swag.WriteJSON(m)
   652  }
   653  
   654  // UnmarshalBinary interface implementation
   655  func (m *HelmV001SchemaPublicKey) UnmarshalBinary(b []byte) error {
   656  	var res HelmV001SchemaPublicKey
   657  	if err := swag.ReadJSON(b, &res); err != nil {
   658  		return err
   659  	}
   660  	*m = res
   661  	return nil
   662  }
   663  

View as plain text