github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/project.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  	"strconv"
    11  
    12  	"github.com/go-openapi/errors"
    13  	"github.com/go-openapi/strfmt"
    14  	"github.com/go-openapi/swag"
    15  	"github.com/go-openapi/validate"
    16  )
    17  
    18  // Project project
    19  //
    20  // swagger:model Project
    21  type Project struct {
    22  
    23  	// added
    24  	// Format: date-time
    25  	Added strfmt.DateTime `json:"added,omitempty"`
    26  
    27  	// branches
    28  	Branches Branches `json:"branches,omitempty"`
    29  
    30  	// created by
    31  	CreatedBy *string `json:"createdBy,omitempty"`
    32  
    33  	// description
    34  	Description *string `json:"description,omitempty"`
    35  
    36  	// forked from
    37  	ForkedFrom *ProjectForkedFrom `json:"forkedFrom,omitempty"`
    38  
    39  	// languages
    40  	Languages []*ProjectLanguagesItems0 `json:"languages"`
    41  
    42  	// last edited
    43  	// Format: date-time
    44  	LastEdited strfmt.DateTime `json:"lastEdited,omitempty"`
    45  
    46  	// managed
    47  	Managed bool `json:"managed,omitempty"`
    48  
    49  	// name
    50  	Name string `json:"name,omitempty"`
    51  
    52  	// organization ID
    53  	// Format: uuid
    54  	OrganizationID strfmt.UUID `json:"organizationID,omitempty"`
    55  
    56  	// platforms
    57  	Platforms []*ProjectPlatformsItems0 `json:"platforms"`
    58  
    59  	// private
    60  	Private bool `json:"private,omitempty"`
    61  
    62  	// project ID
    63  	// Format: uuid
    64  	ProjectID strfmt.UUID `json:"projectID,omitempty"`
    65  
    66  	// repo Url
    67  	RepoURL *string `json:"repoUrl,omitempty"`
    68  }
    69  
    70  // Validate validates this project
    71  func (m *Project) Validate(formats strfmt.Registry) error {
    72  	var res []error
    73  
    74  	if err := m.validateAdded(formats); err != nil {
    75  		res = append(res, err)
    76  	}
    77  
    78  	if err := m.validateBranches(formats); err != nil {
    79  		res = append(res, err)
    80  	}
    81  
    82  	if err := m.validateForkedFrom(formats); err != nil {
    83  		res = append(res, err)
    84  	}
    85  
    86  	if err := m.validateLanguages(formats); err != nil {
    87  		res = append(res, err)
    88  	}
    89  
    90  	if err := m.validateLastEdited(formats); err != nil {
    91  		res = append(res, err)
    92  	}
    93  
    94  	if err := m.validateOrganizationID(formats); err != nil {
    95  		res = append(res, err)
    96  	}
    97  
    98  	if err := m.validatePlatforms(formats); err != nil {
    99  		res = append(res, err)
   100  	}
   101  
   102  	if err := m.validateProjectID(formats); err != nil {
   103  		res = append(res, err)
   104  	}
   105  
   106  	if len(res) > 0 {
   107  		return errors.CompositeValidationError(res...)
   108  	}
   109  	return nil
   110  }
   111  
   112  func (m *Project) validateAdded(formats strfmt.Registry) error {
   113  	if swag.IsZero(m.Added) { // not required
   114  		return nil
   115  	}
   116  
   117  	if err := validate.FormatOf("added", "body", "date-time", m.Added.String(), formats); err != nil {
   118  		return err
   119  	}
   120  
   121  	return nil
   122  }
   123  
   124  func (m *Project) validateBranches(formats strfmt.Registry) error {
   125  	if swag.IsZero(m.Branches) { // not required
   126  		return nil
   127  	}
   128  
   129  	if err := m.Branches.Validate(formats); err != nil {
   130  		if ve, ok := err.(*errors.Validation); ok {
   131  			return ve.ValidateName("branches")
   132  		}
   133  		return err
   134  	}
   135  
   136  	return nil
   137  }
   138  
   139  func (m *Project) validateForkedFrom(formats strfmt.Registry) error {
   140  	if swag.IsZero(m.ForkedFrom) { // not required
   141  		return nil
   142  	}
   143  
   144  	if m.ForkedFrom != nil {
   145  		if err := m.ForkedFrom.Validate(formats); err != nil {
   146  			if ve, ok := err.(*errors.Validation); ok {
   147  				return ve.ValidateName("forkedFrom")
   148  			}
   149  			return err
   150  		}
   151  	}
   152  
   153  	return nil
   154  }
   155  
   156  func (m *Project) validateLanguages(formats strfmt.Registry) error {
   157  	if swag.IsZero(m.Languages) { // not required
   158  		return nil
   159  	}
   160  
   161  	for i := 0; i < len(m.Languages); i++ {
   162  		if swag.IsZero(m.Languages[i]) { // not required
   163  			continue
   164  		}
   165  
   166  		if m.Languages[i] != nil {
   167  			if err := m.Languages[i].Validate(formats); err != nil {
   168  				if ve, ok := err.(*errors.Validation); ok {
   169  					return ve.ValidateName("languages" + "." + strconv.Itoa(i))
   170  				}
   171  				return err
   172  			}
   173  		}
   174  
   175  	}
   176  
   177  	return nil
   178  }
   179  
   180  func (m *Project) validateLastEdited(formats strfmt.Registry) error {
   181  	if swag.IsZero(m.LastEdited) { // not required
   182  		return nil
   183  	}
   184  
   185  	if err := validate.FormatOf("lastEdited", "body", "date-time", m.LastEdited.String(), formats); err != nil {
   186  		return err
   187  	}
   188  
   189  	return nil
   190  }
   191  
   192  func (m *Project) validateOrganizationID(formats strfmt.Registry) error {
   193  	if swag.IsZero(m.OrganizationID) { // not required
   194  		return nil
   195  	}
   196  
   197  	if err := validate.FormatOf("organizationID", "body", "uuid", m.OrganizationID.String(), formats); err != nil {
   198  		return err
   199  	}
   200  
   201  	return nil
   202  }
   203  
   204  func (m *Project) validatePlatforms(formats strfmt.Registry) error {
   205  	if swag.IsZero(m.Platforms) { // not required
   206  		return nil
   207  	}
   208  
   209  	for i := 0; i < len(m.Platforms); i++ {
   210  		if swag.IsZero(m.Platforms[i]) { // not required
   211  			continue
   212  		}
   213  
   214  		if m.Platforms[i] != nil {
   215  			if err := m.Platforms[i].Validate(formats); err != nil {
   216  				if ve, ok := err.(*errors.Validation); ok {
   217  					return ve.ValidateName("platforms" + "." + strconv.Itoa(i))
   218  				}
   219  				return err
   220  			}
   221  		}
   222  
   223  	}
   224  
   225  	return nil
   226  }
   227  
   228  func (m *Project) validateProjectID(formats strfmt.Registry) error {
   229  	if swag.IsZero(m.ProjectID) { // not required
   230  		return nil
   231  	}
   232  
   233  	if err := validate.FormatOf("projectID", "body", "uuid", m.ProjectID.String(), formats); err != nil {
   234  		return err
   235  	}
   236  
   237  	return nil
   238  }
   239  
   240  // ContextValidate validate this project based on the context it is used
   241  func (m *Project) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   242  	var res []error
   243  
   244  	if err := m.contextValidateBranches(ctx, formats); err != nil {
   245  		res = append(res, err)
   246  	}
   247  
   248  	if err := m.contextValidateForkedFrom(ctx, formats); err != nil {
   249  		res = append(res, err)
   250  	}
   251  
   252  	if err := m.contextValidateLanguages(ctx, formats); err != nil {
   253  		res = append(res, err)
   254  	}
   255  
   256  	if err := m.contextValidatePlatforms(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 *Project) contextValidateBranches(ctx context.Context, formats strfmt.Registry) error {
   267  
   268  	if err := m.Branches.ContextValidate(ctx, formats); err != nil {
   269  		if ve, ok := err.(*errors.Validation); ok {
   270  			return ve.ValidateName("branches")
   271  		}
   272  		return err
   273  	}
   274  
   275  	return nil
   276  }
   277  
   278  func (m *Project) contextValidateForkedFrom(ctx context.Context, formats strfmt.Registry) error {
   279  
   280  	if m.ForkedFrom != nil {
   281  		if err := m.ForkedFrom.ContextValidate(ctx, formats); err != nil {
   282  			if ve, ok := err.(*errors.Validation); ok {
   283  				return ve.ValidateName("forkedFrom")
   284  			}
   285  			return err
   286  		}
   287  	}
   288  
   289  	return nil
   290  }
   291  
   292  func (m *Project) contextValidateLanguages(ctx context.Context, formats strfmt.Registry) error {
   293  
   294  	for i := 0; i < len(m.Languages); i++ {
   295  
   296  		if m.Languages[i] != nil {
   297  			if err := m.Languages[i].ContextValidate(ctx, formats); err != nil {
   298  				if ve, ok := err.(*errors.Validation); ok {
   299  					return ve.ValidateName("languages" + "." + strconv.Itoa(i))
   300  				}
   301  				return err
   302  			}
   303  		}
   304  
   305  	}
   306  
   307  	return nil
   308  }
   309  
   310  func (m *Project) contextValidatePlatforms(ctx context.Context, formats strfmt.Registry) error {
   311  
   312  	for i := 0; i < len(m.Platforms); i++ {
   313  
   314  		if m.Platforms[i] != nil {
   315  			if err := m.Platforms[i].ContextValidate(ctx, formats); err != nil {
   316  				if ve, ok := err.(*errors.Validation); ok {
   317  					return ve.ValidateName("platforms" + "." + strconv.Itoa(i))
   318  				}
   319  				return err
   320  			}
   321  		}
   322  
   323  	}
   324  
   325  	return nil
   326  }
   327  
   328  // MarshalBinary interface implementation
   329  func (m *Project) MarshalBinary() ([]byte, error) {
   330  	if m == nil {
   331  		return nil, nil
   332  	}
   333  	return swag.WriteJSON(m)
   334  }
   335  
   336  // UnmarshalBinary interface implementation
   337  func (m *Project) UnmarshalBinary(b []byte) error {
   338  	var res Project
   339  	if err := swag.ReadJSON(b, &res); err != nil {
   340  		return err
   341  	}
   342  	*m = res
   343  	return nil
   344  }
   345  
   346  // ProjectForkedFrom project forked from
   347  //
   348  // swagger:model ProjectForkedFrom
   349  type ProjectForkedFrom struct {
   350  
   351  	// organization
   352  	Organization string `json:"organization,omitempty"`
   353  
   354  	// project
   355  	Project string `json:"project,omitempty"`
   356  }
   357  
   358  // Validate validates this project forked from
   359  func (m *ProjectForkedFrom) Validate(formats strfmt.Registry) error {
   360  	return nil
   361  }
   362  
   363  // ContextValidate validates this project forked from based on context it is used
   364  func (m *ProjectForkedFrom) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   365  	return nil
   366  }
   367  
   368  // MarshalBinary interface implementation
   369  func (m *ProjectForkedFrom) MarshalBinary() ([]byte, error) {
   370  	if m == nil {
   371  		return nil, nil
   372  	}
   373  	return swag.WriteJSON(m)
   374  }
   375  
   376  // UnmarshalBinary interface implementation
   377  func (m *ProjectForkedFrom) UnmarshalBinary(b []byte) error {
   378  	var res ProjectForkedFrom
   379  	if err := swag.ReadJSON(b, &res); err != nil {
   380  		return err
   381  	}
   382  	*m = res
   383  	return nil
   384  }
   385  
   386  // ProjectLanguagesItems0 project languages items0
   387  //
   388  // swagger:model ProjectLanguagesItems0
   389  type ProjectLanguagesItems0 struct {
   390  
   391  	// ingredient ID
   392  	// Format: uuid
   393  	IngredientID strfmt.UUID `json:"ingredientID,omitempty"`
   394  
   395  	// name
   396  	Name string `json:"name,omitempty"`
   397  }
   398  
   399  // Validate validates this project languages items0
   400  func (m *ProjectLanguagesItems0) Validate(formats strfmt.Registry) error {
   401  	var res []error
   402  
   403  	if err := m.validateIngredientID(formats); err != nil {
   404  		res = append(res, err)
   405  	}
   406  
   407  	if len(res) > 0 {
   408  		return errors.CompositeValidationError(res...)
   409  	}
   410  	return nil
   411  }
   412  
   413  func (m *ProjectLanguagesItems0) validateIngredientID(formats strfmt.Registry) error {
   414  	if swag.IsZero(m.IngredientID) { // not required
   415  		return nil
   416  	}
   417  
   418  	if err := validate.FormatOf("ingredientID", "body", "uuid", m.IngredientID.String(), formats); err != nil {
   419  		return err
   420  	}
   421  
   422  	return nil
   423  }
   424  
   425  // ContextValidate validates this project languages items0 based on context it is used
   426  func (m *ProjectLanguagesItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   427  	return nil
   428  }
   429  
   430  // MarshalBinary interface implementation
   431  func (m *ProjectLanguagesItems0) MarshalBinary() ([]byte, error) {
   432  	if m == nil {
   433  		return nil, nil
   434  	}
   435  	return swag.WriteJSON(m)
   436  }
   437  
   438  // UnmarshalBinary interface implementation
   439  func (m *ProjectLanguagesItems0) UnmarshalBinary(b []byte) error {
   440  	var res ProjectLanguagesItems0
   441  	if err := swag.ReadJSON(b, &res); err != nil {
   442  		return err
   443  	}
   444  	*m = res
   445  	return nil
   446  }
   447  
   448  // ProjectPlatformsItems0 project platforms items0
   449  //
   450  // swagger:model ProjectPlatformsItems0
   451  type ProjectPlatformsItems0 struct {
   452  
   453  	// display name
   454  	DisplayName *string `json:"displayName,omitempty"`
   455  
   456  	// platform ID
   457  	// Format: uuid
   458  	PlatformID strfmt.UUID `json:"platformID,omitempty"`
   459  }
   460  
   461  // Validate validates this project platforms items0
   462  func (m *ProjectPlatformsItems0) Validate(formats strfmt.Registry) error {
   463  	var res []error
   464  
   465  	if err := m.validatePlatformID(formats); err != nil {
   466  		res = append(res, err)
   467  	}
   468  
   469  	if len(res) > 0 {
   470  		return errors.CompositeValidationError(res...)
   471  	}
   472  	return nil
   473  }
   474  
   475  func (m *ProjectPlatformsItems0) validatePlatformID(formats strfmt.Registry) error {
   476  	if swag.IsZero(m.PlatformID) { // not required
   477  		return nil
   478  	}
   479  
   480  	if err := validate.FormatOf("platformID", "body", "uuid", m.PlatformID.String(), formats); err != nil {
   481  		return err
   482  	}
   483  
   484  	return nil
   485  }
   486  
   487  // ContextValidate validates this project platforms items0 based on context it is used
   488  func (m *ProjectPlatformsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   489  	return nil
   490  }
   491  
   492  // MarshalBinary interface implementation
   493  func (m *ProjectPlatformsItems0) MarshalBinary() ([]byte, error) {
   494  	if m == nil {
   495  		return nil, nil
   496  	}
   497  	return swag.WriteJSON(m)
   498  }
   499  
   500  // UnmarshalBinary interface implementation
   501  func (m *ProjectPlatformsItems0) UnmarshalBinary(b []byte) error {
   502  	var res ProjectPlatformsItems0
   503  	if err := swag.ReadJSON(b, &res); err != nil {
   504  		return err
   505  	}
   506  	*m = res
   507  	return nil
   508  }