pipelines/backend/api/go_http_client/experiment_model/api_experiment.go

92 lines
2.4 KiB
Go

// Copyright 2019 Google LLC
//
// 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
//
// http://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.
// Code generated by go-swagger; DO NOT EDIT.
package experiment_model
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// APIExperiment api experiment
// swagger:model apiExperiment
type APIExperiment struct {
// Output. The time that the experiment created.
// Format: date-time
CreatedAt strfmt.DateTime `json:"created_at,omitempty"`
// Optional input field. Describing the purpose of the experiment
Description string `json:"description,omitempty"`
// Output. Unique experiment ID. Generated by API server.
ID string `json:"id,omitempty"`
// Required input field. Unique experiment name provided by user.
Name string `json:"name,omitempty"`
}
// Validate validates this api experiment
func (m *APIExperiment) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCreatedAt(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *APIExperiment) validateCreatedAt(formats strfmt.Registry) error {
if swag.IsZero(m.CreatedAt) { // not required
return nil
}
if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *APIExperiment) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *APIExperiment) UnmarshalBinary(b []byte) error {
var res APIExperiment
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}