github.com/sap/cf-mta-plugin@v2.6.3+incompatible/clients/models/operation.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  	strfmt "github.com/go-openapi/strfmt"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/swag"
    13  )
    14  
    15  // Operation operation
    16  // swagger:model Operation
    17  
    18  type Operation struct {
    19  
    20  	// acquired lock
    21  	AcquiredLock bool `json:"acquiredLock,omitempty"`
    22  
    23  	// messages
    24  	Messages OperationMessages `json:"messages,omitempty"`
    25  
    26  	// mta Id
    27  	MtaID string `json:"mtaId,omitempty"`
    28  
    29  	// namespace
    30  	// Read Only: true
    31  	Namespace string `json:"namespace,omitempty"`
    32  
    33  	// parameters
    34  	Parameters map[string]interface{} `json:"parameters,omitempty"`
    35  
    36  	// process Id
    37  	ProcessID string `json:"processId,omitempty"`
    38  
    39  	// process type
    40  	ProcessType string `json:"processType,omitempty"`
    41  
    42  	// space Id
    43  	SpaceID string `json:"spaceId,omitempty"`
    44  
    45  	// started at
    46  	StartedAt string `json:"startedAt,omitempty"`
    47  
    48  	// state
    49  	State State `json:"state,omitempty"`
    50  
    51  	// error type
    52  	ErrorType ErrorType `json:"errorType,omitempty"`
    53  
    54  	// user
    55  	User string `json:"user,omitempty"`
    56  }
    57  
    58  /* polymorph Operation acquiredLock false */
    59  
    60  /* polymorph Operation messages false */
    61  
    62  /* polymorph Operation mtaId false */
    63  
    64  /* polymorph Operation parameters false */
    65  
    66  /* polymorph Operation processId false */
    67  
    68  /* polymorph Operation processType false */
    69  
    70  /* polymorph Operation spaceId false */
    71  
    72  /* polymorph Operation startedAt false */
    73  
    74  /* polymorph Operation state false */
    75  
    76  /* polymorph Operation errorType false */
    77  
    78  /* polymorph Operation user false */
    79  
    80  // Validate validates this operation
    81  func (m *Operation) Validate(formats strfmt.Registry) error {
    82  	var res []error
    83  
    84  	if err := m.validateState(formats); err != nil {
    85  		// prop
    86  		res = append(res, err)
    87  	}
    88  
    89  	if err := m.validateErrorType(formats); err != nil {
    90  		res = append(res, err)
    91  	}
    92  
    93  	if len(res) > 0 {
    94  		return errors.CompositeValidationError(res...)
    95  	}
    96  	return nil
    97  }
    98  
    99  func (m *Operation) validateState(formats strfmt.Registry) error {
   100  
   101  	if swag.IsZero(m.State) { // not required
   102  		return nil
   103  	}
   104  
   105  	if err := m.State.Validate(formats); err != nil {
   106  		if ve, ok := err.(*errors.Validation); ok {
   107  			return ve.ValidateName("state")
   108  		}
   109  		return err
   110  	}
   111  
   112  	return nil
   113  }
   114  
   115  func (m *Operation) validateErrorType(formats strfmt.Registry) error {
   116  	if swag.IsZero(m.ErrorType) {
   117  		return nil
   118  	}
   119  
   120  	if err := m.ErrorType.Validate(formats); err != nil {
   121  		if ve, ok := err.(*errors.Validation); ok {
   122  			return ve.ValidateName("errorType")
   123  		}
   124  		return nil
   125  	}
   126  	return nil
   127  }
   128  
   129  // MarshalBinary interface implementation
   130  func (m *Operation) MarshalBinary() ([]byte, error) {
   131  	if m == nil {
   132  		return nil, nil
   133  	}
   134  	return swag.WriteJSON(m)
   135  }
   136  
   137  // UnmarshalBinary interface implementation
   138  func (m *Operation) UnmarshalBinary(b []byte) error {
   139  	var res Operation
   140  	if err := swag.ReadJSON(b, &res); err != nil {
   141  		return err
   142  	}
   143  	*m = res
   144  	return nil
   145  }