github.com/digitalocean/go-netbox@v0.0.2/netbox/models/site.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  // Site site
    35  //
    36  // swagger:model Site
    37  type Site struct {
    38  
    39  	// ASN
    40  	//
    41  	// 32-bit autonomous system number
    42  	// Maximum: 4.294967295e+09
    43  	// Minimum: 1
    44  	Asn *int64 `json:"asn,omitempty"`
    45  
    46  	// Circuit count
    47  	// Read Only: true
    48  	CircuitCount int64 `json:"circuit_count,omitempty"`
    49  
    50  	// Comments
    51  	Comments string `json:"comments,omitempty"`
    52  
    53  	// Contact E-mail
    54  	// Max Length: 254
    55  	// Format: email
    56  	ContactEmail strfmt.Email `json:"contact_email,omitempty"`
    57  
    58  	// Contact name
    59  	// Max Length: 50
    60  	ContactName string `json:"contact_name,omitempty"`
    61  
    62  	// Contact phone
    63  	// Max Length: 20
    64  	ContactPhone string `json:"contact_phone,omitempty"`
    65  
    66  	// Created
    67  	// Read Only: true
    68  	// Format: date
    69  	Created strfmt.Date `json:"created,omitempty"`
    70  
    71  	// Custom fields
    72  	CustomFields interface{} `json:"custom_fields,omitempty"`
    73  
    74  	// Description
    75  	// Max Length: 200
    76  	Description string `json:"description,omitempty"`
    77  
    78  	// Device count
    79  	// Read Only: true
    80  	DeviceCount int64 `json:"device_count,omitempty"`
    81  
    82  	// Display
    83  	// Read Only: true
    84  	Display string `json:"display,omitempty"`
    85  
    86  	// Facility
    87  	//
    88  	// Local facility ID or description
    89  	// Max Length: 50
    90  	Facility string `json:"facility,omitempty"`
    91  
    92  	// group
    93  	Group *NestedSiteGroup `json:"group,omitempty"`
    94  
    95  	// Id
    96  	// Read Only: true
    97  	ID int64 `json:"id,omitempty"`
    98  
    99  	// Last updated
   100  	// Read Only: true
   101  	// Format: date-time
   102  	LastUpdated strfmt.DateTime `json:"last_updated,omitempty"`
   103  
   104  	// Latitude
   105  	//
   106  	// GPS coordinate (latitude)
   107  	Latitude *string `json:"latitude,omitempty"`
   108  
   109  	// Longitude
   110  	//
   111  	// GPS coordinate (longitude)
   112  	Longitude *string `json:"longitude,omitempty"`
   113  
   114  	// Name
   115  	// Required: true
   116  	// Max Length: 100
   117  	// Min Length: 1
   118  	Name *string `json:"name"`
   119  
   120  	// Physical address
   121  	// Max Length: 200
   122  	PhysicalAddress string `json:"physical_address,omitempty"`
   123  
   124  	// Prefix count
   125  	// Read Only: true
   126  	PrefixCount int64 `json:"prefix_count,omitempty"`
   127  
   128  	// Rack count
   129  	// Read Only: true
   130  	RackCount int64 `json:"rack_count,omitempty"`
   131  
   132  	// region
   133  	Region *NestedRegion `json:"region,omitempty"`
   134  
   135  	// Shipping address
   136  	// Max Length: 200
   137  	ShippingAddress string `json:"shipping_address,omitempty"`
   138  
   139  	// Slug
   140  	// Required: true
   141  	// Max Length: 100
   142  	// Min Length: 1
   143  	// Pattern: ^[-a-zA-Z0-9_]+$
   144  	Slug *string `json:"slug"`
   145  
   146  	// status
   147  	Status *SiteStatus `json:"status,omitempty"`
   148  
   149  	// tags
   150  	Tags []*NestedTag `json:"tags"`
   151  
   152  	// tenant
   153  	Tenant *NestedTenant `json:"tenant,omitempty"`
   154  
   155  	// Time zone
   156  	TimeZone string `json:"time_zone,omitempty"`
   157  
   158  	// Url
   159  	// Read Only: true
   160  	// Format: uri
   161  	URL strfmt.URI `json:"url,omitempty"`
   162  
   163  	// Virtualmachine count
   164  	// Read Only: true
   165  	VirtualmachineCount int64 `json:"virtualmachine_count,omitempty"`
   166  
   167  	// Vlan count
   168  	// Read Only: true
   169  	VlanCount int64 `json:"vlan_count,omitempty"`
   170  }
   171  
   172  // Validate validates this site
   173  func (m *Site) Validate(formats strfmt.Registry) error {
   174  	var res []error
   175  
   176  	if err := m.validateAsn(formats); err != nil {
   177  		res = append(res, err)
   178  	}
   179  
   180  	if err := m.validateContactEmail(formats); err != nil {
   181  		res = append(res, err)
   182  	}
   183  
   184  	if err := m.validateContactName(formats); err != nil {
   185  		res = append(res, err)
   186  	}
   187  
   188  	if err := m.validateContactPhone(formats); err != nil {
   189  		res = append(res, err)
   190  	}
   191  
   192  	if err := m.validateCreated(formats); err != nil {
   193  		res = append(res, err)
   194  	}
   195  
   196  	if err := m.validateDescription(formats); err != nil {
   197  		res = append(res, err)
   198  	}
   199  
   200  	if err := m.validateFacility(formats); err != nil {
   201  		res = append(res, err)
   202  	}
   203  
   204  	if err := m.validateGroup(formats); err != nil {
   205  		res = append(res, err)
   206  	}
   207  
   208  	if err := m.validateLastUpdated(formats); err != nil {
   209  		res = append(res, err)
   210  	}
   211  
   212  	if err := m.validateName(formats); err != nil {
   213  		res = append(res, err)
   214  	}
   215  
   216  	if err := m.validatePhysicalAddress(formats); err != nil {
   217  		res = append(res, err)
   218  	}
   219  
   220  	if err := m.validateRegion(formats); err != nil {
   221  		res = append(res, err)
   222  	}
   223  
   224  	if err := m.validateShippingAddress(formats); err != nil {
   225  		res = append(res, err)
   226  	}
   227  
   228  	if err := m.validateSlug(formats); err != nil {
   229  		res = append(res, err)
   230  	}
   231  
   232  	if err := m.validateStatus(formats); err != nil {
   233  		res = append(res, err)
   234  	}
   235  
   236  	if err := m.validateTags(formats); err != nil {
   237  		res = append(res, err)
   238  	}
   239  
   240  	if err := m.validateTenant(formats); err != nil {
   241  		res = append(res, err)
   242  	}
   243  
   244  	if err := m.validateURL(formats); err != nil {
   245  		res = append(res, err)
   246  	}
   247  
   248  	if len(res) > 0 {
   249  		return errors.CompositeValidationError(res...)
   250  	}
   251  	return nil
   252  }
   253  
   254  func (m *Site) validateAsn(formats strfmt.Registry) error {
   255  	if swag.IsZero(m.Asn) { // not required
   256  		return nil
   257  	}
   258  
   259  	if err := validate.MinimumInt("asn", "body", *m.Asn, 1, false); err != nil {
   260  		return err
   261  	}
   262  
   263  	if err := validate.MaximumInt("asn", "body", *m.Asn, 4.294967295e+09, false); err != nil {
   264  		return err
   265  	}
   266  
   267  	return nil
   268  }
   269  
   270  func (m *Site) validateContactEmail(formats strfmt.Registry) error {
   271  	if swag.IsZero(m.ContactEmail) { // not required
   272  		return nil
   273  	}
   274  
   275  	if err := validate.MaxLength("contact_email", "body", m.ContactEmail.String(), 254); err != nil {
   276  		return err
   277  	}
   278  
   279  	if err := validate.FormatOf("contact_email", "body", "email", m.ContactEmail.String(), formats); err != nil {
   280  		return err
   281  	}
   282  
   283  	return nil
   284  }
   285  
   286  func (m *Site) validateContactName(formats strfmt.Registry) error {
   287  	if swag.IsZero(m.ContactName) { // not required
   288  		return nil
   289  	}
   290  
   291  	if err := validate.MaxLength("contact_name", "body", m.ContactName, 50); err != nil {
   292  		return err
   293  	}
   294  
   295  	return nil
   296  }
   297  
   298  func (m *Site) validateContactPhone(formats strfmt.Registry) error {
   299  	if swag.IsZero(m.ContactPhone) { // not required
   300  		return nil
   301  	}
   302  
   303  	if err := validate.MaxLength("contact_phone", "body", m.ContactPhone, 20); err != nil {
   304  		return err
   305  	}
   306  
   307  	return nil
   308  }
   309  
   310  func (m *Site) validateCreated(formats strfmt.Registry) error {
   311  	if swag.IsZero(m.Created) { // not required
   312  		return nil
   313  	}
   314  
   315  	if err := validate.FormatOf("created", "body", "date", m.Created.String(), formats); err != nil {
   316  		return err
   317  	}
   318  
   319  	return nil
   320  }
   321  
   322  func (m *Site) validateDescription(formats strfmt.Registry) error {
   323  	if swag.IsZero(m.Description) { // not required
   324  		return nil
   325  	}
   326  
   327  	if err := validate.MaxLength("description", "body", m.Description, 200); err != nil {
   328  		return err
   329  	}
   330  
   331  	return nil
   332  }
   333  
   334  func (m *Site) validateFacility(formats strfmt.Registry) error {
   335  	if swag.IsZero(m.Facility) { // not required
   336  		return nil
   337  	}
   338  
   339  	if err := validate.MaxLength("facility", "body", m.Facility, 50); err != nil {
   340  		return err
   341  	}
   342  
   343  	return nil
   344  }
   345  
   346  func (m *Site) validateGroup(formats strfmt.Registry) error {
   347  	if swag.IsZero(m.Group) { // not required
   348  		return nil
   349  	}
   350  
   351  	if m.Group != nil {
   352  		if err := m.Group.Validate(formats); err != nil {
   353  			if ve, ok := err.(*errors.Validation); ok {
   354  				return ve.ValidateName("group")
   355  			} else if ce, ok := err.(*errors.CompositeError); ok {
   356  				return ce.ValidateName("group")
   357  			}
   358  			return err
   359  		}
   360  	}
   361  
   362  	return nil
   363  }
   364  
   365  func (m *Site) validateLastUpdated(formats strfmt.Registry) error {
   366  	if swag.IsZero(m.LastUpdated) { // not required
   367  		return nil
   368  	}
   369  
   370  	if err := validate.FormatOf("last_updated", "body", "date-time", m.LastUpdated.String(), formats); err != nil {
   371  		return err
   372  	}
   373  
   374  	return nil
   375  }
   376  
   377  func (m *Site) validateName(formats strfmt.Registry) error {
   378  
   379  	if err := validate.Required("name", "body", m.Name); err != nil {
   380  		return err
   381  	}
   382  
   383  	if err := validate.MinLength("name", "body", *m.Name, 1); err != nil {
   384  		return err
   385  	}
   386  
   387  	if err := validate.MaxLength("name", "body", *m.Name, 100); err != nil {
   388  		return err
   389  	}
   390  
   391  	return nil
   392  }
   393  
   394  func (m *Site) validatePhysicalAddress(formats strfmt.Registry) error {
   395  	if swag.IsZero(m.PhysicalAddress) { // not required
   396  		return nil
   397  	}
   398  
   399  	if err := validate.MaxLength("physical_address", "body", m.PhysicalAddress, 200); err != nil {
   400  		return err
   401  	}
   402  
   403  	return nil
   404  }
   405  
   406  func (m *Site) validateRegion(formats strfmt.Registry) error {
   407  	if swag.IsZero(m.Region) { // not required
   408  		return nil
   409  	}
   410  
   411  	if m.Region != nil {
   412  		if err := m.Region.Validate(formats); err != nil {
   413  			if ve, ok := err.(*errors.Validation); ok {
   414  				return ve.ValidateName("region")
   415  			} else if ce, ok := err.(*errors.CompositeError); ok {
   416  				return ce.ValidateName("region")
   417  			}
   418  			return err
   419  		}
   420  	}
   421  
   422  	return nil
   423  }
   424  
   425  func (m *Site) validateShippingAddress(formats strfmt.Registry) error {
   426  	if swag.IsZero(m.ShippingAddress) { // not required
   427  		return nil
   428  	}
   429  
   430  	if err := validate.MaxLength("shipping_address", "body", m.ShippingAddress, 200); err != nil {
   431  		return err
   432  	}
   433  
   434  	return nil
   435  }
   436  
   437  func (m *Site) validateSlug(formats strfmt.Registry) error {
   438  
   439  	if err := validate.Required("slug", "body", m.Slug); err != nil {
   440  		return err
   441  	}
   442  
   443  	if err := validate.MinLength("slug", "body", *m.Slug, 1); err != nil {
   444  		return err
   445  	}
   446  
   447  	if err := validate.MaxLength("slug", "body", *m.Slug, 100); err != nil {
   448  		return err
   449  	}
   450  
   451  	if err := validate.Pattern("slug", "body", *m.Slug, `^[-a-zA-Z0-9_]+$`); err != nil {
   452  		return err
   453  	}
   454  
   455  	return nil
   456  }
   457  
   458  func (m *Site) validateStatus(formats strfmt.Registry) error {
   459  	if swag.IsZero(m.Status) { // not required
   460  		return nil
   461  	}
   462  
   463  	if m.Status != nil {
   464  		if err := m.Status.Validate(formats); err != nil {
   465  			if ve, ok := err.(*errors.Validation); ok {
   466  				return ve.ValidateName("status")
   467  			} else if ce, ok := err.(*errors.CompositeError); ok {
   468  				return ce.ValidateName("status")
   469  			}
   470  			return err
   471  		}
   472  	}
   473  
   474  	return nil
   475  }
   476  
   477  func (m *Site) validateTags(formats strfmt.Registry) error {
   478  	if swag.IsZero(m.Tags) { // not required
   479  		return nil
   480  	}
   481  
   482  	for i := 0; i < len(m.Tags); i++ {
   483  		if swag.IsZero(m.Tags[i]) { // not required
   484  			continue
   485  		}
   486  
   487  		if m.Tags[i] != nil {
   488  			if err := m.Tags[i].Validate(formats); err != nil {
   489  				if ve, ok := err.(*errors.Validation); ok {
   490  					return ve.ValidateName("tags" + "." + strconv.Itoa(i))
   491  				} else if ce, ok := err.(*errors.CompositeError); ok {
   492  					return ce.ValidateName("tags" + "." + strconv.Itoa(i))
   493  				}
   494  				return err
   495  			}
   496  		}
   497  
   498  	}
   499  
   500  	return nil
   501  }
   502  
   503  func (m *Site) validateTenant(formats strfmt.Registry) error {
   504  	if swag.IsZero(m.Tenant) { // not required
   505  		return nil
   506  	}
   507  
   508  	if m.Tenant != nil {
   509  		if err := m.Tenant.Validate(formats); err != nil {
   510  			if ve, ok := err.(*errors.Validation); ok {
   511  				return ve.ValidateName("tenant")
   512  			} else if ce, ok := err.(*errors.CompositeError); ok {
   513  				return ce.ValidateName("tenant")
   514  			}
   515  			return err
   516  		}
   517  	}
   518  
   519  	return nil
   520  }
   521  
   522  func (m *Site) validateURL(formats strfmt.Registry) error {
   523  	if swag.IsZero(m.URL) { // not required
   524  		return nil
   525  	}
   526  
   527  	if err := validate.FormatOf("url", "body", "uri", m.URL.String(), formats); err != nil {
   528  		return err
   529  	}
   530  
   531  	return nil
   532  }
   533  
   534  // ContextValidate validate this site based on the context it is used
   535  func (m *Site) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   536  	var res []error
   537  
   538  	if err := m.contextValidateCircuitCount(ctx, formats); err != nil {
   539  		res = append(res, err)
   540  	}
   541  
   542  	if err := m.contextValidateCreated(ctx, formats); err != nil {
   543  		res = append(res, err)
   544  	}
   545  
   546  	if err := m.contextValidateDeviceCount(ctx, formats); err != nil {
   547  		res = append(res, err)
   548  	}
   549  
   550  	if err := m.contextValidateDisplay(ctx, formats); err != nil {
   551  		res = append(res, err)
   552  	}
   553  
   554  	if err := m.contextValidateGroup(ctx, formats); err != nil {
   555  		res = append(res, err)
   556  	}
   557  
   558  	if err := m.contextValidateID(ctx, formats); err != nil {
   559  		res = append(res, err)
   560  	}
   561  
   562  	if err := m.contextValidateLastUpdated(ctx, formats); err != nil {
   563  		res = append(res, err)
   564  	}
   565  
   566  	if err := m.contextValidatePrefixCount(ctx, formats); err != nil {
   567  		res = append(res, err)
   568  	}
   569  
   570  	if err := m.contextValidateRackCount(ctx, formats); err != nil {
   571  		res = append(res, err)
   572  	}
   573  
   574  	if err := m.contextValidateRegion(ctx, formats); err != nil {
   575  		res = append(res, err)
   576  	}
   577  
   578  	if err := m.contextValidateStatus(ctx, formats); err != nil {
   579  		res = append(res, err)
   580  	}
   581  
   582  	if err := m.contextValidateTags(ctx, formats); err != nil {
   583  		res = append(res, err)
   584  	}
   585  
   586  	if err := m.contextValidateTenant(ctx, formats); err != nil {
   587  		res = append(res, err)
   588  	}
   589  
   590  	if err := m.contextValidateURL(ctx, formats); err != nil {
   591  		res = append(res, err)
   592  	}
   593  
   594  	if err := m.contextValidateVirtualmachineCount(ctx, formats); err != nil {
   595  		res = append(res, err)
   596  	}
   597  
   598  	if err := m.contextValidateVlanCount(ctx, formats); err != nil {
   599  		res = append(res, err)
   600  	}
   601  
   602  	if len(res) > 0 {
   603  		return errors.CompositeValidationError(res...)
   604  	}
   605  	return nil
   606  }
   607  
   608  func (m *Site) contextValidateCircuitCount(ctx context.Context, formats strfmt.Registry) error {
   609  
   610  	if err := validate.ReadOnly(ctx, "circuit_count", "body", int64(m.CircuitCount)); err != nil {
   611  		return err
   612  	}
   613  
   614  	return nil
   615  }
   616  
   617  func (m *Site) contextValidateCreated(ctx context.Context, formats strfmt.Registry) error {
   618  
   619  	if err := validate.ReadOnly(ctx, "created", "body", strfmt.Date(m.Created)); err != nil {
   620  		return err
   621  	}
   622  
   623  	return nil
   624  }
   625  
   626  func (m *Site) contextValidateDeviceCount(ctx context.Context, formats strfmt.Registry) error {
   627  
   628  	if err := validate.ReadOnly(ctx, "device_count", "body", int64(m.DeviceCount)); err != nil {
   629  		return err
   630  	}
   631  
   632  	return nil
   633  }
   634  
   635  func (m *Site) contextValidateDisplay(ctx context.Context, formats strfmt.Registry) error {
   636  
   637  	if err := validate.ReadOnly(ctx, "display", "body", string(m.Display)); err != nil {
   638  		return err
   639  	}
   640  
   641  	return nil
   642  }
   643  
   644  func (m *Site) contextValidateGroup(ctx context.Context, formats strfmt.Registry) error {
   645  
   646  	if m.Group != nil {
   647  		if err := m.Group.ContextValidate(ctx, formats); err != nil {
   648  			if ve, ok := err.(*errors.Validation); ok {
   649  				return ve.ValidateName("group")
   650  			} else if ce, ok := err.(*errors.CompositeError); ok {
   651  				return ce.ValidateName("group")
   652  			}
   653  			return err
   654  		}
   655  	}
   656  
   657  	return nil
   658  }
   659  
   660  func (m *Site) contextValidateID(ctx context.Context, formats strfmt.Registry) error {
   661  
   662  	if err := validate.ReadOnly(ctx, "id", "body", int64(m.ID)); err != nil {
   663  		return err
   664  	}
   665  
   666  	return nil
   667  }
   668  
   669  func (m *Site) contextValidateLastUpdated(ctx context.Context, formats strfmt.Registry) error {
   670  
   671  	if err := validate.ReadOnly(ctx, "last_updated", "body", strfmt.DateTime(m.LastUpdated)); err != nil {
   672  		return err
   673  	}
   674  
   675  	return nil
   676  }
   677  
   678  func (m *Site) contextValidatePrefixCount(ctx context.Context, formats strfmt.Registry) error {
   679  
   680  	if err := validate.ReadOnly(ctx, "prefix_count", "body", int64(m.PrefixCount)); err != nil {
   681  		return err
   682  	}
   683  
   684  	return nil
   685  }
   686  
   687  func (m *Site) contextValidateRackCount(ctx context.Context, formats strfmt.Registry) error {
   688  
   689  	if err := validate.ReadOnly(ctx, "rack_count", "body", int64(m.RackCount)); err != nil {
   690  		return err
   691  	}
   692  
   693  	return nil
   694  }
   695  
   696  func (m *Site) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error {
   697  
   698  	if m.Region != nil {
   699  		if err := m.Region.ContextValidate(ctx, formats); err != nil {
   700  			if ve, ok := err.(*errors.Validation); ok {
   701  				return ve.ValidateName("region")
   702  			} else if ce, ok := err.(*errors.CompositeError); ok {
   703  				return ce.ValidateName("region")
   704  			}
   705  			return err
   706  		}
   707  	}
   708  
   709  	return nil
   710  }
   711  
   712  func (m *Site) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error {
   713  
   714  	if m.Status != nil {
   715  		if err := m.Status.ContextValidate(ctx, formats); err != nil {
   716  			if ve, ok := err.(*errors.Validation); ok {
   717  				return ve.ValidateName("status")
   718  			} else if ce, ok := err.(*errors.CompositeError); ok {
   719  				return ce.ValidateName("status")
   720  			}
   721  			return err
   722  		}
   723  	}
   724  
   725  	return nil
   726  }
   727  
   728  func (m *Site) contextValidateTags(ctx context.Context, formats strfmt.Registry) error {
   729  
   730  	for i := 0; i < len(m.Tags); i++ {
   731  
   732  		if m.Tags[i] != nil {
   733  			if err := m.Tags[i].ContextValidate(ctx, formats); err != nil {
   734  				if ve, ok := err.(*errors.Validation); ok {
   735  					return ve.ValidateName("tags" + "." + strconv.Itoa(i))
   736  				} else if ce, ok := err.(*errors.CompositeError); ok {
   737  					return ce.ValidateName("tags" + "." + strconv.Itoa(i))
   738  				}
   739  				return err
   740  			}
   741  		}
   742  
   743  	}
   744  
   745  	return nil
   746  }
   747  
   748  func (m *Site) contextValidateTenant(ctx context.Context, formats strfmt.Registry) error {
   749  
   750  	if m.Tenant != nil {
   751  		if err := m.Tenant.ContextValidate(ctx, formats); err != nil {
   752  			if ve, ok := err.(*errors.Validation); ok {
   753  				return ve.ValidateName("tenant")
   754  			} else if ce, ok := err.(*errors.CompositeError); ok {
   755  				return ce.ValidateName("tenant")
   756  			}
   757  			return err
   758  		}
   759  	}
   760  
   761  	return nil
   762  }
   763  
   764  func (m *Site) contextValidateURL(ctx context.Context, formats strfmt.Registry) error {
   765  
   766  	if err := validate.ReadOnly(ctx, "url", "body", strfmt.URI(m.URL)); err != nil {
   767  		return err
   768  	}
   769  
   770  	return nil
   771  }
   772  
   773  func (m *Site) contextValidateVirtualmachineCount(ctx context.Context, formats strfmt.Registry) error {
   774  
   775  	if err := validate.ReadOnly(ctx, "virtualmachine_count", "body", int64(m.VirtualmachineCount)); err != nil {
   776  		return err
   777  	}
   778  
   779  	return nil
   780  }
   781  
   782  func (m *Site) contextValidateVlanCount(ctx context.Context, formats strfmt.Registry) error {
   783  
   784  	if err := validate.ReadOnly(ctx, "vlan_count", "body", int64(m.VlanCount)); err != nil {
   785  		return err
   786  	}
   787  
   788  	return nil
   789  }
   790  
   791  // MarshalBinary interface implementation
   792  func (m *Site) MarshalBinary() ([]byte, error) {
   793  	if m == nil {
   794  		return nil, nil
   795  	}
   796  	return swag.WriteJSON(m)
   797  }
   798  
   799  // UnmarshalBinary interface implementation
   800  func (m *Site) UnmarshalBinary(b []byte) error {
   801  	var res Site
   802  	if err := swag.ReadJSON(b, &res); err != nil {
   803  		return err
   804  	}
   805  	*m = res
   806  	return nil
   807  }
   808  
   809  // SiteStatus Status
   810  //
   811  // swagger:model SiteStatus
   812  type SiteStatus struct {
   813  
   814  	// label
   815  	// Required: true
   816  	// Enum: [Planned Staging Active Decommissioning Retired]
   817  	Label *string `json:"label"`
   818  
   819  	// value
   820  	// Required: true
   821  	// Enum: [planned staging active decommissioning retired]
   822  	Value *string `json:"value"`
   823  }
   824  
   825  // Validate validates this site status
   826  func (m *SiteStatus) Validate(formats strfmt.Registry) error {
   827  	var res []error
   828  
   829  	if err := m.validateLabel(formats); err != nil {
   830  		res = append(res, err)
   831  	}
   832  
   833  	if err := m.validateValue(formats); err != nil {
   834  		res = append(res, err)
   835  	}
   836  
   837  	if len(res) > 0 {
   838  		return errors.CompositeValidationError(res...)
   839  	}
   840  	return nil
   841  }
   842  
   843  var siteStatusTypeLabelPropEnum []interface{}
   844  
   845  func init() {
   846  	var res []string
   847  	if err := json.Unmarshal([]byte(`["Planned","Staging","Active","Decommissioning","Retired"]`), &res); err != nil {
   848  		panic(err)
   849  	}
   850  	for _, v := range res {
   851  		siteStatusTypeLabelPropEnum = append(siteStatusTypeLabelPropEnum, v)
   852  	}
   853  }
   854  
   855  const (
   856  
   857  	// SiteStatusLabelPlanned captures enum value "Planned"
   858  	SiteStatusLabelPlanned string = "Planned"
   859  
   860  	// SiteStatusLabelStaging captures enum value "Staging"
   861  	SiteStatusLabelStaging string = "Staging"
   862  
   863  	// SiteStatusLabelActive captures enum value "Active"
   864  	SiteStatusLabelActive string = "Active"
   865  
   866  	// SiteStatusLabelDecommissioning captures enum value "Decommissioning"
   867  	SiteStatusLabelDecommissioning string = "Decommissioning"
   868  
   869  	// SiteStatusLabelRetired captures enum value "Retired"
   870  	SiteStatusLabelRetired string = "Retired"
   871  )
   872  
   873  // prop value enum
   874  func (m *SiteStatus) validateLabelEnum(path, location string, value string) error {
   875  	if err := validate.EnumCase(path, location, value, siteStatusTypeLabelPropEnum, true); err != nil {
   876  		return err
   877  	}
   878  	return nil
   879  }
   880  
   881  func (m *SiteStatus) validateLabel(formats strfmt.Registry) error {
   882  
   883  	if err := validate.Required("status"+"."+"label", "body", m.Label); err != nil {
   884  		return err
   885  	}
   886  
   887  	// value enum
   888  	if err := m.validateLabelEnum("status"+"."+"label", "body", *m.Label); err != nil {
   889  		return err
   890  	}
   891  
   892  	return nil
   893  }
   894  
   895  var siteStatusTypeValuePropEnum []interface{}
   896  
   897  func init() {
   898  	var res []string
   899  	if err := json.Unmarshal([]byte(`["planned","staging","active","decommissioning","retired"]`), &res); err != nil {
   900  		panic(err)
   901  	}
   902  	for _, v := range res {
   903  		siteStatusTypeValuePropEnum = append(siteStatusTypeValuePropEnum, v)
   904  	}
   905  }
   906  
   907  const (
   908  
   909  	// SiteStatusValuePlanned captures enum value "planned"
   910  	SiteStatusValuePlanned string = "planned"
   911  
   912  	// SiteStatusValueStaging captures enum value "staging"
   913  	SiteStatusValueStaging string = "staging"
   914  
   915  	// SiteStatusValueActive captures enum value "active"
   916  	SiteStatusValueActive string = "active"
   917  
   918  	// SiteStatusValueDecommissioning captures enum value "decommissioning"
   919  	SiteStatusValueDecommissioning string = "decommissioning"
   920  
   921  	// SiteStatusValueRetired captures enum value "retired"
   922  	SiteStatusValueRetired string = "retired"
   923  )
   924  
   925  // prop value enum
   926  func (m *SiteStatus) validateValueEnum(path, location string, value string) error {
   927  	if err := validate.EnumCase(path, location, value, siteStatusTypeValuePropEnum, true); err != nil {
   928  		return err
   929  	}
   930  	return nil
   931  }
   932  
   933  func (m *SiteStatus) validateValue(formats strfmt.Registry) error {
   934  
   935  	if err := validate.Required("status"+"."+"value", "body", m.Value); err != nil {
   936  		return err
   937  	}
   938  
   939  	// value enum
   940  	if err := m.validateValueEnum("status"+"."+"value", "body", *m.Value); err != nil {
   941  		return err
   942  	}
   943  
   944  	return nil
   945  }
   946  
   947  // ContextValidate validates this site status based on context it is used
   948  func (m *SiteStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   949  	return nil
   950  }
   951  
   952  // MarshalBinary interface implementation
   953  func (m *SiteStatus) MarshalBinary() ([]byte, error) {
   954  	if m == nil {
   955  		return nil, nil
   956  	}
   957  	return swag.WriteJSON(m)
   958  }
   959  
   960  // UnmarshalBinary interface implementation
   961  func (m *SiteStatus) UnmarshalBinary(b []byte) error {
   962  	var res SiteStatus
   963  	if err := swag.ReadJSON(b, &res); err != nil {
   964  		return err
   965  	}
   966  	*m = res
   967  	return nil
   968  }