github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/secrets/secrets_models/user_secret_share.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package secrets_models
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	strfmt "github.com/go-openapi/strfmt"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/swag"
    13  	"github.com/go-openapi/validate"
    14  )
    15  
    16  // UserSecretShare user secret share
    17  // swagger:model UserSecretShare
    18  type UserSecretShare struct {
    19  
    20  	// name
    21  	// Required: true
    22  	Name *string `json:"name"`
    23  
    24  	// project id
    25  	// Format: uuid
    26  	ProjectID strfmt.UUID `json:"project_id,omitempty"`
    27  
    28  	// value
    29  	// Required: true
    30  	Value *string `json:"value"`
    31  }
    32  
    33  // Validate validates this user secret share
    34  func (m *UserSecretShare) Validate(formats strfmt.Registry) error {
    35  	var res []error
    36  
    37  	if err := m.validateName(formats); err != nil {
    38  		res = append(res, err)
    39  	}
    40  
    41  	if err := m.validateProjectID(formats); err != nil {
    42  		res = append(res, err)
    43  	}
    44  
    45  	if err := m.validateValue(formats); err != nil {
    46  		res = append(res, err)
    47  	}
    48  
    49  	if len(res) > 0 {
    50  		return errors.CompositeValidationError(res...)
    51  	}
    52  	return nil
    53  }
    54  
    55  func (m *UserSecretShare) validateName(formats strfmt.Registry) error {
    56  
    57  	if err := validate.Required("name", "body", m.Name); err != nil {
    58  		return err
    59  	}
    60  
    61  	return nil
    62  }
    63  
    64  func (m *UserSecretShare) validateProjectID(formats strfmt.Registry) error {
    65  
    66  	if swag.IsZero(m.ProjectID) { // not required
    67  		return nil
    68  	}
    69  
    70  	if err := validate.FormatOf("project_id", "body", "uuid", m.ProjectID.String(), formats); err != nil {
    71  		return err
    72  	}
    73  
    74  	return nil
    75  }
    76  
    77  func (m *UserSecretShare) validateValue(formats strfmt.Registry) error {
    78  
    79  	if err := validate.Required("value", "body", m.Value); err != nil {
    80  		return err
    81  	}
    82  
    83  	return nil
    84  }
    85  
    86  // MarshalBinary interface implementation
    87  func (m *UserSecretShare) 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 *UserSecretShare) UnmarshalBinary(b []byte) error {
    96  	var res UserSecretShare
    97  	if err := swag.ReadJSON(b, &res); err != nil {
    98  		return err
    99  	}
   100  	*m = res
   101  	return nil
   102  }