github.com/digitalocean/go-netbox@v0.0.2/netbox/models/console_server_port.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright 2020 The go-netbox Authors.
     4  //
     5  // Licensed under the Apache License, Version 2.0 (the "License");
     6  // you may not use this file except in compliance with the License.
     7  // You may obtain a copy of the License at
     8  //
     9  //   http://www.apache.org/licenses/LICENSE-2.0
    10  //
    11  // Unless required by applicable law or agreed to in writing, software
    12  // distributed under the License is distributed on an "AS IS" BASIS,
    13  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  // See the License for the specific language governing permissions and
    15  // limitations under the License.
    16  //
    17  
    18  package models
    19  
    20  // This file was generated by the swagger tool.
    21  // Editing this file might prove futile when you re-run the swagger generate command
    22  
    23  import (
    24  	"context"
    25  	"encoding/json"
    26  	"strconv"
    27  
    28  	"github.com/go-openapi/errors"
    29  	"github.com/go-openapi/strfmt"
    30  	"github.com/go-openapi/swag"
    31  	"github.com/go-openapi/validate"
    32  )
    33  
    34  // ConsoleServerPort console server port
    35  //
    36  // swagger:model ConsoleServerPort
    37  type ConsoleServerPort struct {
    38  
    39  	// occupied
    40  	// Read Only: true
    41  	Occupied *bool `json:"_occupied,omitempty"`
    42  
    43  	// cable
    44  	Cable *NestedCable `json:"cable,omitempty"`
    45  
    46  	// Cable peer
    47  	//
    48  	//
    49  	// Return the appropriate serializer for the cable termination model.
    50  	//
    51  	// Read Only: true
    52  	CablePeer map[string]*string `json:"cable_peer,omitempty"`
    53  
    54  	// Cable peer type
    55  	// Read Only: true
    56  	CablePeerType string `json:"cable_peer_type,omitempty"`
    57  
    58  	// Connected endpoint
    59  	//
    60  	//
    61  	// Return the appropriate serializer for the type of connected object.
    62  	//
    63  	// Read Only: true
    64  	ConnectedEndpoint map[string]*string `json:"connected_endpoint,omitempty"`
    65  
    66  	// Connected endpoint reachable
    67  	// Read Only: true
    68  	ConnectedEndpointReachable *bool `json:"connected_endpoint_reachable,omitempty"`
    69  
    70  	// Connected endpoint type
    71  	// Read Only: true
    72  	ConnectedEndpointType string `json:"connected_endpoint_type,omitempty"`
    73  
    74  	// Created
    75  	// Read Only: true
    76  	// Format: date
    77  	Created strfmt.Date `json:"created,omitempty"`
    78  
    79  	// Custom fields
    80  	CustomFields interface{} `json:"custom_fields,omitempty"`
    81  
    82  	// Description
    83  	// Max Length: 200
    84  	Description string `json:"description,omitempty"`
    85  
    86  	// device
    87  	// Required: true
    88  	Device *NestedDevice `json:"device"`
    89  
    90  	// Display
    91  	// Read Only: true
    92  	Display string `json:"display,omitempty"`
    93  
    94  	// Id
    95  	// Read Only: true
    96  	ID int64 `json:"id,omitempty"`
    97  
    98  	// Label
    99  	//
   100  	// Physical label
   101  	// Max Length: 64
   102  	Label string `json:"label,omitempty"`
   103  
   104  	// Last updated
   105  	// Read Only: true
   106  	// Format: date-time
   107  	LastUpdated strfmt.DateTime `json:"last_updated,omitempty"`
   108  
   109  	// Mark connected
   110  	//
   111  	// Treat as if a cable is connected
   112  	MarkConnected bool `json:"mark_connected,omitempty"`
   113  
   114  	// Name
   115  	// Required: true
   116  	// Max Length: 64
   117  	// Min Length: 1
   118  	Name *string `json:"name"`
   119  
   120  	// speed
   121  	Speed *ConsoleServerPortSpeed `json:"speed,omitempty"`
   122  
   123  	// tags
   124  	Tags []*NestedTag `json:"tags"`
   125  
   126  	// type
   127  	Type *ConsoleServerPortType `json:"type,omitempty"`
   128  
   129  	// Url
   130  	// Read Only: true
   131  	// Format: uri
   132  	URL strfmt.URI `json:"url,omitempty"`
   133  }
   134  
   135  // Validate validates this console server port
   136  func (m *ConsoleServerPort) Validate(formats strfmt.Registry) error {
   137  	var res []error
   138  
   139  	if err := m.validateCable(formats); err != nil {
   140  		res = append(res, err)
   141  	}
   142  
   143  	if err := m.validateCreated(formats); err != nil {
   144  		res = append(res, err)
   145  	}
   146  
   147  	if err := m.validateDescription(formats); err != nil {
   148  		res = append(res, err)
   149  	}
   150  
   151  	if err := m.validateDevice(formats); err != nil {
   152  		res = append(res, err)
   153  	}
   154  
   155  	if err := m.validateLabel(formats); err != nil {
   156  		res = append(res, err)
   157  	}
   158  
   159  	if err := m.validateLastUpdated(formats); err != nil {
   160  		res = append(res, err)
   161  	}
   162  
   163  	if err := m.validateName(formats); err != nil {
   164  		res = append(res, err)
   165  	}
   166  
   167  	if err := m.validateSpeed(formats); err != nil {
   168  		res = append(res, err)
   169  	}
   170  
   171  	if err := m.validateTags(formats); err != nil {
   172  		res = append(res, err)
   173  	}
   174  
   175  	if err := m.validateType(formats); err != nil {
   176  		res = append(res, err)
   177  	}
   178  
   179  	if err := m.validateURL(formats); err != nil {
   180  		res = append(res, err)
   181  	}
   182  
   183  	if len(res) > 0 {
   184  		return errors.CompositeValidationError(res...)
   185  	}
   186  	return nil
   187  }
   188  
   189  func (m *ConsoleServerPort) validateCable(formats strfmt.Registry) error {
   190  	if swag.IsZero(m.Cable) { // not required
   191  		return nil
   192  	}
   193  
   194  	if m.Cable != nil {
   195  		if err := m.Cable.Validate(formats); err != nil {
   196  			if ve, ok := err.(*errors.Validation); ok {
   197  				return ve.ValidateName("cable")
   198  			} else if ce, ok := err.(*errors.CompositeError); ok {
   199  				return ce.ValidateName("cable")
   200  			}
   201  			return err
   202  		}
   203  	}
   204  
   205  	return nil
   206  }
   207  
   208  func (m *ConsoleServerPort) validateCreated(formats strfmt.Registry) error {
   209  	if swag.IsZero(m.Created) { // not required
   210  		return nil
   211  	}
   212  
   213  	if err := validate.FormatOf("created", "body", "date", m.Created.String(), formats); err != nil {
   214  		return err
   215  	}
   216  
   217  	return nil
   218  }
   219  
   220  func (m *ConsoleServerPort) validateDescription(formats strfmt.Registry) error {
   221  	if swag.IsZero(m.Description) { // not required
   222  		return nil
   223  	}
   224  
   225  	if err := validate.MaxLength("description", "body", m.Description, 200); err != nil {
   226  		return err
   227  	}
   228  
   229  	return nil
   230  }
   231  
   232  func (m *ConsoleServerPort) validateDevice(formats strfmt.Registry) error {
   233  
   234  	if err := validate.Required("device", "body", m.Device); err != nil {
   235  		return err
   236  	}
   237  
   238  	if m.Device != nil {
   239  		if err := m.Device.Validate(formats); err != nil {
   240  			if ve, ok := err.(*errors.Validation); ok {
   241  				return ve.ValidateName("device")
   242  			} else if ce, ok := err.(*errors.CompositeError); ok {
   243  				return ce.ValidateName("device")
   244  			}
   245  			return err
   246  		}
   247  	}
   248  
   249  	return nil
   250  }
   251  
   252  func (m *ConsoleServerPort) validateLabel(formats strfmt.Registry) error {
   253  	if swag.IsZero(m.Label) { // not required
   254  		return nil
   255  	}
   256  
   257  	if err := validate.MaxLength("label", "body", m.Label, 64); err != nil {
   258  		return err
   259  	}
   260  
   261  	return nil
   262  }
   263  
   264  func (m *ConsoleServerPort) validateLastUpdated(formats strfmt.Registry) error {
   265  	if swag.IsZero(m.LastUpdated) { // not required
   266  		return nil
   267  	}
   268  
   269  	if err := validate.FormatOf("last_updated", "body", "date-time", m.LastUpdated.String(), formats); err != nil {
   270  		return err
   271  	}
   272  
   273  	return nil
   274  }
   275  
   276  func (m *ConsoleServerPort) validateName(formats strfmt.Registry) error {
   277  
   278  	if err := validate.Required("name", "body", m.Name); err != nil {
   279  		return err
   280  	}
   281  
   282  	if err := validate.MinLength("name", "body", *m.Name, 1); err != nil {
   283  		return err
   284  	}
   285  
   286  	if err := validate.MaxLength("name", "body", *m.Name, 64); err != nil {
   287  		return err
   288  	}
   289  
   290  	return nil
   291  }
   292  
   293  func (m *ConsoleServerPort) validateSpeed(formats strfmt.Registry) error {
   294  	if swag.IsZero(m.Speed) { // not required
   295  		return nil
   296  	}
   297  
   298  	if m.Speed != nil {
   299  		if err := m.Speed.Validate(formats); err != nil {
   300  			if ve, ok := err.(*errors.Validation); ok {
   301  				return ve.ValidateName("speed")
   302  			} else if ce, ok := err.(*errors.CompositeError); ok {
   303  				return ce.ValidateName("speed")
   304  			}
   305  			return err
   306  		}
   307  	}
   308  
   309  	return nil
   310  }
   311  
   312  func (m *ConsoleServerPort) validateTags(formats strfmt.Registry) error {
   313  	if swag.IsZero(m.Tags) { // not required
   314  		return nil
   315  	}
   316  
   317  	for i := 0; i < len(m.Tags); i++ {
   318  		if swag.IsZero(m.Tags[i]) { // not required
   319  			continue
   320  		}
   321  
   322  		if m.Tags[i] != nil {
   323  			if err := m.Tags[i].Validate(formats); err != nil {
   324  				if ve, ok := err.(*errors.Validation); ok {
   325  					return ve.ValidateName("tags" + "." + strconv.Itoa(i))
   326  				} else if ce, ok := err.(*errors.CompositeError); ok {
   327  					return ce.ValidateName("tags" + "." + strconv.Itoa(i))
   328  				}
   329  				return err
   330  			}
   331  		}
   332  
   333  	}
   334  
   335  	return nil
   336  }
   337  
   338  func (m *ConsoleServerPort) validateType(formats strfmt.Registry) error {
   339  	if swag.IsZero(m.Type) { // not required
   340  		return nil
   341  	}
   342  
   343  	if m.Type != nil {
   344  		if err := m.Type.Validate(formats); err != nil {
   345  			if ve, ok := err.(*errors.Validation); ok {
   346  				return ve.ValidateName("type")
   347  			} else if ce, ok := err.(*errors.CompositeError); ok {
   348  				return ce.ValidateName("type")
   349  			}
   350  			return err
   351  		}
   352  	}
   353  
   354  	return nil
   355  }
   356  
   357  func (m *ConsoleServerPort) validateURL(formats strfmt.Registry) error {
   358  	if swag.IsZero(m.URL) { // not required
   359  		return nil
   360  	}
   361  
   362  	if err := validate.FormatOf("url", "body", "uri", m.URL.String(), formats); err != nil {
   363  		return err
   364  	}
   365  
   366  	return nil
   367  }
   368  
   369  // ContextValidate validate this console server port based on the context it is used
   370  func (m *ConsoleServerPort) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   371  	var res []error
   372  
   373  	if err := m.contextValidateOccupied(ctx, formats); err != nil {
   374  		res = append(res, err)
   375  	}
   376  
   377  	if err := m.contextValidateCable(ctx, formats); err != nil {
   378  		res = append(res, err)
   379  	}
   380  
   381  	if err := m.contextValidateCablePeer(ctx, formats); err != nil {
   382  		res = append(res, err)
   383  	}
   384  
   385  	if err := m.contextValidateCablePeerType(ctx, formats); err != nil {
   386  		res = append(res, err)
   387  	}
   388  
   389  	if err := m.contextValidateConnectedEndpoint(ctx, formats); err != nil {
   390  		res = append(res, err)
   391  	}
   392  
   393  	if err := m.contextValidateConnectedEndpointReachable(ctx, formats); err != nil {
   394  		res = append(res, err)
   395  	}
   396  
   397  	if err := m.contextValidateConnectedEndpointType(ctx, formats); err != nil {
   398  		res = append(res, err)
   399  	}
   400  
   401  	if err := m.contextValidateCreated(ctx, formats); err != nil {
   402  		res = append(res, err)
   403  	}
   404  
   405  	if err := m.contextValidateDevice(ctx, formats); err != nil {
   406  		res = append(res, err)
   407  	}
   408  
   409  	if err := m.contextValidateDisplay(ctx, formats); err != nil {
   410  		res = append(res, err)
   411  	}
   412  
   413  	if err := m.contextValidateID(ctx, formats); err != nil {
   414  		res = append(res, err)
   415  	}
   416  
   417  	if err := m.contextValidateLastUpdated(ctx, formats); err != nil {
   418  		res = append(res, err)
   419  	}
   420  
   421  	if err := m.contextValidateSpeed(ctx, formats); err != nil {
   422  		res = append(res, err)
   423  	}
   424  
   425  	if err := m.contextValidateTags(ctx, formats); err != nil {
   426  		res = append(res, err)
   427  	}
   428  
   429  	if err := m.contextValidateType(ctx, formats); err != nil {
   430  		res = append(res, err)
   431  	}
   432  
   433  	if err := m.contextValidateURL(ctx, formats); err != nil {
   434  		res = append(res, err)
   435  	}
   436  
   437  	if len(res) > 0 {
   438  		return errors.CompositeValidationError(res...)
   439  	}
   440  	return nil
   441  }
   442  
   443  func (m *ConsoleServerPort) contextValidateOccupied(ctx context.Context, formats strfmt.Registry) error {
   444  
   445  	if err := validate.ReadOnly(ctx, "_occupied", "body", m.Occupied); err != nil {
   446  		return err
   447  	}
   448  
   449  	return nil
   450  }
   451  
   452  func (m *ConsoleServerPort) contextValidateCable(ctx context.Context, formats strfmt.Registry) error {
   453  
   454  	if m.Cable != nil {
   455  		if err := m.Cable.ContextValidate(ctx, formats); err != nil {
   456  			if ve, ok := err.(*errors.Validation); ok {
   457  				return ve.ValidateName("cable")
   458  			} else if ce, ok := err.(*errors.CompositeError); ok {
   459  				return ce.ValidateName("cable")
   460  			}
   461  			return err
   462  		}
   463  	}
   464  
   465  	return nil
   466  }
   467  
   468  func (m *ConsoleServerPort) contextValidateCablePeer(ctx context.Context, formats strfmt.Registry) error {
   469  
   470  	return nil
   471  }
   472  
   473  func (m *ConsoleServerPort) contextValidateCablePeerType(ctx context.Context, formats strfmt.Registry) error {
   474  
   475  	if err := validate.ReadOnly(ctx, "cable_peer_type", "body", string(m.CablePeerType)); err != nil {
   476  		return err
   477  	}
   478  
   479  	return nil
   480  }
   481  
   482  func (m *ConsoleServerPort) contextValidateConnectedEndpoint(ctx context.Context, formats strfmt.Registry) error {
   483  
   484  	return nil
   485  }
   486  
   487  func (m *ConsoleServerPort) contextValidateConnectedEndpointReachable(ctx context.Context, formats strfmt.Registry) error {
   488  
   489  	if err := validate.ReadOnly(ctx, "connected_endpoint_reachable", "body", m.ConnectedEndpointReachable); err != nil {
   490  		return err
   491  	}
   492  
   493  	return nil
   494  }
   495  
   496  func (m *ConsoleServerPort) contextValidateConnectedEndpointType(ctx context.Context, formats strfmt.Registry) error {
   497  
   498  	if err := validate.ReadOnly(ctx, "connected_endpoint_type", "body", string(m.ConnectedEndpointType)); err != nil {
   499  		return err
   500  	}
   501  
   502  	return nil
   503  }
   504  
   505  func (m *ConsoleServerPort) contextValidateCreated(ctx context.Context, formats strfmt.Registry) error {
   506  
   507  	if err := validate.ReadOnly(ctx, "created", "body", strfmt.Date(m.Created)); err != nil {
   508  		return err
   509  	}
   510  
   511  	return nil
   512  }
   513  
   514  func (m *ConsoleServerPort) contextValidateDevice(ctx context.Context, formats strfmt.Registry) error {
   515  
   516  	if m.Device != nil {
   517  		if err := m.Device.ContextValidate(ctx, formats); err != nil {
   518  			if ve, ok := err.(*errors.Validation); ok {
   519  				return ve.ValidateName("device")
   520  			} else if ce, ok := err.(*errors.CompositeError); ok {
   521  				return ce.ValidateName("device")
   522  			}
   523  			return err
   524  		}
   525  	}
   526  
   527  	return nil
   528  }
   529  
   530  func (m *ConsoleServerPort) contextValidateDisplay(ctx context.Context, formats strfmt.Registry) error {
   531  
   532  	if err := validate.ReadOnly(ctx, "display", "body", string(m.Display)); err != nil {
   533  		return err
   534  	}
   535  
   536  	return nil
   537  }
   538  
   539  func (m *ConsoleServerPort) contextValidateID(ctx context.Context, formats strfmt.Registry) error {
   540  
   541  	if err := validate.ReadOnly(ctx, "id", "body", int64(m.ID)); err != nil {
   542  		return err
   543  	}
   544  
   545  	return nil
   546  }
   547  
   548  func (m *ConsoleServerPort) contextValidateLastUpdated(ctx context.Context, formats strfmt.Registry) error {
   549  
   550  	if err := validate.ReadOnly(ctx, "last_updated", "body", strfmt.DateTime(m.LastUpdated)); err != nil {
   551  		return err
   552  	}
   553  
   554  	return nil
   555  }
   556  
   557  func (m *ConsoleServerPort) contextValidateSpeed(ctx context.Context, formats strfmt.Registry) error {
   558  
   559  	if m.Speed != nil {
   560  		if err := m.Speed.ContextValidate(ctx, formats); err != nil {
   561  			if ve, ok := err.(*errors.Validation); ok {
   562  				return ve.ValidateName("speed")
   563  			} else if ce, ok := err.(*errors.CompositeError); ok {
   564  				return ce.ValidateName("speed")
   565  			}
   566  			return err
   567  		}
   568  	}
   569  
   570  	return nil
   571  }
   572  
   573  func (m *ConsoleServerPort) contextValidateTags(ctx context.Context, formats strfmt.Registry) error {
   574  
   575  	for i := 0; i < len(m.Tags); i++ {
   576  
   577  		if m.Tags[i] != nil {
   578  			if err := m.Tags[i].ContextValidate(ctx, formats); err != nil {
   579  				if ve, ok := err.(*errors.Validation); ok {
   580  					return ve.ValidateName("tags" + "." + strconv.Itoa(i))
   581  				} else if ce, ok := err.(*errors.CompositeError); ok {
   582  					return ce.ValidateName("tags" + "." + strconv.Itoa(i))
   583  				}
   584  				return err
   585  			}
   586  		}
   587  
   588  	}
   589  
   590  	return nil
   591  }
   592  
   593  func (m *ConsoleServerPort) contextValidateType(ctx context.Context, formats strfmt.Registry) error {
   594  
   595  	if m.Type != nil {
   596  		if err := m.Type.ContextValidate(ctx, formats); err != nil {
   597  			if ve, ok := err.(*errors.Validation); ok {
   598  				return ve.ValidateName("type")
   599  			} else if ce, ok := err.(*errors.CompositeError); ok {
   600  				return ce.ValidateName("type")
   601  			}
   602  			return err
   603  		}
   604  	}
   605  
   606  	return nil
   607  }
   608  
   609  func (m *ConsoleServerPort) contextValidateURL(ctx context.Context, formats strfmt.Registry) error {
   610  
   611  	if err := validate.ReadOnly(ctx, "url", "body", strfmt.URI(m.URL)); err != nil {
   612  		return err
   613  	}
   614  
   615  	return nil
   616  }
   617  
   618  // MarshalBinary interface implementation
   619  func (m *ConsoleServerPort) MarshalBinary() ([]byte, error) {
   620  	if m == nil {
   621  		return nil, nil
   622  	}
   623  	return swag.WriteJSON(m)
   624  }
   625  
   626  // UnmarshalBinary interface implementation
   627  func (m *ConsoleServerPort) UnmarshalBinary(b []byte) error {
   628  	var res ConsoleServerPort
   629  	if err := swag.ReadJSON(b, &res); err != nil {
   630  		return err
   631  	}
   632  	*m = res
   633  	return nil
   634  }
   635  
   636  // ConsoleServerPortSpeed Speed
   637  //
   638  // swagger:model ConsoleServerPortSpeed
   639  type ConsoleServerPortSpeed struct {
   640  
   641  	// label
   642  	// Required: true
   643  	// Enum: [1200 bps 2400 bps 4800 bps 9600 bps 19.2 kbps 38.4 kbps 57.6 kbps 115.2 kbps]
   644  	Label *string `json:"label"`
   645  
   646  	// value
   647  	// Required: true
   648  	// Enum: [1200 2400 4800 9600 19200 38400 57600 115200]
   649  	Value *int64 `json:"value"`
   650  }
   651  
   652  // Validate validates this console server port speed
   653  func (m *ConsoleServerPortSpeed) Validate(formats strfmt.Registry) error {
   654  	var res []error
   655  
   656  	if err := m.validateLabel(formats); err != nil {
   657  		res = append(res, err)
   658  	}
   659  
   660  	if err := m.validateValue(formats); err != nil {
   661  		res = append(res, err)
   662  	}
   663  
   664  	if len(res) > 0 {
   665  		return errors.CompositeValidationError(res...)
   666  	}
   667  	return nil
   668  }
   669  
   670  var consoleServerPortSpeedTypeLabelPropEnum []interface{}
   671  
   672  func init() {
   673  	var res []string
   674  	if err := json.Unmarshal([]byte(`["1200 bps","2400 bps","4800 bps","9600 bps","19.2 kbps","38.4 kbps","57.6 kbps","115.2 kbps"]`), &res); err != nil {
   675  		panic(err)
   676  	}
   677  	for _, v := range res {
   678  		consoleServerPortSpeedTypeLabelPropEnum = append(consoleServerPortSpeedTypeLabelPropEnum, v)
   679  	}
   680  }
   681  
   682  const (
   683  
   684  	// ConsoleServerPortSpeedLabelNr1200Bps captures enum value "1200 bps"
   685  	ConsoleServerPortSpeedLabelNr1200Bps string = "1200 bps"
   686  
   687  	// ConsoleServerPortSpeedLabelNr2400Bps captures enum value "2400 bps"
   688  	ConsoleServerPortSpeedLabelNr2400Bps string = "2400 bps"
   689  
   690  	// ConsoleServerPortSpeedLabelNr4800Bps captures enum value "4800 bps"
   691  	ConsoleServerPortSpeedLabelNr4800Bps string = "4800 bps"
   692  
   693  	// ConsoleServerPortSpeedLabelNr9600Bps captures enum value "9600 bps"
   694  	ConsoleServerPortSpeedLabelNr9600Bps string = "9600 bps"
   695  
   696  	// ConsoleServerPortSpeedLabelNr19Dot2Kbps captures enum value "19.2 kbps"
   697  	ConsoleServerPortSpeedLabelNr19Dot2Kbps string = "19.2 kbps"
   698  
   699  	// ConsoleServerPortSpeedLabelNr38Dot4Kbps captures enum value "38.4 kbps"
   700  	ConsoleServerPortSpeedLabelNr38Dot4Kbps string = "38.4 kbps"
   701  
   702  	// ConsoleServerPortSpeedLabelNr57Dot6Kbps captures enum value "57.6 kbps"
   703  	ConsoleServerPortSpeedLabelNr57Dot6Kbps string = "57.6 kbps"
   704  
   705  	// ConsoleServerPortSpeedLabelNr115Dot2Kbps captures enum value "115.2 kbps"
   706  	ConsoleServerPortSpeedLabelNr115Dot2Kbps string = "115.2 kbps"
   707  )
   708  
   709  // prop value enum
   710  func (m *ConsoleServerPortSpeed) validateLabelEnum(path, location string, value string) error {
   711  	if err := validate.EnumCase(path, location, value, consoleServerPortSpeedTypeLabelPropEnum, true); err != nil {
   712  		return err
   713  	}
   714  	return nil
   715  }
   716  
   717  func (m *ConsoleServerPortSpeed) validateLabel(formats strfmt.Registry) error {
   718  
   719  	if err := validate.Required("speed"+"."+"label", "body", m.Label); err != nil {
   720  		return err
   721  	}
   722  
   723  	// value enum
   724  	if err := m.validateLabelEnum("speed"+"."+"label", "body", *m.Label); err != nil {
   725  		return err
   726  	}
   727  
   728  	return nil
   729  }
   730  
   731  var consoleServerPortSpeedTypeValuePropEnum []interface{}
   732  
   733  func init() {
   734  	var res []int64
   735  	if err := json.Unmarshal([]byte(`[1200,2400,4800,9600,19200,38400,57600,115200]`), &res); err != nil {
   736  		panic(err)
   737  	}
   738  	for _, v := range res {
   739  		consoleServerPortSpeedTypeValuePropEnum = append(consoleServerPortSpeedTypeValuePropEnum, v)
   740  	}
   741  }
   742  
   743  // prop value enum
   744  func (m *ConsoleServerPortSpeed) validateValueEnum(path, location string, value int64) error {
   745  	if err := validate.EnumCase(path, location, value, consoleServerPortSpeedTypeValuePropEnum, true); err != nil {
   746  		return err
   747  	}
   748  	return nil
   749  }
   750  
   751  func (m *ConsoleServerPortSpeed) validateValue(formats strfmt.Registry) error {
   752  
   753  	if err := validate.Required("speed"+"."+"value", "body", m.Value); err != nil {
   754  		return err
   755  	}
   756  
   757  	// value enum
   758  	if err := m.validateValueEnum("speed"+"."+"value", "body", *m.Value); err != nil {
   759  		return err
   760  	}
   761  
   762  	return nil
   763  }
   764  
   765  // ContextValidate validates this console server port speed based on context it is used
   766  func (m *ConsoleServerPortSpeed) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   767  	return nil
   768  }
   769  
   770  // MarshalBinary interface implementation
   771  func (m *ConsoleServerPortSpeed) MarshalBinary() ([]byte, error) {
   772  	if m == nil {
   773  		return nil, nil
   774  	}
   775  	return swag.WriteJSON(m)
   776  }
   777  
   778  // UnmarshalBinary interface implementation
   779  func (m *ConsoleServerPortSpeed) UnmarshalBinary(b []byte) error {
   780  	var res ConsoleServerPortSpeed
   781  	if err := swag.ReadJSON(b, &res); err != nil {
   782  		return err
   783  	}
   784  	*m = res
   785  	return nil
   786  }
   787  
   788  // ConsoleServerPortType Type
   789  //
   790  // swagger:model ConsoleServerPortType
   791  type ConsoleServerPortType struct {
   792  
   793  	// label
   794  	// Required: true
   795  	// Enum: [DE-9 DB-25 RJ-11 RJ-12 RJ-45 USB Type A USB Type B USB Type C USB Mini A USB Mini B USB Micro A USB Micro B Other]
   796  	Label *string `json:"label"`
   797  
   798  	// value
   799  	// Required: true
   800  	// Enum: [de-9 db-25 rj-11 rj-12 rj-45 usb-a usb-b usb-c usb-mini-a usb-mini-b usb-micro-a usb-micro-b other]
   801  	Value *string `json:"value"`
   802  }
   803  
   804  // Validate validates this console server port type
   805  func (m *ConsoleServerPortType) Validate(formats strfmt.Registry) error {
   806  	var res []error
   807  
   808  	if err := m.validateLabel(formats); err != nil {
   809  		res = append(res, err)
   810  	}
   811  
   812  	if err := m.validateValue(formats); err != nil {
   813  		res = append(res, err)
   814  	}
   815  
   816  	if len(res) > 0 {
   817  		return errors.CompositeValidationError(res...)
   818  	}
   819  	return nil
   820  }
   821  
   822  var consoleServerPortTypeTypeLabelPropEnum []interface{}
   823  
   824  func init() {
   825  	var res []string
   826  	if err := json.Unmarshal([]byte(`["DE-9","DB-25","RJ-11","RJ-12","RJ-45","USB Type A","USB Type B","USB Type C","USB Mini A","USB Mini B","USB Micro A","USB Micro B","Other"]`), &res); err != nil {
   827  		panic(err)
   828  	}
   829  	for _, v := range res {
   830  		consoleServerPortTypeTypeLabelPropEnum = append(consoleServerPortTypeTypeLabelPropEnum, v)
   831  	}
   832  }
   833  
   834  const (
   835  
   836  	// ConsoleServerPortTypeLabelDEDash9 captures enum value "DE-9"
   837  	ConsoleServerPortTypeLabelDEDash9 string = "DE-9"
   838  
   839  	// ConsoleServerPortTypeLabelDBDash25 captures enum value "DB-25"
   840  	ConsoleServerPortTypeLabelDBDash25 string = "DB-25"
   841  
   842  	// ConsoleServerPortTypeLabelRJDash11 captures enum value "RJ-11"
   843  	ConsoleServerPortTypeLabelRJDash11 string = "RJ-11"
   844  
   845  	// ConsoleServerPortTypeLabelRJDash12 captures enum value "RJ-12"
   846  	ConsoleServerPortTypeLabelRJDash12 string = "RJ-12"
   847  
   848  	// ConsoleServerPortTypeLabelRJDash45 captures enum value "RJ-45"
   849  	ConsoleServerPortTypeLabelRJDash45 string = "RJ-45"
   850  
   851  	// ConsoleServerPortTypeLabelUSBTypeA captures enum value "USB Type A"
   852  	ConsoleServerPortTypeLabelUSBTypeA string = "USB Type A"
   853  
   854  	// ConsoleServerPortTypeLabelUSBTypeB captures enum value "USB Type B"
   855  	ConsoleServerPortTypeLabelUSBTypeB string = "USB Type B"
   856  
   857  	// ConsoleServerPortTypeLabelUSBTypeC captures enum value "USB Type C"
   858  	ConsoleServerPortTypeLabelUSBTypeC string = "USB Type C"
   859  
   860  	// ConsoleServerPortTypeLabelUSBMiniA captures enum value "USB Mini A"
   861  	ConsoleServerPortTypeLabelUSBMiniA string = "USB Mini A"
   862  
   863  	// ConsoleServerPortTypeLabelUSBMiniB captures enum value "USB Mini B"
   864  	ConsoleServerPortTypeLabelUSBMiniB string = "USB Mini B"
   865  
   866  	// ConsoleServerPortTypeLabelUSBMicroA captures enum value "USB Micro A"
   867  	ConsoleServerPortTypeLabelUSBMicroA string = "USB Micro A"
   868  
   869  	// ConsoleServerPortTypeLabelUSBMicroB captures enum value "USB Micro B"
   870  	ConsoleServerPortTypeLabelUSBMicroB string = "USB Micro B"
   871  
   872  	// ConsoleServerPortTypeLabelOther captures enum value "Other"
   873  	ConsoleServerPortTypeLabelOther string = "Other"
   874  )
   875  
   876  // prop value enum
   877  func (m *ConsoleServerPortType) validateLabelEnum(path, location string, value string) error {
   878  	if err := validate.EnumCase(path, location, value, consoleServerPortTypeTypeLabelPropEnum, true); err != nil {
   879  		return err
   880  	}
   881  	return nil
   882  }
   883  
   884  func (m *ConsoleServerPortType) validateLabel(formats strfmt.Registry) error {
   885  
   886  	if err := validate.Required("type"+"."+"label", "body", m.Label); err != nil {
   887  		return err
   888  	}
   889  
   890  	// value enum
   891  	if err := m.validateLabelEnum("type"+"."+"label", "body", *m.Label); err != nil {
   892  		return err
   893  	}
   894  
   895  	return nil
   896  }
   897  
   898  var consoleServerPortTypeTypeValuePropEnum []interface{}
   899  
   900  func init() {
   901  	var res []string
   902  	if err := json.Unmarshal([]byte(`["de-9","db-25","rj-11","rj-12","rj-45","usb-a","usb-b","usb-c","usb-mini-a","usb-mini-b","usb-micro-a","usb-micro-b","other"]`), &res); err != nil {
   903  		panic(err)
   904  	}
   905  	for _, v := range res {
   906  		consoleServerPortTypeTypeValuePropEnum = append(consoleServerPortTypeTypeValuePropEnum, v)
   907  	}
   908  }
   909  
   910  const (
   911  
   912  	// ConsoleServerPortTypeValueDeDash9 captures enum value "de-9"
   913  	ConsoleServerPortTypeValueDeDash9 string = "de-9"
   914  
   915  	// ConsoleServerPortTypeValueDbDash25 captures enum value "db-25"
   916  	ConsoleServerPortTypeValueDbDash25 string = "db-25"
   917  
   918  	// ConsoleServerPortTypeValueRjDash11 captures enum value "rj-11"
   919  	ConsoleServerPortTypeValueRjDash11 string = "rj-11"
   920  
   921  	// ConsoleServerPortTypeValueRjDash12 captures enum value "rj-12"
   922  	ConsoleServerPortTypeValueRjDash12 string = "rj-12"
   923  
   924  	// ConsoleServerPortTypeValueRjDash45 captures enum value "rj-45"
   925  	ConsoleServerPortTypeValueRjDash45 string = "rj-45"
   926  
   927  	// ConsoleServerPortTypeValueUsbDasha captures enum value "usb-a"
   928  	ConsoleServerPortTypeValueUsbDasha string = "usb-a"
   929  
   930  	// ConsoleServerPortTypeValueUsbDashb captures enum value "usb-b"
   931  	ConsoleServerPortTypeValueUsbDashb string = "usb-b"
   932  
   933  	// ConsoleServerPortTypeValueUsbDashc captures enum value "usb-c"
   934  	ConsoleServerPortTypeValueUsbDashc string = "usb-c"
   935  
   936  	// ConsoleServerPortTypeValueUsbDashMiniDasha captures enum value "usb-mini-a"
   937  	ConsoleServerPortTypeValueUsbDashMiniDasha string = "usb-mini-a"
   938  
   939  	// ConsoleServerPortTypeValueUsbDashMiniDashb captures enum value "usb-mini-b"
   940  	ConsoleServerPortTypeValueUsbDashMiniDashb string = "usb-mini-b"
   941  
   942  	// ConsoleServerPortTypeValueUsbDashMicroDasha captures enum value "usb-micro-a"
   943  	ConsoleServerPortTypeValueUsbDashMicroDasha string = "usb-micro-a"
   944  
   945  	// ConsoleServerPortTypeValueUsbDashMicroDashb captures enum value "usb-micro-b"
   946  	ConsoleServerPortTypeValueUsbDashMicroDashb string = "usb-micro-b"
   947  
   948  	// ConsoleServerPortTypeValueOther captures enum value "other"
   949  	ConsoleServerPortTypeValueOther string = "other"
   950  )
   951  
   952  // prop value enum
   953  func (m *ConsoleServerPortType) validateValueEnum(path, location string, value string) error {
   954  	if err := validate.EnumCase(path, location, value, consoleServerPortTypeTypeValuePropEnum, true); err != nil {
   955  		return err
   956  	}
   957  	return nil
   958  }
   959  
   960  func (m *ConsoleServerPortType) validateValue(formats strfmt.Registry) error {
   961  
   962  	if err := validate.Required("type"+"."+"value", "body", m.Value); err != nil {
   963  		return err
   964  	}
   965  
   966  	// value enum
   967  	if err := m.validateValueEnum("type"+"."+"value", "body", *m.Value); err != nil {
   968  		return err
   969  	}
   970  
   971  	return nil
   972  }
   973  
   974  // ContextValidate validates this console server port type based on context it is used
   975  func (m *ConsoleServerPortType) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   976  	return nil
   977  }
   978  
   979  // MarshalBinary interface implementation
   980  func (m *ConsoleServerPortType) MarshalBinary() ([]byte, error) {
   981  	if m == nil {
   982  		return nil, nil
   983  	}
   984  	return swag.WriteJSON(m)
   985  }
   986  
   987  // UnmarshalBinary interface implementation
   988  func (m *ConsoleServerPortType) UnmarshalBinary(b []byte) error {
   989  	var res ConsoleServerPortType
   990  	if err := swag.ReadJSON(b, &res); err != nil {
   991  		return err
   992  	}
   993  	*m = res
   994  	return nil
   995  }