From 2089408573dc34e689321303147fce23bbecec0f Mon Sep 17 00:00:00 2001 From: HAProxy bot Date: Mon, 1 Mar 2021 07:52:56 +0000 Subject: [PATCH] MINOR: runtime: add ssl crt-list/cert support --- ssl_cert_entries.go | 62 ++++++++++++++++++ ssl_cert_entry.go | 136 ++++++++++++++++++++++++++++++++++++++++ ssl_crt_list.go | 60 ++++++++++++++++++ ssl_crt_list_entries.go | 62 ++++++++++++++++++ ssl_crt_list_entry.go | 69 ++++++++++++++++++++ ssl_crt_lists.go | 62 ++++++++++++++++++ 6 files changed, 451 insertions(+) create mode 100644 ssl_cert_entries.go create mode 100644 ssl_cert_entry.go create mode 100644 ssl_crt_list.go create mode 100644 ssl_crt_list_entries.go create mode 100644 ssl_crt_list_entry.go create mode 100644 ssl_crt_lists.go diff --git a/ssl_cert_entries.go b/ssl_cert_entries.go new file mode 100644 index 0000000..42cf423 --- /dev/null +++ b/ssl_cert_entries.go @@ -0,0 +1,62 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// Copyright 2019 HAProxy Technologies +// +// 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. +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SslCertEntries SSL Certificate Entries +// +// Array of entries of runtime SSL Certificate Entry +// +// swagger:model ssl_cert_entries +type SslCertEntries []*SslCertEntry + +// Validate validates this ssl cert entries +func (m SslCertEntries) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/ssl_cert_entry.go b/ssl_cert_entry.go new file mode 100644 index 0000000..5933b5e --- /dev/null +++ b/ssl_cert_entry.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// Copyright 2019 HAProxy Technologies +// +// 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. +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// SslCertEntry One SSL Certificate Entry +// +// One SSL/TLS certificate +// +// swagger:model ssl_cert_entry +type SslCertEntry struct { + + // algorithm + Algorithm string `json:"algorithm,omitempty"` + + // chain issuer + ChainIssuer string `json:"chain_issuer,omitempty"` + + // chain subject + ChainSubject string `json:"chain_subject,omitempty"` + + // issuer + Issuer string `json:"issuer,omitempty"` + + // not after + // Format: date + NotAfter strfmt.Date `json:"not_after,omitempty"` + + // not before + // Format: date + NotBefore strfmt.Date `json:"not_before,omitempty"` + + // serial + Serial string `json:"serial,omitempty"` + + // sha1 finger print + Sha1FingerPrint string `json:"sha1_finger_print,omitempty"` + + // status + Status string `json:"status,omitempty"` + + // storage name + StorageName string `json:"storage_name,omitempty"` + + // subject + Subject string `json:"subject,omitempty"` + + // subject alternative names + SubjectAlternativeNames []string `json:"subject_alternative_names"` +} + +// Validate validates this ssl cert entry +func (m *SslCertEntry) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNotAfter(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNotBefore(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SslCertEntry) validateNotAfter(formats strfmt.Registry) error { + + if swag.IsZero(m.NotAfter) { // not required + return nil + } + + if err := validate.FormatOf("not_after", "body", "date", m.NotAfter.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *SslCertEntry) validateNotBefore(formats strfmt.Registry) error { + + if swag.IsZero(m.NotBefore) { // not required + return nil + } + + if err := validate.FormatOf("not_before", "body", "date", m.NotBefore.String(), formats); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SslCertEntry) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SslCertEntry) UnmarshalBinary(b []byte) error { + var res SslCertEntry + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/ssl_crt_list.go b/ssl_crt_list.go new file mode 100644 index 0000000..b157c5e --- /dev/null +++ b/ssl_crt_list.go @@ -0,0 +1,60 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// Copyright 2019 HAProxy Technologies +// +// 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. +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SslCrtList crt-list +// +// One SSL/TLS certificate +// +// swagger:model ssl_crt_list +type SslCrtList struct { + + // file + File string `json:"file,omitempty"` +} + +// Validate validates this ssl crt list +func (m *SslCrtList) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SslCrtList) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SslCrtList) UnmarshalBinary(b []byte) error { + var res SslCrtList + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/ssl_crt_list_entries.go b/ssl_crt_list_entries.go new file mode 100644 index 0000000..5a38d2a --- /dev/null +++ b/ssl_crt_list_entries.go @@ -0,0 +1,62 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// Copyright 2019 HAProxy Technologies +// +// 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. +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SslCrtListEntries SSL Certificate Entries +// +// Array of entries of runtime SSL Certificate Entry +// +// swagger:model ssl_crt_list_entries +type SslCrtListEntries []*SslCrtListEntry + +// Validate validates this ssl crt list entries +func (m SslCrtListEntries) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/ssl_crt_list_entry.go b/ssl_crt_list_entry.go new file mode 100644 index 0000000..b24d289 --- /dev/null +++ b/ssl_crt_list_entry.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// Copyright 2019 HAProxy Technologies +// +// 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. +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SslCrtListEntry One crt-list Entry +// +// One SSL/TLS certificate +// +// swagger:model ssl_crt_list_entry +type SslCrtListEntry struct { + + // file + File string `json:"file,omitempty"` + + // line number + LineNumber string `json:"line_number,omitempty"` + + // sni filters + SniFilters []string `json:"sni_filters"` + + // ssl bind config + SslBindConfig string `json:"ssl_bind_config,omitempty"` +} + +// Validate validates this ssl crt list entry +func (m *SslCrtListEntry) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SslCrtListEntry) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SslCrtListEntry) UnmarshalBinary(b []byte) error { + var res SslCrtListEntry + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/ssl_crt_lists.go b/ssl_crt_lists.go new file mode 100644 index 0000000..d374588 --- /dev/null +++ b/ssl_crt_lists.go @@ -0,0 +1,62 @@ +// Code generated by go-swagger; DO NOT EDIT. + +// Copyright 2019 HAProxy Technologies +// +// 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. +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SslCrtLists SSL crt-list +// +// Array of entries of runtime crt-list +// +// swagger:model ssl_crt_lists +type SslCrtLists []*SslCrtList + +// Validate validates this ssl crt lists +func (m SslCrtLists) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +}