github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/auto_invite_settings.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  )
    15  
    16  // AutoInviteSettings auto invite settings
    17  //
    18  // swagger:model AutoInviteSettings
    19  type AutoInviteSettings struct {
    20  
    21  	// domain
    22  	Domain string `json:"domain,omitempty"`
    23  
    24  	// role
    25  	Role *Role `json:"role,omitempty"`
    26  }
    27  
    28  // Validate validates this auto invite settings
    29  func (m *AutoInviteSettings) Validate(formats strfmt.Registry) error {
    30  	var res []error
    31  
    32  	if err := m.validateRole(formats); err != nil {
    33  		res = append(res, err)
    34  	}
    35  
    36  	if len(res) > 0 {
    37  		return errors.CompositeValidationError(res...)
    38  	}
    39  	return nil
    40  }
    41  
    42  func (m *AutoInviteSettings) validateRole(formats strfmt.Registry) error {
    43  	if swag.IsZero(m.Role) { // not required
    44  		return nil
    45  	}
    46  
    47  	if m.Role != nil {
    48  		if err := m.Role.Validate(formats); err != nil {
    49  			if ve, ok := err.(*errors.Validation); ok {
    50  				return ve.ValidateName("role")
    51  			}
    52  			return err
    53  		}
    54  	}
    55  
    56  	return nil
    57  }
    58  
    59  // ContextValidate validate this auto invite settings based on the context it is used
    60  func (m *AutoInviteSettings) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    61  	var res []error
    62  
    63  	if err := m.contextValidateRole(ctx, formats); err != nil {
    64  		res = append(res, err)
    65  	}
    66  
    67  	if len(res) > 0 {
    68  		return errors.CompositeValidationError(res...)
    69  	}
    70  	return nil
    71  }
    72  
    73  func (m *AutoInviteSettings) contextValidateRole(ctx context.Context, formats strfmt.Registry) error {
    74  
    75  	if m.Role != nil {
    76  		if err := m.Role.ContextValidate(ctx, formats); err != nil {
    77  			if ve, ok := err.(*errors.Validation); ok {
    78  				return ve.ValidateName("role")
    79  			}
    80  			return err
    81  		}
    82  	}
    83  
    84  	return nil
    85  }
    86  
    87  // MarshalBinary interface implementation
    88  func (m *AutoInviteSettings) MarshalBinary() ([]byte, error) {
    89  	if m == nil {
    90  		return nil, nil
    91  	}
    92  	return swag.WriteJSON(m)
    93  }
    94  
    95  // UnmarshalBinary interface implementation
    96  func (m *AutoInviteSettings) UnmarshalBinary(b []byte) error {
    97  	var res AutoInviteSettings
    98  	if err := swag.ReadJSON(b, &res); err != nil {
    99  		return err
   100  	}
   101  	*m = res
   102  	return nil
   103  }