github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/password_reset.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package mono_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  	"context"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/strfmt"
    13  	"github.com/go-openapi/swag"
    14  	"github.com/go-openapi/validate"
    15  )
    16  
    17  // PasswordReset password reset
    18  //
    19  // swagger:model PasswordReset
    20  type PasswordReset struct {
    21  
    22  	// code
    23  	// Format: uuid
    24  	Code strfmt.UUID `json:"code,omitempty"`
    25  
    26  	// password
    27  	Password string `json:"password,omitempty"`
    28  }
    29  
    30  // Validate validates this password reset
    31  func (m *PasswordReset) Validate(formats strfmt.Registry) error {
    32  	var res []error
    33  
    34  	if err := m.validateCode(formats); err != nil {
    35  		res = append(res, err)
    36  	}
    37  
    38  	if len(res) > 0 {
    39  		return errors.CompositeValidationError(res...)
    40  	}
    41  	return nil
    42  }
    43  
    44  func (m *PasswordReset) validateCode(formats strfmt.Registry) error {
    45  	if swag.IsZero(m.Code) { // not required
    46  		return nil
    47  	}
    48  
    49  	if err := validate.FormatOf("code", "body", "uuid", m.Code.String(), formats); err != nil {
    50  		return err
    51  	}
    52  
    53  	return nil
    54  }
    55  
    56  // ContextValidate validates this password reset based on context it is used
    57  func (m *PasswordReset) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    58  	return nil
    59  }
    60  
    61  // MarshalBinary interface implementation
    62  func (m *PasswordReset) MarshalBinary() ([]byte, error) {
    63  	if m == nil {
    64  		return nil, nil
    65  	}
    66  	return swag.WriteJSON(m)
    67  }
    68  
    69  // UnmarshalBinary interface implementation
    70  func (m *PasswordReset) UnmarshalBinary(b []byte) error {
    71  	var res PasswordReset
    72  	if err := swag.ReadJSON(b, &res); err != nil {
    73  		return err
    74  	}
    75  	*m = res
    76  	return nil
    77  }