mirror of
https://github.com/openziti/ziti.git
synced 2026-10-14 08:10:17 +00:00
453 lines
11 KiB
Go
453 lines
11 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
//
|
|
// Copyright NetFoundry, Inc.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
//
|
|
// __ __ _
|
|
// \ \ / / (_)
|
|
// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _
|
|
// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` |
|
|
// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it.
|
|
// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, |
|
|
// __/ |
|
|
// |___/
|
|
|
|
package rest_model
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"context"
|
|
"strconv"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// ServiceDetail service detail
|
|
//
|
|
// swagger:model serviceDetail
|
|
type ServiceDetail struct {
|
|
BaseEntity
|
|
|
|
// map of config data for this service keyed by the config type name. Only configs of the types requested will be returned.
|
|
// Required: true
|
|
Config map[string]map[string]interface{} `json:"config"`
|
|
|
|
// configs
|
|
// Required: true
|
|
Configs []string `json:"configs"`
|
|
|
|
// encryption required
|
|
// Required: true
|
|
EncryptionRequired *bool `json:"encryptionRequired"`
|
|
|
|
// name
|
|
// Required: true
|
|
Name *string `json:"name"`
|
|
|
|
// permissions
|
|
// Required: true
|
|
Permissions DialBindArray `json:"permissions"`
|
|
|
|
// posture queries
|
|
// Required: true
|
|
PostureQueries []*PostureQueries `json:"postureQueries"`
|
|
|
|
// role attributes
|
|
// Required: true
|
|
RoleAttributes *Attributes `json:"roleAttributes"`
|
|
|
|
// terminator strategy
|
|
// Required: true
|
|
TerminatorStrategy *string `json:"terminatorStrategy"`
|
|
}
|
|
|
|
// UnmarshalJSON unmarshals this object from a JSON structure
|
|
func (m *ServiceDetail) UnmarshalJSON(raw []byte) error {
|
|
// AO0
|
|
var aO0 BaseEntity
|
|
if err := swag.ReadJSON(raw, &aO0); err != nil {
|
|
return err
|
|
}
|
|
m.BaseEntity = aO0
|
|
|
|
// AO1
|
|
var dataAO1 struct {
|
|
Config map[string]map[string]interface{} `json:"config"`
|
|
|
|
Configs []string `json:"configs"`
|
|
|
|
EncryptionRequired *bool `json:"encryptionRequired"`
|
|
|
|
Name *string `json:"name"`
|
|
|
|
Permissions DialBindArray `json:"permissions"`
|
|
|
|
PostureQueries []*PostureQueries `json:"postureQueries"`
|
|
|
|
RoleAttributes *Attributes `json:"roleAttributes"`
|
|
|
|
TerminatorStrategy *string `json:"terminatorStrategy"`
|
|
}
|
|
if err := swag.ReadJSON(raw, &dataAO1); err != nil {
|
|
return err
|
|
}
|
|
|
|
m.Config = dataAO1.Config
|
|
|
|
m.Configs = dataAO1.Configs
|
|
|
|
m.EncryptionRequired = dataAO1.EncryptionRequired
|
|
|
|
m.Name = dataAO1.Name
|
|
|
|
m.Permissions = dataAO1.Permissions
|
|
|
|
m.PostureQueries = dataAO1.PostureQueries
|
|
|
|
m.RoleAttributes = dataAO1.RoleAttributes
|
|
|
|
m.TerminatorStrategy = dataAO1.TerminatorStrategy
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON marshals this object to a JSON structure
|
|
func (m ServiceDetail) MarshalJSON() ([]byte, error) {
|
|
_parts := make([][]byte, 0, 2)
|
|
|
|
aO0, err := swag.WriteJSON(m.BaseEntity)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
_parts = append(_parts, aO0)
|
|
var dataAO1 struct {
|
|
Config map[string]map[string]interface{} `json:"config"`
|
|
|
|
Configs []string `json:"configs"`
|
|
|
|
EncryptionRequired *bool `json:"encryptionRequired"`
|
|
|
|
Name *string `json:"name"`
|
|
|
|
Permissions DialBindArray `json:"permissions"`
|
|
|
|
PostureQueries []*PostureQueries `json:"postureQueries"`
|
|
|
|
RoleAttributes *Attributes `json:"roleAttributes"`
|
|
|
|
TerminatorStrategy *string `json:"terminatorStrategy"`
|
|
}
|
|
|
|
dataAO1.Config = m.Config
|
|
|
|
dataAO1.Configs = m.Configs
|
|
|
|
dataAO1.EncryptionRequired = m.EncryptionRequired
|
|
|
|
dataAO1.Name = m.Name
|
|
|
|
dataAO1.Permissions = m.Permissions
|
|
|
|
dataAO1.PostureQueries = m.PostureQueries
|
|
|
|
dataAO1.RoleAttributes = m.RoleAttributes
|
|
|
|
dataAO1.TerminatorStrategy = m.TerminatorStrategy
|
|
|
|
jsonDataAO1, errAO1 := swag.WriteJSON(dataAO1)
|
|
if errAO1 != nil {
|
|
return nil, errAO1
|
|
}
|
|
_parts = append(_parts, jsonDataAO1)
|
|
return swag.ConcatJSON(_parts...), nil
|
|
}
|
|
|
|
// Validate validates this service detail
|
|
func (m *ServiceDetail) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
// validation for a type composition with BaseEntity
|
|
if err := m.BaseEntity.Validate(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateConfig(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateConfigs(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateEncryptionRequired(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateName(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validatePermissions(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validatePostureQueries(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRoleAttributes(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateTerminatorStrategy(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) validateConfig(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("config", "body", m.Config); err != nil {
|
|
return err
|
|
}
|
|
|
|
for k := range m.Config {
|
|
|
|
if err := validate.Required("config"+"."+k, "body", m.Config[k]); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.Required("config"+"."+k, "body", m.Config); err != nil {
|
|
return err
|
|
}
|
|
|
|
for kk := range m.Config[k] {
|
|
|
|
if err := validate.Required("config"+"."+k+"."+kk, "body", m.Config[k][kk]); err != nil {
|
|
return err
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) validateConfigs(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("configs", "body", m.Configs); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) validateEncryptionRequired(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("encryptionRequired", "body", m.EncryptionRequired); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) validateName(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("name", "body", m.Name); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) validatePermissions(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("permissions", "body", m.Permissions); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := m.Permissions.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("permissions")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("permissions")
|
|
}
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) validatePostureQueries(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("postureQueries", "body", m.PostureQueries); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.PostureQueries); i++ {
|
|
if swag.IsZero(m.PostureQueries[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.PostureQueries[i] != nil {
|
|
if err := m.PostureQueries[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("postureQueries" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("postureQueries" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) validateRoleAttributes(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("roleAttributes", "body", m.RoleAttributes); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.RoleAttributes != nil {
|
|
if err := m.RoleAttributes.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roleAttributes")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roleAttributes")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) validateTerminatorStrategy(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("terminatorStrategy", "body", m.TerminatorStrategy); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this service detail based on the context it is used
|
|
func (m *ServiceDetail) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
// validation for a type composition with BaseEntity
|
|
if err := m.BaseEntity.ContextValidate(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidatePermissions(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidatePostureQueries(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateRoleAttributes(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) contextValidatePermissions(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if err := m.Permissions.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("permissions")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("permissions")
|
|
}
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) contextValidatePostureQueries(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.PostureQueries); i++ {
|
|
|
|
if m.PostureQueries[i] != nil {
|
|
if err := m.PostureQueries[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("postureQueries" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("postureQueries" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *ServiceDetail) contextValidateRoleAttributes(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.RoleAttributes != nil {
|
|
if err := m.RoleAttributes.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roleAttributes")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roleAttributes")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *ServiceDetail) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *ServiceDetail) UnmarshalBinary(b []byte) error {
|
|
var res ServiceDetail
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|