Files
ziti/rest_model/posture_check_list.go
T
Andrew Martinez f0fec7512c swgger fixes
2020-10-13 08:08:12 -04:00

103 lines
3.1 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 (
"bytes"
"encoding/json"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/validate"
"io"
"io/ioutil"
)
// PostureCheckList posture check list
//
// swagger:discriminator PostureCheckList
type PostureCheckList interface {
runtime.Validatable
// AdditionalProperties in base type shoud be handled just like regular properties
// At this moment, the base type property is pushed down to the subtype
}
type postureCheckList struct {
}
// UnmarshalPostureCheckListSlice unmarshals polymorphic slices of PostureCheckList
func UnmarshalPostureCheckListSlice(reader io.Reader, consumer runtime.Consumer) ([]PostureCheckList, error) {
var elements []json.RawMessage
if err := consumer.Consume(reader, &elements); err != nil {
return nil, err
}
var result []PostureCheckList
for _, element := range elements {
obj, err := unmarshalPostureCheckList(element, consumer)
if err != nil {
return nil, err
}
result = append(result, obj)
}
return result, nil
}
// UnmarshalPostureCheckList unmarshals polymorphic PostureCheckList
func UnmarshalPostureCheckList(reader io.Reader, consumer runtime.Consumer) (PostureCheckList, error) {
// we need to read this twice, so first into a buffer
data, err := ioutil.ReadAll(reader)
if err != nil {
return nil, err
}
return unmarshalPostureCheckList(data, consumer)
}
func unmarshalPostureCheckList(data []byte, consumer runtime.Consumer) (PostureCheckList, error) {
buf := bytes.NewBuffer(data)
// the first time this is read is to fetch the value of the property.
var getType struct {
Empty string `json:""`
}
if err := consumer.Consume(buf, &getType); err != nil {
return nil, err
}
if err := validate.RequiredString("", "body", getType.Empty); err != nil {
return nil, err
}
// The value of is used to determine which type to create and unmarshal the data into
switch getType.Empty {
}
return nil, errors.New(422, "invalid value: %q", getType.Empty)
}