mirror of https://github.com/vernonkeenan/lib
404 lines
10 KiB
Go
404 lines
10 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
// (c) 2012-2020 by Taxnexus, Inc.
|
|
// All rights reserved worldwide.
|
|
// Proprietary product; unlicensed use is not allowed
|
|
|
|
package research_models
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
stderrors "errors"
|
|
"strconv"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag/jsonutils"
|
|
"github.com/go-openapi/swag/typeutils"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// PortfolioReconciliationRequest Strict one-candidate Discovery-mode direct create or Service update request. The completed run, tenant, Account, policy, candidate action and save path, source provenance, target identity, versions, attribution, and receipt are server-owned.
|
|
//
|
|
// swagger:model PortfolioReconciliationRequest
|
|
type PortfolioReconciliationRequest struct {
|
|
|
|
// Explicit acknowledgement that this operation creates one authoritative Product or Service, or updates one authoritative Service, and appends an immutable receipt
|
|
// Required: true
|
|
// Enum: [true]
|
|
Acknowledged *bool `json:"Acknowledged"`
|
|
|
|
// action
|
|
// Required: true
|
|
// Enum: ["create","update"]
|
|
Action *string `json:"Action"`
|
|
|
|
// candidate ID
|
|
// Required: true
|
|
// Format: uuid
|
|
CandidateID *strfmt.UUID `json:"CandidateID"`
|
|
|
|
// entity type
|
|
// Required: true
|
|
// Enum: ["company_product","company_service"]
|
|
EntityType *string `json:"EntityType"`
|
|
|
|
// fields
|
|
// Required: true
|
|
// Max Items: 9
|
|
// Min Items: 1
|
|
// Unique: true
|
|
Fields []*PortfolioReconciliationFieldSelection `json:"Fields"`
|
|
|
|
// idempotency key
|
|
// Required: true
|
|
// Max Length: 120
|
|
// Min Length: 16
|
|
// Pattern: ^[A-Za-z0-9._:-]+$
|
|
IdempotencyKey *string `json:"IdempotencyKey"`
|
|
|
|
// mode
|
|
// Required: true
|
|
// Enum: ["discovery"]
|
|
Mode *string `json:"Mode"`
|
|
}
|
|
|
|
// Validate validates this portfolio reconciliation request
|
|
func (m *PortfolioReconciliationRequest) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateAcknowledged(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateAction(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateCandidateID(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateEntityType(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateFields(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateIdempotencyKey(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateMode(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
var portfolioReconciliationRequestTypeAcknowledgedPropEnum []any
|
|
|
|
func init() {
|
|
var res []bool
|
|
if err := json.Unmarshal([]byte(`[true]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioReconciliationRequestTypeAcknowledgedPropEnum = append(portfolioReconciliationRequestTypeAcknowledgedPropEnum, v)
|
|
}
|
|
}
|
|
|
|
// prop value enum
|
|
func (m *PortfolioReconciliationRequest) validateAcknowledgedEnum(path, location string, value bool) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioReconciliationRequestTypeAcknowledgedPropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioReconciliationRequest) validateAcknowledged(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Acknowledged", "body", m.Acknowledged); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateAcknowledgedEnum("Acknowledged", "body", *m.Acknowledged); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioReconciliationRequestTypeActionPropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["create","update"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioReconciliationRequestTypeActionPropEnum = append(portfolioReconciliationRequestTypeActionPropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioReconciliationRequestActionCreate captures enum value "create"
|
|
PortfolioReconciliationRequestActionCreate string = "create"
|
|
|
|
// PortfolioReconciliationRequestActionUpdate captures enum value "update"
|
|
PortfolioReconciliationRequestActionUpdate string = "update"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioReconciliationRequest) validateActionEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioReconciliationRequestTypeActionPropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioReconciliationRequest) validateAction(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Action", "body", m.Action); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateActionEnum("Action", "body", *m.Action); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioReconciliationRequest) validateCandidateID(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("CandidateID", "body", m.CandidateID); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.FormatOf("CandidateID", "body", "uuid", m.CandidateID.String(), formats); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioReconciliationRequestTypeEntityTypePropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["company_product","company_service"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioReconciliationRequestTypeEntityTypePropEnum = append(portfolioReconciliationRequestTypeEntityTypePropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioReconciliationRequestEntityTypeCompanyProduct captures enum value "company_product"
|
|
PortfolioReconciliationRequestEntityTypeCompanyProduct string = "company_product"
|
|
|
|
// PortfolioReconciliationRequestEntityTypeCompanyService captures enum value "company_service"
|
|
PortfolioReconciliationRequestEntityTypeCompanyService string = "company_service"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioReconciliationRequest) validateEntityTypeEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioReconciliationRequestTypeEntityTypePropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioReconciliationRequest) validateEntityType(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("EntityType", "body", m.EntityType); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateEntityTypeEnum("EntityType", "body", *m.EntityType); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioReconciliationRequest) validateFields(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Fields", "body", m.Fields); err != nil {
|
|
return err
|
|
}
|
|
|
|
iFieldsSize := int64(len(m.Fields))
|
|
|
|
if err := validate.MinItems("Fields", "body", iFieldsSize, 1); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxItems("Fields", "body", iFieldsSize, 9); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.UniqueItems("Fields", "body", m.Fields); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Fields); i++ {
|
|
if typeutils.IsZero(m.Fields[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Fields[i] != nil {
|
|
if err := m.Fields[i].Validate(formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Fields" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Fields" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioReconciliationRequest) validateIdempotencyKey(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("IdempotencyKey", "body", m.IdempotencyKey); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MinLength("IdempotencyKey", "body", *m.IdempotencyKey, 16); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.MaxLength("IdempotencyKey", "body", *m.IdempotencyKey, 120); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.Pattern("IdempotencyKey", "body", *m.IdempotencyKey, `^[A-Za-z0-9._:-]+$`); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
var portfolioReconciliationRequestTypeModePropEnum []any
|
|
|
|
func init() {
|
|
var res []string
|
|
if err := json.Unmarshal([]byte(`["discovery"]`), &res); err != nil {
|
|
panic(err)
|
|
}
|
|
for _, v := range res {
|
|
portfolioReconciliationRequestTypeModePropEnum = append(portfolioReconciliationRequestTypeModePropEnum, v)
|
|
}
|
|
}
|
|
|
|
const (
|
|
|
|
// PortfolioReconciliationRequestModeDiscovery captures enum value "discovery"
|
|
PortfolioReconciliationRequestModeDiscovery string = "discovery"
|
|
)
|
|
|
|
// prop value enum
|
|
func (m *PortfolioReconciliationRequest) validateModeEnum(path, location string, value string) error {
|
|
if err := validate.EnumCase(path, location, value, portfolioReconciliationRequestTypeModePropEnum, true); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioReconciliationRequest) validateMode(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("Mode", "body", m.Mode); err != nil {
|
|
return err
|
|
}
|
|
|
|
// value enum
|
|
if err := m.validateModeEnum("Mode", "body", *m.Mode); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this portfolio reconciliation request based on the context it is used
|
|
func (m *PortfolioReconciliationRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateFields(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PortfolioReconciliationRequest) contextValidateFields(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Fields); i++ {
|
|
|
|
if m.Fields[i] != nil {
|
|
|
|
if typeutils.IsZero(m.Fields[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.Fields[i].ContextValidate(ctx, formats); err != nil {
|
|
ve := new(errors.Validation)
|
|
if stderrors.As(err, &ve) {
|
|
return ve.ValidateName("Fields" + "." + strconv.Itoa(i))
|
|
}
|
|
ce := new(errors.CompositeError)
|
|
if stderrors.As(err, &ce) {
|
|
return ce.ValidateName("Fields" + "." + strconv.Itoa(i))
|
|
}
|
|
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *PortfolioReconciliationRequest) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return jsonutils.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *PortfolioReconciliationRequest) UnmarshalBinary(b []byte) error {
|
|
var res PortfolioReconciliationRequest
|
|
if err := jsonutils.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|