Files
paralus/api/def/clients/sentry/models/v3_metadata.go
nirav-rafay c66bdc25cd restructure rcloud-base as a single base controller (#37)
* restructure rcloud-base as a single base controller
* updated master.rest
* moved sentry from internal to pkg as it is used by relay
* removing unused rpc and it's dependencies
* Fix usermgmt tests
* Don't redefine variables in rest file
Co-authored-by: Abin Simon <abin.simon@rafay.co>
2022-03-03 17:59:06 +05:30

182 lines
3.8 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// V3Metadata Metadata
//
// metadata of the resource
// Example: {"name":"some-name","project":"defaultproject"}
//
// swagger:model v3Metadata
type V3Metadata struct {
// Annotations
//
// annotations of the resource
Annotations map[string]string `json:"annotations,omitempty"`
// Description
//
// description of the resource
Description string `json:"description,omitempty"`
// Display Name
//
// display name of the resource
DisplayName string `json:"displayName,omitempty"`
// id
// Read Only: true
ID string `json:"id,omitempty"`
// Lables
//
// labels of the resource
Labels map[string]string `json:"labels,omitempty"`
// modified at
// Read Only: true
// Format: date-time
ModifiedAt strfmt.DateTime `json:"modifiedAt,omitempty"`
// Name
//
// name of the resource
// Required: true
Name *string `json:"name"`
// Organization
//
// Organization to which the resource belongs
Organization string `json:"organization,omitempty"`
// Partner
//
// Partner to which the resource belongs
Partner string `json:"partner,omitempty"`
// Project
//
// Project of the resource
// Required: true
Project *string `json:"project"`
}
// Validate validates this v3 metadata
func (m *V3Metadata) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateModifiedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if err := m.validateProject(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *V3Metadata) validateModifiedAt(formats strfmt.Registry) error {
if swag.IsZero(m.ModifiedAt) { // not required
return nil
}
if err := validate.FormatOf("modifiedAt", "body", "date-time", m.ModifiedAt.String(), formats); err != nil {
return err
}
return nil
}
func (m *V3Metadata) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
return nil
}
func (m *V3Metadata) validateProject(formats strfmt.Registry) error {
if err := validate.Required("project", "body", m.Project); err != nil {
return err
}
return nil
}
// ContextValidate validate this v3 metadata based on the context it is used
func (m *V3Metadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateModifiedAt(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *V3Metadata) contextValidateID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil {
return err
}
return nil
}
func (m *V3Metadata) contextValidateModifiedAt(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "modifiedAt", "body", strfmt.DateTime(m.ModifiedAt)); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *V3Metadata) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *V3Metadata) UnmarshalBinary(b []byte) error {
var res V3Metadata
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}