diff --git a/api/v1/contact_types.go b/api/v1/contact_types.go index 2b0811c..8a9ba18 100644 --- a/api/v1/contact_types.go +++ b/api/v1/contact_types.go @@ -17,7 +17,6 @@ limitations under the License. package v1 import ( - "github.com/clevyr/uptime-robot-operator/internal/uptimerobot" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -31,7 +30,7 @@ type ContactSpec struct { Account corev1.LocalObjectReference `json:"account,omitempty"` // Contact configures the Uptime Robot monitor. - Contact uptimerobot.Contact `json:"contact"` + Contact ContactValues `json:"contact"` } // ContactStatus defines the observed state of Contact @@ -66,6 +65,11 @@ type ContactList struct { Items []Contact `json:"items"` } +type ContactValues struct { + // FriendlyName sets the name that is shown in Uptime Robot. + FriendlyName string `json:"friendlyName"` +} + func init() { SchemeBuilder.Register(&Contact{}, &ContactList{}) } diff --git a/api/v1/monitor_types.go b/api/v1/monitor_types.go index 741b45a..f19558c 100644 --- a/api/v1/monitor_types.go +++ b/api/v1/monitor_types.go @@ -17,19 +17,15 @@ limitations under the License. package v1 import ( - "github.com/clevyr/uptime-robot-operator/internal/uptimerobot" + "fmt" + "strings" + "time" + "github.com/clevyr/uptime-robot-operator/internal/uptimerobot/urtypes" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// MonitorContactRef attaches alert contacts. If blank, the default will be used. -type MonitorContactRef struct { - corev1.LocalObjectReference `json:",inline"` - - uptimerobot.MonitorContactCommon `json:",inline"` -} - // MonitorSpec defines the desired state of Monitor type MonitorSpec struct { // Interval defines the reconcile interval. @@ -44,7 +40,7 @@ type MonitorSpec struct { Account corev1.LocalObjectReference `json:"account,omitempty"` // Monitor configures the Uptime Robot monitor. - Monitor uptimerobot.Monitor `json:"monitor"` + Monitor MonitorValues `json:"monitor"` // +kubebuilder:default:={{}} Contacts []MonitorContactRef `json:"contacts,omitempty"` @@ -78,6 +74,137 @@ type Monitor struct { Status MonitorStatus `json:"status,omitempty"` } +//+kubebuilder:object:generate=true +//+kubebuilder:validation:XValidation:rule="self.type != 'Keyword' || has(self.keyword)", message="Keyword config is required if type is Keyword" +//+kubebuilder:validation:XValidation:rule="self.type != 'Port' || has(self.port)", message="Port config is required if type is Port" + +type MonitorValues struct { + // FriendlyName sets the name that is shown in Uptime Robot. + FriendlyName string `json:"friendlyName"` + + // URL is the URL or IP to monitor, including the scheme. + URL string `json:"url"` + + // Type chooses the monitor type. + //+kubebuilder:default:=HTTPS + Type urtypes.MonitorType `json:"type,omitempty"` + + // Interval is the monitoring interval. + //+kubebuilder:default:="60s" + Interval *metav1.Duration `json:"interval,omitempty"` + + // Status toggles pause status for the monitor. 0 is paused, 1 is running. + //+kubebuilder:default:=1 + Status uint8 `json:"status,omitempty"` + + // Timeout is the monitor timeout. + //+kubebuilder:default:="30s" + Timeout *metav1.Duration `json:"timeout,omitempty"` + + // HTTPMethod defines the HTTP verb to use. + //+kubebuilder:default:="HEAD" + HTTPMethod urtypes.HTTPMethod `json:"httpMethod,omitempty"` + + // POST configures POST, PUT, PATCH, DELETE, and OPTIONS requests. + POST *MonitorPOST `json:"post,omitempty"` + + // Keyword provides configuration for the Keyword monitor type. + Keyword *MonitorKeyword `json:"keyword,omitempty"` + + // Port provides configuration for the Port monitor type. + Port *MonitorPort `json:"port,omitempty"` + + // Auth enables monitor auth. + Auth *MonitorAuth `json:"auth,omitempty"` +} + +//+kubebuilder:object:generate=true + +type MonitorKeyword struct { + Type urtypes.KeywordType `json:"type"` + + //+kubebuilder:default:=false + CaseSensitive *bool `json:"caseSensitive,omitempty"` + + Value string `json:"value"` +} + +//+kubebuilder:validation:XValidation:rule="self.type != 'Custom' || has(self.number)", message="Number is required if type is Custom" +//+kubebuilder:validation:XValidation:rule="self.type == 'Custom' || !has(self.number)", message="Type must be Custom if Number is set" + +type MonitorPort struct { + Type urtypes.PortType `json:"type"` + + Number uint16 `json:"number,omitempty"` +} + +type MonitorAuth struct { + //+kubebuilder:default:="Basic" + Type urtypes.MonitorAuthType `json:"type"` + + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + + SecretName string `json:"secretName,omitempty"` + UsernameKey string `json:"usernameKey,omitempty"` + PasswordKey string `json:"passwordKey,omitempty"` +} + +type MonitorPOST struct { + // Type defines the format of data to be sent with POST, PUT, PATCH, DELETE, and OPTIONS requests. + //+kubebuilder:default:="KeyValue" + Type urtypes.POSTType `json:"postType,omitempty"` + + // ContentType sets the Content-Type header for POST, PUT, PATCH, DELETE, and OPTIONS requests. + //+kubebuilder:default:="text/html" + ContentType urtypes.POSTContentType `json:"contentType,omitempty"` + + // Value is the JSON form of data to be sent with POST, PUT, PATCH, DELETE, and OPTIONS requests. + Value string `json:"value,omitempty"` +} + +// MonitorContactRef attaches alert contacts. If blank, the default will be used. +type MonitorContactRef struct { + corev1.LocalObjectReference `json:",inline"` + + MonitorContactCommon `json:",inline"` +} + +type MonitorContactCommon struct { + // Threshold defines the number of minutes to wait to notify. + // +kubebuilder:default:="1m" + Threshold metav1.Duration `json:"threshold,omitempty"` + + // Recurrence defines the number of minutes between a repeat notification. + // A value of 0, disables repeat notifications. + Recurrence metav1.Duration `json:"recurrence,omitempty"` +} + +type MonitorContact struct { + ID string `json:"id"` + + MonitorContactCommon `json:",inline"` +} + +func (m MonitorContact) String() string { + return fmt.Sprintf( + "%s_%d_%d", + m.ID, + int(m.MonitorContactCommon.Threshold.Round(time.Minute).Minutes()), + int(m.MonitorContactCommon.Recurrence.Round(time.Minute).Minutes()), + ) +} + +type MonitorContacts []MonitorContact + +func (m MonitorContacts) String() string { + results := make([]string, 0, len(m)) + for _, c := range m { + results = append(results, c.String()) + } + return strings.Join(results, "-") +} + //+kubebuilder:object:root=true // MonitorList contains a list of Monitor diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 065da2e..b621518 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -207,6 +207,21 @@ func (in *ContactStatus) DeepCopy() *ContactStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ContactValues) DeepCopyInto(out *ContactValues) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContactValues. +func (in *ContactValues) DeepCopy() *ContactValues { + if in == nil { + return nil + } + out := new(ContactValues) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Monitor) DeepCopyInto(out *Monitor) { *out = *in @@ -234,6 +249,54 @@ func (in *Monitor) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitorAuth) DeepCopyInto(out *MonitorAuth) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorAuth. +func (in *MonitorAuth) DeepCopy() *MonitorAuth { + if in == nil { + return nil + } + out := new(MonitorAuth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitorContact) DeepCopyInto(out *MonitorContact) { + *out = *in + out.MonitorContactCommon = in.MonitorContactCommon +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorContact. +func (in *MonitorContact) DeepCopy() *MonitorContact { + if in == nil { + return nil + } + out := new(MonitorContact) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitorContactCommon) DeepCopyInto(out *MonitorContactCommon) { + *out = *in + out.Threshold = in.Threshold + out.Recurrence = in.Recurrence +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorContactCommon. +func (in *MonitorContactCommon) DeepCopy() *MonitorContactCommon { + if in == nil { + return nil + } + out := new(MonitorContactCommon) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MonitorContactRef) DeepCopyInto(out *MonitorContactRef) { *out = *in @@ -251,6 +314,45 @@ func (in *MonitorContactRef) DeepCopy() *MonitorContactRef { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in MonitorContacts) DeepCopyInto(out *MonitorContacts) { + { + in := &in + *out = make(MonitorContacts, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorContacts. +func (in MonitorContacts) DeepCopy() MonitorContacts { + if in == nil { + return nil + } + out := new(MonitorContacts) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitorKeyword) DeepCopyInto(out *MonitorKeyword) { + *out = *in + if in.CaseSensitive != nil { + in, out := &in.CaseSensitive, &out.CaseSensitive + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorKeyword. +func (in *MonitorKeyword) DeepCopy() *MonitorKeyword { + if in == nil { + return nil + } + out := new(MonitorKeyword) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MonitorList) DeepCopyInto(out *MonitorList) { *out = *in @@ -283,6 +385,36 @@ func (in *MonitorList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitorPOST) DeepCopyInto(out *MonitorPOST) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorPOST. +func (in *MonitorPOST) DeepCopy() *MonitorPOST { + if in == nil { + return nil + } + out := new(MonitorPOST) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitorPort) DeepCopyInto(out *MonitorPort) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorPort. +func (in *MonitorPort) DeepCopy() *MonitorPort { + if in == nil { + return nil + } + out := new(MonitorPort) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MonitorSpec) DeepCopyInto(out *MonitorSpec) { *out = *in @@ -329,3 +461,48 @@ func (in *MonitorStatus) DeepCopy() *MonitorStatus { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MonitorValues) DeepCopyInto(out *MonitorValues) { + *out = *in + if in.Interval != nil { + in, out := &in.Interval, &out.Interval + *out = new(metav1.Duration) + **out = **in + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(metav1.Duration) + **out = **in + } + if in.POST != nil { + in, out := &in.POST, &out.POST + *out = new(MonitorPOST) + **out = **in + } + if in.Keyword != nil { + in, out := &in.Keyword, &out.Keyword + *out = new(MonitorKeyword) + (*in).DeepCopyInto(*out) + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(MonitorPort) + **out = **in + } + if in.Auth != nil { + in, out := &in.Auth, &out.Auth + *out = new(MonitorAuth) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorValues. +func (in *MonitorValues) DeepCopy() *MonitorValues { + if in == nil { + return nil + } + out := new(MonitorValues) + in.DeepCopyInto(out) + return out +} diff --git a/internal/controller/contact_controller_test.go b/internal/controller/contact_controller_test.go index 1e57747..8dc2741 100644 --- a/internal/controller/contact_controller_test.go +++ b/internal/controller/contact_controller_test.go @@ -19,7 +19,6 @@ package controller import ( "context" - "github.com/clevyr/uptime-robot-operator/internal/uptimerobot" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" @@ -80,7 +79,7 @@ func CreateContact(ctx context.Context, accountName string) *uptimerobotv1.Conta Account: corev1.LocalObjectReference{ Name: accountName, }, - Contact: uptimerobot.Contact{ + Contact: uptimerobotv1.ContactValues{ FriendlyName: "John Doe", }, }, diff --git a/internal/controller/monitor_controller.go b/internal/controller/monitor_controller.go index ed7e62d..93a2ce6 100644 --- a/internal/controller/monitor_controller.go +++ b/internal/controller/monitor_controller.go @@ -102,7 +102,7 @@ func (r *MonitorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct monitor.Status.Ready = false } - contacts := make([]uptimerobot.MonitorContact, 0, len(monitor.Spec.Contacts)) + contacts := make([]uptimerobotv1.MonitorContact, 0, len(monitor.Spec.Contacts)) for _, ref := range monitor.Spec.Contacts { contact := &uptimerobotv1.Contact{} @@ -114,7 +114,7 @@ func (r *MonitorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct return ctrl.Result{}, ErrContactMissingID } - contacts = append(contacts, uptimerobot.MonitorContact{ + contacts = append(contacts, uptimerobotv1.MonitorContact{ ID: contact.Status.ID, MonitorContactCommon: ref.MonitorContactCommon, }) diff --git a/internal/uptimerobot/client.go b/internal/uptimerobot/client.go index 7e676f4..5d689a4 100644 --- a/internal/uptimerobot/client.go +++ b/internal/uptimerobot/client.go @@ -12,6 +12,7 @@ import ( "strconv" "strings" + uptimerobotv1 "github.com/clevyr/uptime-robot-operator/api/v1" "github.com/clevyr/uptime-robot-operator/internal/uptimerobot/urtypes" ) @@ -68,7 +69,7 @@ func (c Client) Do(ctx context.Context, endpoint string, form url.Values) (*http return res, nil } -func (c Client) MonitorValues(monitor Monitor, form url.Values, contacts MonitorContacts) url.Values { +func (c Client) MonitorValues(monitor uptimerobotv1.MonitorValues, form url.Values, contacts uptimerobotv1.MonitorContacts) url.Values { form.Set("friendly_name", monitor.FriendlyName) form.Set("url", monitor.URL) form.Set("type", strconv.Itoa(int(monitor.Type))) @@ -129,7 +130,7 @@ var ( ErrResponse = errors.New("received fail from Uptime Robot API") ) -func (c Client) CreateMonitor(ctx context.Context, monitor Monitor, contacts MonitorContacts) (string, error) { +func (c Client) CreateMonitor(ctx context.Context, monitor uptimerobotv1.MonitorValues, contacts uptimerobotv1.MonitorContacts) (string, error) { form := c.MonitorValues(monitor, c.NewValues(), contacts) res, err := c.Do(ctx, "newMonitor", form) @@ -182,7 +183,7 @@ func (c Client) DeleteMonitor(ctx context.Context, id string) error { return nil } -func (c Client) EditMonitor(ctx context.Context, id string, monitor Monitor, contacts MonitorContacts) (string, error) { +func (c Client) EditMonitor(ctx context.Context, id string, monitor uptimerobotv1.MonitorValues, contacts uptimerobotv1.MonitorContacts) (string, error) { form := c.MonitorValues(monitor, c.NewValues(), contacts) form.Set("id", id) form.Set("status", strconv.Itoa(int(monitor.Status))) diff --git a/internal/uptimerobot/contact.go b/internal/uptimerobot/contact.go deleted file mode 100644 index c42bdd5..0000000 --- a/internal/uptimerobot/contact.go +++ /dev/null @@ -1,49 +0,0 @@ -package uptimerobot - -import ( - "fmt" - "strings" - "time" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type Contact struct { - // FriendlyName sets the name that is shown in Uptime Robot. - FriendlyName string `json:"friendlyName"` -} - -type MonitorContactCommon struct { - // Threshold defines the number of minutes to wait to notify. - // +kubebuilder:default:="1m" - Threshold metav1.Duration `json:"threshold,omitempty"` - - // Recurrence defines the number of minutes between a repeat notification. - // A value of 0, disables repeat notifications. - Recurrence metav1.Duration `json:"recurrence,omitempty"` -} - -type MonitorContact struct { - ID string `json:"id"` - - MonitorContactCommon `json:",inline"` -} - -func (m MonitorContact) String() string { - return fmt.Sprintf( - "%s_%d_%d", - m.ID, - int(m.MonitorContactCommon.Threshold.Round(time.Minute).Minutes()), - int(m.MonitorContactCommon.Recurrence.Round(time.Minute).Minutes()), - ) -} - -type MonitorContacts []MonitorContact - -func (m MonitorContacts) String() string { - results := make([]string, 0, len(m)) - for _, c := range m { - results = append(results, c.String()) - } - return strings.Join(results, "-") -} diff --git a/internal/uptimerobot/find_opts.go b/internal/uptimerobot/find_opts.go index ed342cf..99c98fc 100644 --- a/internal/uptimerobot/find_opts.go +++ b/internal/uptimerobot/find_opts.go @@ -3,6 +3,8 @@ package uptimerobot import ( "net/url" "strings" + + uptimerobotv1 "github.com/clevyr/uptime-robot-operator/api/v1" ) type FindOpt func(form url.Values) @@ -13,7 +15,7 @@ func FindBySearch(val string) FindOpt { } } -func FindByURL(monitor Monitor) FindOpt { +func FindByURL(monitor uptimerobotv1.MonitorValues) FindOpt { return FindBySearch(monitor.URL) } diff --git a/internal/uptimerobot/monitor.go b/internal/uptimerobot/monitor.go deleted file mode 100644 index 8ab2951..0000000 --- a/internal/uptimerobot/monitor.go +++ /dev/null @@ -1,95 +0,0 @@ -package uptimerobot - -import ( - "github.com/clevyr/uptime-robot-operator/internal/uptimerobot/urtypes" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -//+kubebuilder:object:generate=true -//+kubebuilder:validation:XValidation:rule="self.type != 'Keyword' || has(self.keyword)", message="Keyword config is required if type is Keyword" -//+kubebuilder:validation:XValidation:rule="self.type != 'Port' || has(self.port)", message="Port config is required if type is Port" - -type Monitor struct { - // FriendlyName sets the name that is shown in Uptime Robot. - FriendlyName string `json:"friendlyName"` - - // URL is the URL or IP to monitor, including the scheme. - URL string `json:"url"` - - // Type chooses the monitor type. - //+kubebuilder:default:=HTTPS - Type urtypes.MonitorType `json:"type,omitempty"` - - // Interval is the monitoring interval. - //+kubebuilder:default:="60s" - Interval *metav1.Duration `json:"interval,omitempty"` - - // Status toggles pause status for the monitor. 0 is paused, 1 is running. - //+kubebuilder:default:=1 - Status uint8 `json:"status,omitempty"` - - // Timeout is the monitor timeout. - //+kubebuilder:default:="30s" - Timeout *metav1.Duration `json:"timeout,omitempty"` - - // HTTPMethod defines the HTTP verb to use. - //+kubebuilder:default:="HEAD" - HTTPMethod urtypes.HTTPMethod `json:"httpMethod,omitempty"` - - // POST configures POST, PUT, PATCH, DELETE, and OPTIONS requests. - POST *MonitorPOST `json:"post,omitempty"` - - // Keyword provides configuration for the Keyword monitor type. - Keyword *MonitorKeyword `json:"keyword,omitempty"` - - // Port provides configuration for the Port monitor type. - Port *MonitorPort `json:"port,omitempty"` - - // Auth enables monitor auth. - Auth *MonitorAuth `json:"auth,omitempty"` -} - -//+kubebuilder:object:generate=true - -type MonitorKeyword struct { - Type urtypes.KeywordType `json:"type"` - - //+kubebuilder:default:=false - CaseSensitive *bool `json:"caseSensitive,omitempty"` - - Value string `json:"value"` -} - -//+kubebuilder:validation:XValidation:rule="self.type != 'Custom' || has(self.number)", message="Number is required if type is Custom" -//+kubebuilder:validation:XValidation:rule="self.type == 'Custom' || !has(self.number)", message="Type must be Custom if Number is set" - -type MonitorPort struct { - Type urtypes.PortType `json:"type"` - - Number uint16 `json:"number,omitempty"` -} - -type MonitorAuth struct { - //+kubebuilder:default:="Basic" - Type urtypes.MonitorAuthType `json:"type"` - - Username string `json:"username,omitempty"` - Password string `json:"password,omitempty"` - - SecretName string `json:"secretName,omitempty"` - UsernameKey string `json:"usernameKey,omitempty"` - PasswordKey string `json:"passwordKey,omitempty"` -} - -type MonitorPOST struct { - // Type defines the format of data to be sent with POST, PUT, PATCH, DELETE, and OPTIONS requests. - //+kubebuilder:default:="KeyValue" - Type urtypes.POSTType `json:"postType,omitempty"` - - // ContentType sets the Content-Type header for POST, PUT, PATCH, DELETE, and OPTIONS requests. - //+kubebuilder:default:="text/html" - ContentType urtypes.POSTContentType `json:"contentType,omitempty"` - - // Value is the JSON form of data to be sent with POST, PUT, PATCH, DELETE, and OPTIONS requests. - Value string `json:"value,omitempty"` -} diff --git a/internal/uptimerobot/zz_generated.deepcopy.go b/internal/uptimerobot/zz_generated.deepcopy.go deleted file mode 100644 index d006886..0000000 --- a/internal/uptimerobot/zz_generated.deepcopy.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build !ignore_autogenerated - -/* -Copyright 2024. - -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 controller-gen. DO NOT EDIT. - -package uptimerobot - -import ( - "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Monitor) DeepCopyInto(out *Monitor) { - *out = *in - if in.Interval != nil { - in, out := &in.Interval, &out.Interval - *out = new(v1.Duration) - **out = **in - } - if in.Timeout != nil { - in, out := &in.Timeout, &out.Timeout - *out = new(v1.Duration) - **out = **in - } - if in.POST != nil { - in, out := &in.POST, &out.POST - *out = new(MonitorPOST) - **out = **in - } - if in.Keyword != nil { - in, out := &in.Keyword, &out.Keyword - *out = new(MonitorKeyword) - (*in).DeepCopyInto(*out) - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(MonitorPort) - **out = **in - } - if in.Auth != nil { - in, out := &in.Auth, &out.Auth - *out = new(MonitorAuth) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Monitor. -func (in *Monitor) DeepCopy() *Monitor { - if in == nil { - return nil - } - out := new(Monitor) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MonitorKeyword) DeepCopyInto(out *MonitorKeyword) { - *out = *in - if in.CaseSensitive != nil { - in, out := &in.CaseSensitive, &out.CaseSensitive - *out = new(bool) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MonitorKeyword. -func (in *MonitorKeyword) DeepCopy() *MonitorKeyword { - if in == nil { - return nil - } - out := new(MonitorKeyword) - in.DeepCopyInto(out) - return out -}