github.com/hashicorp/hcp-sdk-go@v0.94.0/clients/cloud-vault-secrets/stable/2023-06-13/models/secrets20230613_app.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package 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  // Secrets20230613App secrets 20230613 app
    18  //
    19  // swagger:model secrets_20230613App
    20  type Secrets20230613App struct {
    21  
    22  	// created at
    23  	// Format: date-time
    24  	CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
    25  
    26  	// created by
    27  	CreatedBy *Secrets20230613Principal `json:"created_by,omitempty"`
    28  
    29  	// description
    30  	Description string `json:"description,omitempty"`
    31  
    32  	// location
    33  	Location *CloudlocationLocation `json:"location,omitempty"`
    34  
    35  	// name
    36  	Name string `json:"name,omitempty"`
    37  
    38  	// sync integrations
    39  	SyncIntegrations []string `json:"sync_integrations"`
    40  
    41  	// updated at
    42  	// Format: date-time
    43  	UpdatedAt strfmt.DateTime `json:"updated_at,omitempty"`
    44  
    45  	// updated by
    46  	UpdatedBy *Secrets20230613Principal `json:"updated_by,omitempty"`
    47  }
    48  
    49  // Validate validates this secrets 20230613 app
    50  func (m *Secrets20230613App) Validate(formats strfmt.Registry) error {
    51  	var res []error
    52  
    53  	if err := m.validateCreatedAt(formats); err != nil {
    54  		res = append(res, err)
    55  	}
    56  
    57  	if err := m.validateCreatedBy(formats); err != nil {
    58  		res = append(res, err)
    59  	}
    60  
    61  	if err := m.validateLocation(formats); err != nil {
    62  		res = append(res, err)
    63  	}
    64  
    65  	if err := m.validateUpdatedAt(formats); err != nil {
    66  		res = append(res, err)
    67  	}
    68  
    69  	if err := m.validateUpdatedBy(formats); err != nil {
    70  		res = append(res, err)
    71  	}
    72  
    73  	if len(res) > 0 {
    74  		return errors.CompositeValidationError(res...)
    75  	}
    76  	return nil
    77  }
    78  
    79  func (m *Secrets20230613App) validateCreatedAt(formats strfmt.Registry) error {
    80  	if swag.IsZero(m.CreatedAt) { // not required
    81  		return nil
    82  	}
    83  
    84  	if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil {
    85  		return err
    86  	}
    87  
    88  	return nil
    89  }
    90  
    91  func (m *Secrets20230613App) validateCreatedBy(formats strfmt.Registry) error {
    92  	if swag.IsZero(m.CreatedBy) { // not required
    93  		return nil
    94  	}
    95  
    96  	if m.CreatedBy != nil {
    97  		if err := m.CreatedBy.Validate(formats); err != nil {
    98  			if ve, ok := err.(*errors.Validation); ok {
    99  				return ve.ValidateName("created_by")
   100  			} else if ce, ok := err.(*errors.CompositeError); ok {
   101  				return ce.ValidateName("created_by")
   102  			}
   103  			return err
   104  		}
   105  	}
   106  
   107  	return nil
   108  }
   109  
   110  func (m *Secrets20230613App) validateLocation(formats strfmt.Registry) error {
   111  	if swag.IsZero(m.Location) { // not required
   112  		return nil
   113  	}
   114  
   115  	if m.Location != nil {
   116  		if err := m.Location.Validate(formats); err != nil {
   117  			if ve, ok := err.(*errors.Validation); ok {
   118  				return ve.ValidateName("location")
   119  			} else if ce, ok := err.(*errors.CompositeError); ok {
   120  				return ce.ValidateName("location")
   121  			}
   122  			return err
   123  		}
   124  	}
   125  
   126  	return nil
   127  }
   128  
   129  func (m *Secrets20230613App) validateUpdatedAt(formats strfmt.Registry) error {
   130  	if swag.IsZero(m.UpdatedAt) { // not required
   131  		return nil
   132  	}
   133  
   134  	if err := validate.FormatOf("updated_at", "body", "date-time", m.UpdatedAt.String(), formats); err != nil {
   135  		return err
   136  	}
   137  
   138  	return nil
   139  }
   140  
   141  func (m *Secrets20230613App) validateUpdatedBy(formats strfmt.Registry) error {
   142  	if swag.IsZero(m.UpdatedBy) { // not required
   143  		return nil
   144  	}
   145  
   146  	if m.UpdatedBy != nil {
   147  		if err := m.UpdatedBy.Validate(formats); err != nil {
   148  			if ve, ok := err.(*errors.Validation); ok {
   149  				return ve.ValidateName("updated_by")
   150  			} else if ce, ok := err.(*errors.CompositeError); ok {
   151  				return ce.ValidateName("updated_by")
   152  			}
   153  			return err
   154  		}
   155  	}
   156  
   157  	return nil
   158  }
   159  
   160  // ContextValidate validate this secrets 20230613 app based on the context it is used
   161  func (m *Secrets20230613App) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   162  	var res []error
   163  
   164  	if err := m.contextValidateCreatedBy(ctx, formats); err != nil {
   165  		res = append(res, err)
   166  	}
   167  
   168  	if err := m.contextValidateLocation(ctx, formats); err != nil {
   169  		res = append(res, err)
   170  	}
   171  
   172  	if err := m.contextValidateUpdatedBy(ctx, formats); err != nil {
   173  		res = append(res, err)
   174  	}
   175  
   176  	if len(res) > 0 {
   177  		return errors.CompositeValidationError(res...)
   178  	}
   179  	return nil
   180  }
   181  
   182  func (m *Secrets20230613App) contextValidateCreatedBy(ctx context.Context, formats strfmt.Registry) error {
   183  
   184  	if m.CreatedBy != nil {
   185  
   186  		if swag.IsZero(m.CreatedBy) { // not required
   187  			return nil
   188  		}
   189  
   190  		if err := m.CreatedBy.ContextValidate(ctx, formats); err != nil {
   191  			if ve, ok := err.(*errors.Validation); ok {
   192  				return ve.ValidateName("created_by")
   193  			} else if ce, ok := err.(*errors.CompositeError); ok {
   194  				return ce.ValidateName("created_by")
   195  			}
   196  			return err
   197  		}
   198  	}
   199  
   200  	return nil
   201  }
   202  
   203  func (m *Secrets20230613App) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error {
   204  
   205  	if m.Location != nil {
   206  
   207  		if swag.IsZero(m.Location) { // not required
   208  			return nil
   209  		}
   210  
   211  		if err := m.Location.ContextValidate(ctx, formats); err != nil {
   212  			if ve, ok := err.(*errors.Validation); ok {
   213  				return ve.ValidateName("location")
   214  			} else if ce, ok := err.(*errors.CompositeError); ok {
   215  				return ce.ValidateName("location")
   216  			}
   217  			return err
   218  		}
   219  	}
   220  
   221  	return nil
   222  }
   223  
   224  func (m *Secrets20230613App) contextValidateUpdatedBy(ctx context.Context, formats strfmt.Registry) error {
   225  
   226  	if m.UpdatedBy != nil {
   227  
   228  		if swag.IsZero(m.UpdatedBy) { // not required
   229  			return nil
   230  		}
   231  
   232  		if err := m.UpdatedBy.ContextValidate(ctx, formats); err != nil {
   233  			if ve, ok := err.(*errors.Validation); ok {
   234  				return ve.ValidateName("updated_by")
   235  			} else if ce, ok := err.(*errors.CompositeError); ok {
   236  				return ce.ValidateName("updated_by")
   237  			}
   238  			return err
   239  		}
   240  	}
   241  
   242  	return nil
   243  }
   244  
   245  // MarshalBinary interface implementation
   246  func (m *Secrets20230613App) MarshalBinary() ([]byte, error) {
   247  	if m == nil {
   248  		return nil, nil
   249  	}
   250  	return swag.WriteJSON(m)
   251  }
   252  
   253  // UnmarshalBinary interface implementation
   254  func (m *Secrets20230613App) UnmarshalBinary(b []byte) error {
   255  	var res Secrets20230613App
   256  	if err := swag.ReadJSON(b, &res); err != nil {
   257  		return err
   258  	}
   259  	*m = res
   260  	return nil
   261  }