mirror of
https://github.com/openziti/ziti.git
synced 2026-09-21 01:53:22 +00:00
b562fb5c07
- splits Open API 2.0 (swagger) into client/management APIs - uses go-swaggers flatten capabilities - uses newer version of go-swagger (v0.27.0) - introduces /edge/client/v1, /edge/management/v1 - non-prefixed URLs default to /edge/client/v1 - splits some shared management/client API handlers - renames some REST models to "client" instead of "limited" - passes all apitests, fails dataflow upd test (main fails this as well) - updates generate rest script for powershell - todo: test generate rest script for bash - todo: use xweb (different branch)
325 lines
7.2 KiB
Go
325 lines
7.2 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"
|
|
)
|
|
|
|
// PostureData posture data
|
|
//
|
|
// swagger:model postureData
|
|
type PostureData struct {
|
|
|
|
// api session posture data
|
|
// Required: true
|
|
APISessionPostureData map[string]APISessionPostureData `json:"apiSessionPostureData"`
|
|
|
|
// domain
|
|
// Required: true
|
|
Domain *PostureDataDomain `json:"domain"`
|
|
|
|
// mac
|
|
// Required: true
|
|
Mac *PostureDataMac `json:"mac"`
|
|
|
|
// os
|
|
// Required: true
|
|
Os *PostureDataOs `json:"os"`
|
|
|
|
// processes
|
|
// Required: true
|
|
Processes []*PostureDataProcess `json:"processes"`
|
|
}
|
|
|
|
// Validate validates this posture data
|
|
func (m *PostureData) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateAPISessionPostureData(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateDomain(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateMac(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateOs(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateProcesses(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PostureData) validateAPISessionPostureData(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("apiSessionPostureData", "body", m.APISessionPostureData); err != nil {
|
|
return err
|
|
}
|
|
|
|
for k := range m.APISessionPostureData {
|
|
|
|
if err := validate.Required("apiSessionPostureData"+"."+k, "body", m.APISessionPostureData[k]); err != nil {
|
|
return err
|
|
}
|
|
if val, ok := m.APISessionPostureData[k]; ok {
|
|
if err := val.Validate(formats); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PostureData) validateDomain(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("domain", "body", m.Domain); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.Domain != nil {
|
|
if err := m.Domain.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("domain")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PostureData) validateMac(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("mac", "body", m.Mac); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.Mac != nil {
|
|
if err := m.Mac.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("mac")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PostureData) validateOs(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("os", "body", m.Os); err != nil {
|
|
return err
|
|
}
|
|
|
|
if m.Os != nil {
|
|
if err := m.Os.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("os")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PostureData) validateProcesses(formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("processes", "body", m.Processes); err != nil {
|
|
return err
|
|
}
|
|
|
|
for i := 0; i < len(m.Processes); i++ {
|
|
if swag.IsZero(m.Processes[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Processes[i] != nil {
|
|
if err := m.Processes[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("processes" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this posture data based on the context it is used
|
|
func (m *PostureData) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateAPISessionPostureData(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateDomain(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateMac(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateOs(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateProcesses(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *PostureData) contextValidateAPISessionPostureData(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if err := validate.Required("apiSessionPostureData", "body", m.APISessionPostureData); err != nil {
|
|
return err
|
|
}
|
|
|
|
for k := range m.APISessionPostureData {
|
|
|
|
if val, ok := m.APISessionPostureData[k]; ok {
|
|
if err := val.ContextValidate(ctx, formats); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PostureData) contextValidateDomain(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Domain != nil {
|
|
if err := m.Domain.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("domain")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PostureData) contextValidateMac(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Mac != nil {
|
|
if err := m.Mac.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("mac")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PostureData) contextValidateOs(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.Os != nil {
|
|
if err := m.Os.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("os")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *PostureData) contextValidateProcesses(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(m.Processes); i++ {
|
|
|
|
if m.Processes[i] != nil {
|
|
if err := m.Processes[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("processes" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *PostureData) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *PostureData) UnmarshalBinary(b []byte) error {
|
|
var res PostureData
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|