From 25413b0a449597053d33f234883d2e909c7ecd5b Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Tue, 30 Jun 2020 12:22:10 +0200 Subject: [PATCH] Add MessagingPlan and MessagingAddressPlan types (#4771) --- api-model/generator/generate.go | 4 + .../io/enmasse/address/model/CoreCrd.java | 18 ++ .../main/resources/schema/kube-schema.json | 294 ++++++++++++++++++ cmd/controller-manager/main.go | 34 +- pkg/apis/enmasse/v1beta2/funcs_addressplan.go | 39 +++ pkg/apis/enmasse/v1beta2/funcs_plan.go | 39 +++ pkg/apis/enmasse/v1beta2/register.go | 4 + pkg/apis/enmasse/v1beta2/types_addressplan.go | 71 +++++ pkg/apis/enmasse/v1beta2/types_plan.go | 71 +++++ .../enmasse/v1beta2/zz_generated.deepcopy.go | 234 ++++++++++++++ .../typed/enmasse/v1beta2/enmasse_client.go | 10 + .../v1beta2/fake/fake_enmasse_client.go | 8 + .../v1beta2/fake/fake_messagingaddressplan.go | 129 ++++++++ .../v1beta2/fake/fake_messagingplan.go | 129 ++++++++ .../enmasse/v1beta2/generated_expansion.go | 4 + .../enmasse/v1beta2/messagingaddressplan.go | 180 +++++++++++ .../typed/enmasse/v1beta2/messagingplan.go | 180 +++++++++++ .../enmasse/v1beta2/interface.go | 14 + .../enmasse/v1beta2/messagingaddressplan.go | 78 +++++ .../enmasse/v1beta2/messagingplan.go | 78 +++++ .../informers/externalversions/generic.go | 4 + .../enmasse/v1beta2/expansion_generated.go | 16 + .../enmasse/v1beta2/messagingaddressplan.go | 83 +++++ .../listers/enmasse/v1beta2/messagingplan.go | 83 +++++ .../enmasse.io_messagingaddressplans.yaml | 93 ++++++ .../enmasse.io_messagingplans.yaml | 93 ++++++ 26 files changed, 1989 insertions(+), 1 deletion(-) create mode 100644 pkg/apis/enmasse/v1beta2/funcs_addressplan.go create mode 100644 pkg/apis/enmasse/v1beta2/funcs_plan.go create mode 100644 pkg/apis/enmasse/v1beta2/types_addressplan.go create mode 100644 pkg/apis/enmasse/v1beta2/types_plan.go create mode 100644 pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_messagingaddressplan.go create mode 100644 pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_messagingplan.go create mode 100644 pkg/client/clientset/versioned/typed/enmasse/v1beta2/messagingaddressplan.go create mode 100644 pkg/client/clientset/versioned/typed/enmasse/v1beta2/messagingplan.go create mode 100644 pkg/client/informers/externalversions/enmasse/v1beta2/messagingaddressplan.go create mode 100644 pkg/client/informers/externalversions/enmasse/v1beta2/messagingplan.go create mode 100644 pkg/client/listers/enmasse/v1beta2/messagingaddressplan.go create mode 100644 pkg/client/listers/enmasse/v1beta2/messagingplan.go create mode 100644 templates/shared-infra/enmasse.io_messagingaddressplans.yaml create mode 100644 templates/shared-infra/enmasse.io_messagingplans.yaml diff --git a/api-model/generator/generate.go b/api-model/generator/generate.go index dbf2bd5f06d..40451d02748 100644 --- a/api-model/generator/generate.go +++ b/api-model/generator/generate.go @@ -39,6 +39,10 @@ type Schema struct { MessagingAddressList enmasseapi.MessagingAddressList MessagingEndpoint enmasseapi.MessagingEndpoint MessagingEndpointList enmasseapi.MessagingEndpointList + MessagingPlan enmasseapi.MessagingPlan + MessagingPlanList enmasseapi.MessagingPlanList + MessagingAddressPlan enmasseapi.MessagingAddressPlan + MessagingAddressPlanList enmasseapi.MessagingAddressPlanList } func main() { diff --git a/api-model/src/main/java/io/enmasse/address/model/CoreCrd.java b/api-model/src/main/java/io/enmasse/address/model/CoreCrd.java index b533cdf161f..5179ec1292c 100644 --- a/api-model/src/main/java/io/enmasse/address/model/CoreCrd.java +++ b/api-model/src/main/java/io/enmasse/address/model/CoreCrd.java @@ -24,6 +24,8 @@ public class CoreCrd { private static final CustomResourceDefinition MESSAGING_TENANT_CRD; private static final CustomResourceDefinition MESSAGING_ADDRESS_CRD; private static final CustomResourceDefinition MESSAGING_ENDPOINT_CRD; + private static final CustomResourceDefinition MESSAGING_PLAN_CRD; + private static final CustomResourceDefinition MESSAGING_ADDRESS_PLAN_CRD; static { ADDRESS_CRD = CustomResources.createCustomResource(GROUP, VERSION, Address.KIND); @@ -33,6 +35,8 @@ public class CoreCrd { MESSAGING_TENANT_CRD = CustomResources.createCustomResource(GROUP, VERSION_BETA2, "MessagingTenant"); MESSAGING_ADDRESS_CRD= CustomResources.createCustomResource(GROUP, VERSION_BETA2, "MessagingAddress"); MESSAGING_ENDPOINT_CRD= CustomResources.createCustomResource(GROUP, VERSION_BETA2, "MessagingEndpoint"); + MESSAGING_PLAN_CRD= CustomResources.createCustomResource(GROUP, VERSION_BETA2, "MessagingPlan"); + MESSAGING_ADDRESS_PLAN_CRD= CustomResources.createCustomResource(GROUP, VERSION_BETA2, "MessagingAddressPlan"); } public static void registerCustomCrds() { @@ -56,6 +60,12 @@ public static void registerCustomCrds() { KubernetesDeserializer.registerCustomKind(API_VERSION_BETA2, "MessagingEndpoint", MessagingEndpoint.class); KubernetesDeserializer.registerCustomKind(API_VERSION_BETA2, "MessagingEndpointList", MessagingEndpointList.class); + + KubernetesDeserializer.registerCustomKind(API_VERSION_BETA2, "MessagingPlan", MessagingPlan.class); + KubernetesDeserializer.registerCustomKind(API_VERSION_BETA2, "MessagingPlanList", MessagingPlanList.class); + + KubernetesDeserializer.registerCustomKind(API_VERSION_BETA2, "MessagingAddressPlan", MessagingAddressPlan.class); + KubernetesDeserializer.registerCustomKind(API_VERSION_BETA2, "MessagingAddressPlanList", MessagingAddressPlanList.class); } public static CustomResourceDefinition addresses() { return ADDRESS_CRD; @@ -84,4 +94,12 @@ public static CustomResourceDefinition messagingAddresses() { public static CustomResourceDefinition messagingEndpoints() { return MESSAGING_ENDPOINT_CRD; } + + public static CustomResourceDefinition messagingPlans() { + return MESSAGING_PLAN_CRD; + } + + public static CustomResourceDefinition messagingAddressPlans() { + return MESSAGING_ADDRESS_PLAN_CRD; + } } diff --git a/api-model/src/main/resources/schema/kube-schema.json b/api-model/src/main/resources/schema/kube-schema.json index 24c8858680f..8a094741981 100644 --- a/api-model/src/main/resources/schema/kube-schema.json +++ b/api-model/src/main/resources/schema/kube-schema.json @@ -161,6 +161,145 @@ "io.fabric8.kubernetes.api.model.KubernetesResourceList\u003cMessagingAddress\u003e" ] }, + "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlan": { + "type": "object", + "description": "", + "properties": { + "apiVersion": { + "type": "string", + "description": "", + "default": "enmasse.io/v1beta2", + "required": true + }, + "kind": { + "type": "string", + "description": "", + "default": "MessagingAddressPlan", + "required": true + }, + "metadata": { + "$ref": "#/definitions/kubernetes_apimachinery_ObjectMeta", + "existingJavaType": "io.fabric8.kubernetes.api.model.ObjectMeta" + }, + "spec": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlanSpec", + "javaType": "MessagingAddressPlanSpec" + }, + "status": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlanStatus", + "javaType": "MessagingAddressPlanStatus" + } + }, + "additionalProperties": true, + "javaType": "MessagingAddressPlan", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.HasMetadata" + ] + }, + "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlanCondition": { + "type": "object", + "description": "", + "properties": { + "lastTransitionTime": { + "$ref": "#/definitions/kubernetes_apimachinery_Time", + "existingJavaType": "java.lang.String" + }, + "message": { + "type": "string", + "description": "" + }, + "reason": { + "type": "string", + "description": "" + }, + "status": { + "type": "string", + "description": "" + }, + "type": { + "type": "string", + "description": "" + } + }, + "additionalProperties": true, + "javaType": "MessagingAddressPlanCondition", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, + "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlanList": { + "type": "object", + "description": "", + "properties": { + "apiVersion": { + "type": "string", + "description": "", + "default": "enmasse.io/v1beta2", + "required": true + }, + "items": { + "type": "array", + "description": "", + "items": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlan", + "javaType": "MessagingAddressPlan" + } + }, + "kind": { + "type": "string", + "description": "", + "default": "MessagingAddressPlanList", + "required": true + }, + "metadata": { + "$ref": "#/definitions/kubernetes_apimachinery_ListMeta", + "existingJavaType": "io.fabric8.kubernetes.api.model.ListMeta" + } + }, + "additionalProperties": true, + "javaType": "MessagingAddressPlanList", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource", + "io.fabric8.kubernetes.api.model.KubernetesResourceList\u003cMessagingAddressPlan\u003e" + ] + }, + "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlanSpec": { + "type": "object", + "description": "", + "additionalProperties": true, + "javaType": "MessagingAddressPlanSpec", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, + "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlanStatus": { + "type": "object", + "description": "", + "properties": { + "conditions": { + "type": "array", + "description": "", + "javaOmitEmpty": true, + "items": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlanCondition", + "javaType": "MessagingAddressPlanCondition" + } + }, + "message": { + "type": "string", + "description": "" + }, + "phase": { + "type": "string", + "description": "" + } + }, + "additionalProperties": true, + "javaType": "MessagingAddressPlanStatus", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressSpec": { "type": "object", "description": "", @@ -1029,6 +1168,145 @@ "io.fabric8.kubernetes.api.model.KubernetesResource" ] }, + "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlan": { + "type": "object", + "description": "", + "properties": { + "apiVersion": { + "type": "string", + "description": "", + "default": "enmasse.io/v1beta2", + "required": true + }, + "kind": { + "type": "string", + "description": "", + "default": "MessagingPlan", + "required": true + }, + "metadata": { + "$ref": "#/definitions/kubernetes_apimachinery_ObjectMeta", + "existingJavaType": "io.fabric8.kubernetes.api.model.ObjectMeta" + }, + "spec": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlanSpec", + "javaType": "MessagingPlanSpec" + }, + "status": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlanStatus", + "javaType": "MessagingPlanStatus" + } + }, + "additionalProperties": true, + "javaType": "MessagingPlan", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.HasMetadata" + ] + }, + "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlanCondition": { + "type": "object", + "description": "", + "properties": { + "lastTransitionTime": { + "$ref": "#/definitions/kubernetes_apimachinery_Time", + "existingJavaType": "java.lang.String" + }, + "message": { + "type": "string", + "description": "" + }, + "reason": { + "type": "string", + "description": "" + }, + "status": { + "type": "string", + "description": "" + }, + "type": { + "type": "string", + "description": "" + } + }, + "additionalProperties": true, + "javaType": "MessagingPlanCondition", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, + "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlanList": { + "type": "object", + "description": "", + "properties": { + "apiVersion": { + "type": "string", + "description": "", + "default": "enmasse.io/v1beta2", + "required": true + }, + "items": { + "type": "array", + "description": "", + "items": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlan", + "javaType": "MessagingPlan" + } + }, + "kind": { + "type": "string", + "description": "", + "default": "MessagingPlanList", + "required": true + }, + "metadata": { + "$ref": "#/definitions/kubernetes_apimachinery_ListMeta", + "existingJavaType": "io.fabric8.kubernetes.api.model.ListMeta" + } + }, + "additionalProperties": true, + "javaType": "MessagingPlanList", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource", + "io.fabric8.kubernetes.api.model.KubernetesResourceList\u003cMessagingPlan\u003e" + ] + }, + "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlanSpec": { + "type": "object", + "description": "", + "additionalProperties": true, + "javaType": "MessagingPlanSpec", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, + "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlanStatus": { + "type": "object", + "description": "", + "properties": { + "conditions": { + "type": "array", + "description": "", + "javaOmitEmpty": true, + "items": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlanCondition", + "javaType": "MessagingPlanCondition" + } + }, + "message": { + "type": "string", + "description": "" + }, + "phase": { + "type": "string", + "description": "" + } + }, + "additionalProperties": true, + "javaType": "MessagingPlanStatus", + "javaInterfaces": [ + "io.fabric8.kubernetes.api.model.KubernetesResource" + ] + }, "github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingTenant": { "type": "object", "description": "", @@ -1538,6 +1816,14 @@ "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressList", "javaType": "MessagingAddressList" }, + "MessagingAddressPlan": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlan", + "javaType": "MessagingAddressPlan" + }, + "MessagingAddressPlanList": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingAddressPlanList", + "javaType": "MessagingAddressPlanList" + }, "MessagingEndpoint": { "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingEndpoint", "javaType": "MessagingEndpoint" @@ -1554,6 +1840,14 @@ "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingInfrastructureList", "javaType": "MessagingInfrastructureList" }, + "MessagingPlan": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlan", + "javaType": "MessagingPlan" + }, + "MessagingPlanList": { + "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingPlanList", + "javaType": "MessagingPlanList" + }, "MessagingTenant": { "$ref": "#/definitions/github_com_enmasseproject_enmasse_pkg_apis_enmasse_v1beta2_MessagingTenant", "javaType": "MessagingTenant" diff --git a/cmd/controller-manager/main.go b/cmd/controller-manager/main.go index bbfbf520ba5..e380b09c8d4 100644 --- a/cmd/controller-manager/main.go +++ b/cmd/controller-manager/main.go @@ -221,6 +221,36 @@ func main() { ) } + if util.IsModuleEnabled("MESSAGING_PLAN") { + globalGvks = append(globalGvks, + schema.GroupVersionKind{ + Group: "enmasse.io", + Version: "v1beta2", + Kind: "MessagingPlan", + }, + schema.GroupVersionKind{ + Group: "enmasse.io", + Version: "v1beta2", + Kind: "MessagingPlanList", + }, + ) + } + + if util.IsModuleEnabled("MESSAGING_ADDRESS_PLAN") { + globalGvks = append(globalGvks, + schema.GroupVersionKind{ + Group: "enmasse.io", + Version: "v1beta2", + Kind: "MessagingAddressPlan", + }, + schema.GroupVersionKind{ + Group: "enmasse.io", + Version: "v1beta2", + Kind: "MessagingAddressPlanList", + }, + ) + } + // Create a new Cmd to provide shared dependencies and start components mgr, err := manager.New(cfg, manager.Options{ Namespace: namespace, @@ -339,7 +369,9 @@ func serveCRMetrics(cfg *rest.Config) error { if (!util.IsModuleEnabled("MESSAGING_INFRASTRUCTURE") && strings.HasPrefix(gvk.Kind, "MessagingInfrastructure")) || (!util.IsModuleEnabled("MESSAGING_TENANT") && strings.HasPrefix(gvk.Kind, "MessagingTenant")) || (!util.IsModuleEnabled("MESSAGING_ENDPOINT") && strings.HasPrefix(gvk.Kind, "MessagingEndpoint")) || - (!util.IsModuleEnabled("MESSAGING_ADDRESS") && strings.HasPrefix(gvk.Kind, "MessagingAddress")) { + (!util.IsModuleEnabled("MESSAGING_ADDRESS") && strings.HasPrefix(gvk.Kind, "MessagingAddress")) || + (!util.IsModuleEnabled("MESSAGING_PLAN") && strings.HasPrefix(gvk.Kind, "MessagingPlan")) || + (!util.IsModuleEnabled("MESSAGING_ADDRESS_PLAN") && strings.HasPrefix(gvk.Kind, "MessagingAddressPlan")) { log.Info("Skipping adding metric because module is not enabled", "gkv", gvk) } else { filteredGVK = append(filteredGVK, gvk) diff --git a/pkg/apis/enmasse/v1beta2/funcs_addressplan.go b/pkg/apis/enmasse/v1beta2/funcs_addressplan.go new file mode 100644 index 00000000000..a06ee745068 --- /dev/null +++ b/pkg/apis/enmasse/v1beta2/funcs_addressplan.go @@ -0,0 +1,39 @@ +/* + * Copyright 2020, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ +package v1beta2 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func (m *MessagingAddressPlanStatus) GetMessagingAddressPlanCondition(t MessagingAddressPlanConditionType) *MessagingAddressPlanCondition { + for i, c := range m.Conditions { + if c.Type == t { + return &m.Conditions[i] + } + } + + mc := MessagingAddressPlanCondition{ + Type: t, + Status: corev1.ConditionUnknown, + LastTransitionTime: metav1.Now(), + } + + m.Conditions = append(m.Conditions, mc) + + return &m.Conditions[len(m.Conditions)-1] +} + +func (c *MessagingAddressPlanCondition) SetStatus(status corev1.ConditionStatus, reason string, message string) { + + if c.Status != status { + c.Status = status + c.LastTransitionTime = metav1.Now() + } + + c.Reason = reason + c.Message = message +} diff --git a/pkg/apis/enmasse/v1beta2/funcs_plan.go b/pkg/apis/enmasse/v1beta2/funcs_plan.go new file mode 100644 index 00000000000..575850bcb3a --- /dev/null +++ b/pkg/apis/enmasse/v1beta2/funcs_plan.go @@ -0,0 +1,39 @@ +/* + * Copyright 2020, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ +package v1beta2 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func (m *MessagingPlanStatus) GetMessagingPlanCondition(t MessagingPlanConditionType) *MessagingPlanCondition { + for i, c := range m.Conditions { + if c.Type == t { + return &m.Conditions[i] + } + } + + mc := MessagingPlanCondition{ + Type: t, + Status: corev1.ConditionUnknown, + LastTransitionTime: metav1.Now(), + } + + m.Conditions = append(m.Conditions, mc) + + return &m.Conditions[len(m.Conditions)-1] +} + +func (c *MessagingPlanCondition) SetStatus(status corev1.ConditionStatus, reason string, message string) { + + if c.Status != status { + c.Status = status + c.LastTransitionTime = metav1.Now() + } + + c.Reason = reason + c.Message = message +} diff --git a/pkg/apis/enmasse/v1beta2/register.go b/pkg/apis/enmasse/v1beta2/register.go index 9553fe741b0..08ef2b47ef0 100644 --- a/pkg/apis/enmasse/v1beta2/register.go +++ b/pkg/apis/enmasse/v1beta2/register.go @@ -39,6 +39,10 @@ func addKnownTypes(scheme *runtime.Scheme) error { &MessagingAddressList{}, &MessagingEndpoint{}, &MessagingEndpointList{}, + &MessagingPlan{}, + &MessagingPlanList{}, + &MessagingAddressPlan{}, + &MessagingAddressPlanList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) diff --git a/pkg/apis/enmasse/v1beta2/types_addressplan.go b/pkg/apis/enmasse/v1beta2/types_addressplan.go new file mode 100644 index 00000000000..2da1fa207b4 --- /dev/null +++ b/pkg/apis/enmasse/v1beta2/types_addressplan.go @@ -0,0 +1,71 @@ +/* + * Copyright 2020, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ +package v1beta2 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +/* + * Be careful with the comments in this file. The prefix "+" indicates that this is being processed + * by the client generator. The location, empty lines, and other comments in this file may confuse + * the generator, and produce a non-version version. + */ + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:shortName=msgp;msgplan;msgplans,categories=enmasse +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The current phase." +// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",priority=1,description="Message describing the reason for the current Phase." +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +type MessagingAddressPlan struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec MessagingAddressPlanSpec `json:"spec,omitempty"` + Status MessagingAddressPlanStatus `json:"status,omitempty"` +} + +type MessagingAddressPlanSpec struct { +} + +type MessagingAddressPlanStatus struct { + // +kubebuilder:printcolumn + Phase MessagingAddressPlanPhase `json:"phase,omitempty"` + Message string `json:"message,omitempty"` + Conditions []MessagingAddressPlanCondition `json:"conditions,omitempty"` +} + +type MessagingAddressPlanCondition struct { + Type MessagingAddressPlanConditionType `json:"type"` + Status corev1.ConditionStatus `json:"status"` + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + Reason string `json:"reason,omitempty"` + Message string `json:"message,omitempty"` +} + +type MessagingAddressPlanConditionType string + +const ( + MessagingAddressPlanReady MessagingAddressPlanConditionType = "Ready" +) + +type MessagingAddressPlanPhase string + +const ( + MessagingAddressPlanConfiguring MessagingAddressPlanPhase = "Configuring" + MessagingAddressPlanActive MessagingAddressPlanPhase = "Active" + MessagingAddressPlanTerminating MessagingAddressPlanPhase = "Terminating" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type MessagingAddressPlanList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []MessagingAddressPlan `json:"items"` +} diff --git a/pkg/apis/enmasse/v1beta2/types_plan.go b/pkg/apis/enmasse/v1beta2/types_plan.go new file mode 100644 index 00000000000..d3f4d03ca1e --- /dev/null +++ b/pkg/apis/enmasse/v1beta2/types_plan.go @@ -0,0 +1,71 @@ +/* + * Copyright 2020, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ +package v1beta2 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +/* + * Be careful with the comments in this file. The prefix "+" indicates that this is being processed + * by the client generator. The location, empty lines, and other comments in this file may confuse + * the generator, and produce a non-version version. + */ + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:shortName=msgp;msgplan;msgplans,categories=enmasse +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The current phase." +// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",priority=1,description="Message describing the reason for the current Phase." +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +type MessagingPlan struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec MessagingPlanSpec `json:"spec,omitempty"` + Status MessagingPlanStatus `json:"status,omitempty"` +} + +type MessagingPlanSpec struct { +} + +type MessagingPlanStatus struct { + // +kubebuilder:printcolumn + Phase MessagingPlanPhase `json:"phase,omitempty"` + Message string `json:"message,omitempty"` + Conditions []MessagingPlanCondition `json:"conditions,omitempty"` +} + +type MessagingPlanCondition struct { + Type MessagingPlanConditionType `json:"type"` + Status corev1.ConditionStatus `json:"status"` + LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` + Reason string `json:"reason,omitempty"` + Message string `json:"message,omitempty"` +} + +type MessagingPlanConditionType string + +const ( + MessagingPlanReady MessagingPlanConditionType = "Ready" +) + +type MessagingPlanPhase string + +const ( + MessagingPlanConfiguring MessagingPlanPhase = "Configuring" + MessagingPlanActive MessagingPlanPhase = "Active" + MessagingPlanTerminating MessagingPlanPhase = "Terminating" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type MessagingPlanList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []MessagingPlan `json:"items"` +} diff --git a/pkg/apis/enmasse/v1beta2/zz_generated.deepcopy.go b/pkg/apis/enmasse/v1beta2/zz_generated.deepcopy.go index 8954b8598d5..5bb82862049 100644 --- a/pkg/apis/enmasse/v1beta2/zz_generated.deepcopy.go +++ b/pkg/apis/enmasse/v1beta2/zz_generated.deepcopy.go @@ -132,6 +132,123 @@ func (in *MessagingAddressList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MessagingAddressPlan) DeepCopyInto(out *MessagingAddressPlan) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressPlan. +func (in *MessagingAddressPlan) DeepCopy() *MessagingAddressPlan { + if in == nil { + return nil + } + out := new(MessagingAddressPlan) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MessagingAddressPlan) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MessagingAddressPlanCondition) DeepCopyInto(out *MessagingAddressPlanCondition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressPlanCondition. +func (in *MessagingAddressPlanCondition) DeepCopy() *MessagingAddressPlanCondition { + if in == nil { + return nil + } + out := new(MessagingAddressPlanCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MessagingAddressPlanList) DeepCopyInto(out *MessagingAddressPlanList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MessagingAddressPlan, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressPlanList. +func (in *MessagingAddressPlanList) DeepCopy() *MessagingAddressPlanList { + if in == nil { + return nil + } + out := new(MessagingAddressPlanList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MessagingAddressPlanList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MessagingAddressPlanSpec) DeepCopyInto(out *MessagingAddressPlanSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressPlanSpec. +func (in *MessagingAddressPlanSpec) DeepCopy() *MessagingAddressPlanSpec { + if in == nil { + return nil + } + out := new(MessagingAddressPlanSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MessagingAddressPlanStatus) DeepCopyInto(out *MessagingAddressPlanStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]MessagingAddressPlanCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingAddressPlanStatus. +func (in *MessagingAddressPlanStatus) DeepCopy() *MessagingAddressPlanStatus { + if in == nil { + return nil + } + out := new(MessagingAddressPlanStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingAddressSpec) DeepCopyInto(out *MessagingAddressSpec) { *out = *in @@ -1030,6 +1147,123 @@ func (in *MessagingInfrastructureStatusRouter) DeepCopy() *MessagingInfrastructu return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MessagingPlan) DeepCopyInto(out *MessagingPlan) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlan. +func (in *MessagingPlan) DeepCopy() *MessagingPlan { + if in == nil { + return nil + } + out := new(MessagingPlan) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MessagingPlan) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MessagingPlanCondition) DeepCopyInto(out *MessagingPlanCondition) { + *out = *in + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlanCondition. +func (in *MessagingPlanCondition) DeepCopy() *MessagingPlanCondition { + if in == nil { + return nil + } + out := new(MessagingPlanCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MessagingPlanList) DeepCopyInto(out *MessagingPlanList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MessagingPlan, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlanList. +func (in *MessagingPlanList) DeepCopy() *MessagingPlanList { + if in == nil { + return nil + } + out := new(MessagingPlanList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MessagingPlanList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MessagingPlanSpec) DeepCopyInto(out *MessagingPlanSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlanSpec. +func (in *MessagingPlanSpec) DeepCopy() *MessagingPlanSpec { + if in == nil { + return nil + } + out := new(MessagingPlanSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MessagingPlanStatus) DeepCopyInto(out *MessagingPlanStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]MessagingPlanCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MessagingPlanStatus. +func (in *MessagingPlanStatus) DeepCopy() *MessagingPlanStatus { + if in == nil { + return nil + } + out := new(MessagingPlanStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MessagingTenant) DeepCopyInto(out *MessagingTenant) { *out = *in diff --git a/pkg/client/clientset/versioned/typed/enmasse/v1beta2/enmasse_client.go b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/enmasse_client.go index 945ec6bbd42..284a853de21 100644 --- a/pkg/client/clientset/versioned/typed/enmasse/v1beta2/enmasse_client.go +++ b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/enmasse_client.go @@ -16,8 +16,10 @@ import ( type EnmasseV1beta2Interface interface { RESTClient() rest.Interface MessagingAddressesGetter + MessagingAddressPlansGetter MessagingEndpointsGetter MessagingInfrastructuresGetter + MessagingPlansGetter MessagingTenantsGetter } @@ -30,6 +32,10 @@ func (c *EnmasseV1beta2Client) MessagingAddresses(namespace string) MessagingAdd return newMessagingAddresses(c, namespace) } +func (c *EnmasseV1beta2Client) MessagingAddressPlans(namespace string) MessagingAddressPlanInterface { + return newMessagingAddressPlans(c, namespace) +} + func (c *EnmasseV1beta2Client) MessagingEndpoints(namespace string) MessagingEndpointInterface { return newMessagingEndpoints(c, namespace) } @@ -38,6 +44,10 @@ func (c *EnmasseV1beta2Client) MessagingInfrastructures(namespace string) Messag return newMessagingInfrastructures(c, namespace) } +func (c *EnmasseV1beta2Client) MessagingPlans(namespace string) MessagingPlanInterface { + return newMessagingPlans(c, namespace) +} + func (c *EnmasseV1beta2Client) MessagingTenants(namespace string) MessagingTenantInterface { return newMessagingTenants(c, namespace) } diff --git a/pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_enmasse_client.go b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_enmasse_client.go index 042b7b16d4f..c0da3018cdc 100644 --- a/pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_enmasse_client.go +++ b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_enmasse_client.go @@ -21,6 +21,10 @@ func (c *FakeEnmasseV1beta2) MessagingAddresses(namespace string) v1beta2.Messag return &FakeMessagingAddresses{c, namespace} } +func (c *FakeEnmasseV1beta2) MessagingAddressPlans(namespace string) v1beta2.MessagingAddressPlanInterface { + return &FakeMessagingAddressPlans{c, namespace} +} + func (c *FakeEnmasseV1beta2) MessagingEndpoints(namespace string) v1beta2.MessagingEndpointInterface { return &FakeMessagingEndpoints{c, namespace} } @@ -29,6 +33,10 @@ func (c *FakeEnmasseV1beta2) MessagingInfrastructures(namespace string) v1beta2. return &FakeMessagingInfrastructures{c, namespace} } +func (c *FakeEnmasseV1beta2) MessagingPlans(namespace string) v1beta2.MessagingPlanInterface { + return &FakeMessagingPlans{c, namespace} +} + func (c *FakeEnmasseV1beta2) MessagingTenants(namespace string) v1beta2.MessagingTenantInterface { return &FakeMessagingTenants{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_messagingaddressplan.go b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_messagingaddressplan.go new file mode 100644 index 00000000000..8a537f62b1a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_messagingaddressplan.go @@ -0,0 +1,129 @@ +/* + * Copyright 2018-2019, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta2 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeMessagingAddressPlans implements MessagingAddressPlanInterface +type FakeMessagingAddressPlans struct { + Fake *FakeEnmasseV1beta2 + ns string +} + +var messagingaddressplansResource = schema.GroupVersionResource{Group: "enmasse.io", Version: "v1beta2", Resource: "messagingaddressplans"} + +var messagingaddressplansKind = schema.GroupVersionKind{Group: "enmasse.io", Version: "v1beta2", Kind: "MessagingAddressPlan"} + +// Get takes name of the messagingAddressPlan, and returns the corresponding messagingAddressPlan object, and an error if there is any. +func (c *FakeMessagingAddressPlans) Get(name string, options v1.GetOptions) (result *v1beta2.MessagingAddressPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(messagingaddressplansResource, c.ns, name), &v1beta2.MessagingAddressPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.MessagingAddressPlan), err +} + +// List takes label and field selectors, and returns the list of MessagingAddressPlans that match those selectors. +func (c *FakeMessagingAddressPlans) List(opts v1.ListOptions) (result *v1beta2.MessagingAddressPlanList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(messagingaddressplansResource, messagingaddressplansKind, c.ns, opts), &v1beta2.MessagingAddressPlanList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta2.MessagingAddressPlanList{ListMeta: obj.(*v1beta2.MessagingAddressPlanList).ListMeta} + for _, item := range obj.(*v1beta2.MessagingAddressPlanList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested messagingAddressPlans. +func (c *FakeMessagingAddressPlans) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(messagingaddressplansResource, c.ns, opts)) + +} + +// Create takes the representation of a messagingAddressPlan and creates it. Returns the server's representation of the messagingAddressPlan, and an error, if there is any. +func (c *FakeMessagingAddressPlans) Create(messagingAddressPlan *v1beta2.MessagingAddressPlan) (result *v1beta2.MessagingAddressPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(messagingaddressplansResource, c.ns, messagingAddressPlan), &v1beta2.MessagingAddressPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.MessagingAddressPlan), err +} + +// Update takes the representation of a messagingAddressPlan and updates it. Returns the server's representation of the messagingAddressPlan, and an error, if there is any. +func (c *FakeMessagingAddressPlans) Update(messagingAddressPlan *v1beta2.MessagingAddressPlan) (result *v1beta2.MessagingAddressPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(messagingaddressplansResource, c.ns, messagingAddressPlan), &v1beta2.MessagingAddressPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.MessagingAddressPlan), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeMessagingAddressPlans) UpdateStatus(messagingAddressPlan *v1beta2.MessagingAddressPlan) (*v1beta2.MessagingAddressPlan, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(messagingaddressplansResource, "status", c.ns, messagingAddressPlan), &v1beta2.MessagingAddressPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.MessagingAddressPlan), err +} + +// Delete takes name of the messagingAddressPlan and deletes it. Returns an error if one occurs. +func (c *FakeMessagingAddressPlans) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(messagingaddressplansResource, c.ns, name), &v1beta2.MessagingAddressPlan{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMessagingAddressPlans) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(messagingaddressplansResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta2.MessagingAddressPlanList{}) + return err +} + +// Patch applies the patch and returns the patched messagingAddressPlan. +func (c *FakeMessagingAddressPlans) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.MessagingAddressPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(messagingaddressplansResource, c.ns, name, pt, data, subresources...), &v1beta2.MessagingAddressPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.MessagingAddressPlan), err +} diff --git a/pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_messagingplan.go b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_messagingplan.go new file mode 100644 index 00000000000..f6375db866a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/fake/fake_messagingplan.go @@ -0,0 +1,129 @@ +/* + * Copyright 2018-2019, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta2 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeMessagingPlans implements MessagingPlanInterface +type FakeMessagingPlans struct { + Fake *FakeEnmasseV1beta2 + ns string +} + +var messagingplansResource = schema.GroupVersionResource{Group: "enmasse.io", Version: "v1beta2", Resource: "messagingplans"} + +var messagingplansKind = schema.GroupVersionKind{Group: "enmasse.io", Version: "v1beta2", Kind: "MessagingPlan"} + +// Get takes name of the messagingPlan, and returns the corresponding messagingPlan object, and an error if there is any. +func (c *FakeMessagingPlans) Get(name string, options v1.GetOptions) (result *v1beta2.MessagingPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(messagingplansResource, c.ns, name), &v1beta2.MessagingPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.MessagingPlan), err +} + +// List takes label and field selectors, and returns the list of MessagingPlans that match those selectors. +func (c *FakeMessagingPlans) List(opts v1.ListOptions) (result *v1beta2.MessagingPlanList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(messagingplansResource, messagingplansKind, c.ns, opts), &v1beta2.MessagingPlanList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta2.MessagingPlanList{ListMeta: obj.(*v1beta2.MessagingPlanList).ListMeta} + for _, item := range obj.(*v1beta2.MessagingPlanList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested messagingPlans. +func (c *FakeMessagingPlans) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(messagingplansResource, c.ns, opts)) + +} + +// Create takes the representation of a messagingPlan and creates it. Returns the server's representation of the messagingPlan, and an error, if there is any. +func (c *FakeMessagingPlans) Create(messagingPlan *v1beta2.MessagingPlan) (result *v1beta2.MessagingPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(messagingplansResource, c.ns, messagingPlan), &v1beta2.MessagingPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.MessagingPlan), err +} + +// Update takes the representation of a messagingPlan and updates it. Returns the server's representation of the messagingPlan, and an error, if there is any. +func (c *FakeMessagingPlans) Update(messagingPlan *v1beta2.MessagingPlan) (result *v1beta2.MessagingPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(messagingplansResource, c.ns, messagingPlan), &v1beta2.MessagingPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.MessagingPlan), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeMessagingPlans) UpdateStatus(messagingPlan *v1beta2.MessagingPlan) (*v1beta2.MessagingPlan, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(messagingplansResource, "status", c.ns, messagingPlan), &v1beta2.MessagingPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.MessagingPlan), err +} + +// Delete takes name of the messagingPlan and deletes it. Returns an error if one occurs. +func (c *FakeMessagingPlans) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(messagingplansResource, c.ns, name), &v1beta2.MessagingPlan{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMessagingPlans) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(messagingplansResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta2.MessagingPlanList{}) + return err +} + +// Patch applies the patch and returns the patched messagingPlan. +func (c *FakeMessagingPlans) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.MessagingPlan, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(messagingplansResource, c.ns, name, pt, data, subresources...), &v1beta2.MessagingPlan{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta2.MessagingPlan), err +} diff --git a/pkg/client/clientset/versioned/typed/enmasse/v1beta2/generated_expansion.go b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/generated_expansion.go index e5212fe0610..cda98befe6e 100644 --- a/pkg/client/clientset/versioned/typed/enmasse/v1beta2/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/generated_expansion.go @@ -9,8 +9,12 @@ package v1beta2 type MessagingAddressExpansion interface{} +type MessagingAddressPlanExpansion interface{} + type MessagingEndpointExpansion interface{} type MessagingInfrastructureExpansion interface{} +type MessagingPlanExpansion interface{} + type MessagingTenantExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/enmasse/v1beta2/messagingaddressplan.go b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/messagingaddressplan.go new file mode 100644 index 00000000000..ef96ef9b20f --- /dev/null +++ b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/messagingaddressplan.go @@ -0,0 +1,180 @@ +/* + * Copyright 2018-2019, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "time" + + v1beta2 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta2" + scheme "github.com/enmasseproject/enmasse/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MessagingAddressPlansGetter has a method to return a MessagingAddressPlanInterface. +// A group's client should implement this interface. +type MessagingAddressPlansGetter interface { + MessagingAddressPlans(namespace string) MessagingAddressPlanInterface +} + +// MessagingAddressPlanInterface has methods to work with MessagingAddressPlan resources. +type MessagingAddressPlanInterface interface { + Create(*v1beta2.MessagingAddressPlan) (*v1beta2.MessagingAddressPlan, error) + Update(*v1beta2.MessagingAddressPlan) (*v1beta2.MessagingAddressPlan, error) + UpdateStatus(*v1beta2.MessagingAddressPlan) (*v1beta2.MessagingAddressPlan, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta2.MessagingAddressPlan, error) + List(opts v1.ListOptions) (*v1beta2.MessagingAddressPlanList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.MessagingAddressPlan, err error) + MessagingAddressPlanExpansion +} + +// messagingAddressPlans implements MessagingAddressPlanInterface +type messagingAddressPlans struct { + client rest.Interface + ns string +} + +// newMessagingAddressPlans returns a MessagingAddressPlans +func newMessagingAddressPlans(c *EnmasseV1beta2Client, namespace string) *messagingAddressPlans { + return &messagingAddressPlans{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the messagingAddressPlan, and returns the corresponding messagingAddressPlan object, and an error if there is any. +func (c *messagingAddressPlans) Get(name string, options v1.GetOptions) (result *v1beta2.MessagingAddressPlan, err error) { + result = &v1beta2.MessagingAddressPlan{} + err = c.client.Get(). + Namespace(c.ns). + Resource("messagingaddressplans"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MessagingAddressPlans that match those selectors. +func (c *messagingAddressPlans) List(opts v1.ListOptions) (result *v1beta2.MessagingAddressPlanList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta2.MessagingAddressPlanList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("messagingaddressplans"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested messagingAddressPlans. +func (c *messagingAddressPlans) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("messagingaddressplans"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a messagingAddressPlan and creates it. Returns the server's representation of the messagingAddressPlan, and an error, if there is any. +func (c *messagingAddressPlans) Create(messagingAddressPlan *v1beta2.MessagingAddressPlan) (result *v1beta2.MessagingAddressPlan, err error) { + result = &v1beta2.MessagingAddressPlan{} + err = c.client.Post(). + Namespace(c.ns). + Resource("messagingaddressplans"). + Body(messagingAddressPlan). + Do(). + Into(result) + return +} + +// Update takes the representation of a messagingAddressPlan and updates it. Returns the server's representation of the messagingAddressPlan, and an error, if there is any. +func (c *messagingAddressPlans) Update(messagingAddressPlan *v1beta2.MessagingAddressPlan) (result *v1beta2.MessagingAddressPlan, err error) { + result = &v1beta2.MessagingAddressPlan{} + err = c.client.Put(). + Namespace(c.ns). + Resource("messagingaddressplans"). + Name(messagingAddressPlan.Name). + Body(messagingAddressPlan). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *messagingAddressPlans) UpdateStatus(messagingAddressPlan *v1beta2.MessagingAddressPlan) (result *v1beta2.MessagingAddressPlan, err error) { + result = &v1beta2.MessagingAddressPlan{} + err = c.client.Put(). + Namespace(c.ns). + Resource("messagingaddressplans"). + Name(messagingAddressPlan.Name). + SubResource("status"). + Body(messagingAddressPlan). + Do(). + Into(result) + return +} + +// Delete takes name of the messagingAddressPlan and deletes it. Returns an error if one occurs. +func (c *messagingAddressPlans) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("messagingaddressplans"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *messagingAddressPlans) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("messagingaddressplans"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched messagingAddressPlan. +func (c *messagingAddressPlans) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.MessagingAddressPlan, err error) { + result = &v1beta2.MessagingAddressPlan{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("messagingaddressplans"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/enmasse/v1beta2/messagingplan.go b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/messagingplan.go new file mode 100644 index 00000000000..082da1a86f5 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/enmasse/v1beta2/messagingplan.go @@ -0,0 +1,180 @@ +/* + * Copyright 2018-2019, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "time" + + v1beta2 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta2" + scheme "github.com/enmasseproject/enmasse/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// MessagingPlansGetter has a method to return a MessagingPlanInterface. +// A group's client should implement this interface. +type MessagingPlansGetter interface { + MessagingPlans(namespace string) MessagingPlanInterface +} + +// MessagingPlanInterface has methods to work with MessagingPlan resources. +type MessagingPlanInterface interface { + Create(*v1beta2.MessagingPlan) (*v1beta2.MessagingPlan, error) + Update(*v1beta2.MessagingPlan) (*v1beta2.MessagingPlan, error) + UpdateStatus(*v1beta2.MessagingPlan) (*v1beta2.MessagingPlan, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta2.MessagingPlan, error) + List(opts v1.ListOptions) (*v1beta2.MessagingPlanList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.MessagingPlan, err error) + MessagingPlanExpansion +} + +// messagingPlans implements MessagingPlanInterface +type messagingPlans struct { + client rest.Interface + ns string +} + +// newMessagingPlans returns a MessagingPlans +func newMessagingPlans(c *EnmasseV1beta2Client, namespace string) *messagingPlans { + return &messagingPlans{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the messagingPlan, and returns the corresponding messagingPlan object, and an error if there is any. +func (c *messagingPlans) Get(name string, options v1.GetOptions) (result *v1beta2.MessagingPlan, err error) { + result = &v1beta2.MessagingPlan{} + err = c.client.Get(). + Namespace(c.ns). + Resource("messagingplans"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MessagingPlans that match those selectors. +func (c *messagingPlans) List(opts v1.ListOptions) (result *v1beta2.MessagingPlanList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta2.MessagingPlanList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("messagingplans"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested messagingPlans. +func (c *messagingPlans) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("messagingplans"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a messagingPlan and creates it. Returns the server's representation of the messagingPlan, and an error, if there is any. +func (c *messagingPlans) Create(messagingPlan *v1beta2.MessagingPlan) (result *v1beta2.MessagingPlan, err error) { + result = &v1beta2.MessagingPlan{} + err = c.client.Post(). + Namespace(c.ns). + Resource("messagingplans"). + Body(messagingPlan). + Do(). + Into(result) + return +} + +// Update takes the representation of a messagingPlan and updates it. Returns the server's representation of the messagingPlan, and an error, if there is any. +func (c *messagingPlans) Update(messagingPlan *v1beta2.MessagingPlan) (result *v1beta2.MessagingPlan, err error) { + result = &v1beta2.MessagingPlan{} + err = c.client.Put(). + Namespace(c.ns). + Resource("messagingplans"). + Name(messagingPlan.Name). + Body(messagingPlan). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *messagingPlans) UpdateStatus(messagingPlan *v1beta2.MessagingPlan) (result *v1beta2.MessagingPlan, err error) { + result = &v1beta2.MessagingPlan{} + err = c.client.Put(). + Namespace(c.ns). + Resource("messagingplans"). + Name(messagingPlan.Name). + SubResource("status"). + Body(messagingPlan). + Do(). + Into(result) + return +} + +// Delete takes name of the messagingPlan and deletes it. Returns an error if one occurs. +func (c *messagingPlans) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("messagingplans"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *messagingPlans) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("messagingplans"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched messagingPlan. +func (c *messagingPlans) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta2.MessagingPlan, err error) { + result = &v1beta2.MessagingPlan{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("messagingplans"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/enmasse/v1beta2/interface.go b/pkg/client/informers/externalversions/enmasse/v1beta2/interface.go index 6808e8dbb64..dcba7431f13 100644 --- a/pkg/client/informers/externalversions/enmasse/v1beta2/interface.go +++ b/pkg/client/informers/externalversions/enmasse/v1beta2/interface.go @@ -15,10 +15,14 @@ import ( type Interface interface { // MessagingAddresses returns a MessagingAddressInformer. MessagingAddresses() MessagingAddressInformer + // MessagingAddressPlans returns a MessagingAddressPlanInformer. + MessagingAddressPlans() MessagingAddressPlanInformer // MessagingEndpoints returns a MessagingEndpointInformer. MessagingEndpoints() MessagingEndpointInformer // MessagingInfrastructures returns a MessagingInfrastructureInformer. MessagingInfrastructures() MessagingInfrastructureInformer + // MessagingPlans returns a MessagingPlanInformer. + MessagingPlans() MessagingPlanInformer // MessagingTenants returns a MessagingTenantInformer. MessagingTenants() MessagingTenantInformer } @@ -39,6 +43,11 @@ func (v *version) MessagingAddresses() MessagingAddressInformer { return &messagingAddressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// MessagingAddressPlans returns a MessagingAddressPlanInformer. +func (v *version) MessagingAddressPlans() MessagingAddressPlanInformer { + return &messagingAddressPlanInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // MessagingEndpoints returns a MessagingEndpointInformer. func (v *version) MessagingEndpoints() MessagingEndpointInformer { return &messagingEndpointInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} @@ -49,6 +58,11 @@ func (v *version) MessagingInfrastructures() MessagingInfrastructureInformer { return &messagingInfrastructureInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// MessagingPlans returns a MessagingPlanInformer. +func (v *version) MessagingPlans() MessagingPlanInformer { + return &messagingPlanInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // MessagingTenants returns a MessagingTenantInformer. func (v *version) MessagingTenants() MessagingTenantInformer { return &messagingTenantInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/externalversions/enmasse/v1beta2/messagingaddressplan.go b/pkg/client/informers/externalversions/enmasse/v1beta2/messagingaddressplan.go new file mode 100644 index 00000000000..b3c3389042d --- /dev/null +++ b/pkg/client/informers/externalversions/enmasse/v1beta2/messagingaddressplan.go @@ -0,0 +1,78 @@ +/* + * Copyright 2018-2019, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + time "time" + + enmassev1beta2 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta2" + versioned "github.com/enmasseproject/enmasse/pkg/client/clientset/versioned" + internalinterfaces "github.com/enmasseproject/enmasse/pkg/client/informers/externalversions/internalinterfaces" + v1beta2 "github.com/enmasseproject/enmasse/pkg/client/listers/enmasse/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// MessagingAddressPlanInformer provides access to a shared informer and lister for +// MessagingAddressPlans. +type MessagingAddressPlanInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.MessagingAddressPlanLister +} + +type messagingAddressPlanInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMessagingAddressPlanInformer constructs a new informer for MessagingAddressPlan type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMessagingAddressPlanInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMessagingAddressPlanInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMessagingAddressPlanInformer constructs a new informer for MessagingAddressPlan type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMessagingAddressPlanInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EnmasseV1beta2().MessagingAddressPlans(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EnmasseV1beta2().MessagingAddressPlans(namespace).Watch(options) + }, + }, + &enmassev1beta2.MessagingAddressPlan{}, + resyncPeriod, + indexers, + ) +} + +func (f *messagingAddressPlanInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMessagingAddressPlanInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *messagingAddressPlanInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&enmassev1beta2.MessagingAddressPlan{}, f.defaultInformer) +} + +func (f *messagingAddressPlanInformer) Lister() v1beta2.MessagingAddressPlanLister { + return v1beta2.NewMessagingAddressPlanLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/enmasse/v1beta2/messagingplan.go b/pkg/client/informers/externalversions/enmasse/v1beta2/messagingplan.go new file mode 100644 index 00000000000..f716f90aec0 --- /dev/null +++ b/pkg/client/informers/externalversions/enmasse/v1beta2/messagingplan.go @@ -0,0 +1,78 @@ +/* + * Copyright 2018-2019, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + time "time" + + enmassev1beta2 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta2" + versioned "github.com/enmasseproject/enmasse/pkg/client/clientset/versioned" + internalinterfaces "github.com/enmasseproject/enmasse/pkg/client/informers/externalversions/internalinterfaces" + v1beta2 "github.com/enmasseproject/enmasse/pkg/client/listers/enmasse/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// MessagingPlanInformer provides access to a shared informer and lister for +// MessagingPlans. +type MessagingPlanInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.MessagingPlanLister +} + +type messagingPlanInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMessagingPlanInformer constructs a new informer for MessagingPlan type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMessagingPlanInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMessagingPlanInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMessagingPlanInformer constructs a new informer for MessagingPlan type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMessagingPlanInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EnmasseV1beta2().MessagingPlans(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EnmasseV1beta2().MessagingPlans(namespace).Watch(options) + }, + }, + &enmassev1beta2.MessagingPlan{}, + resyncPeriod, + indexers, + ) +} + +func (f *messagingPlanInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMessagingPlanInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *messagingPlanInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&enmassev1beta2.MessagingPlan{}, f.defaultInformer) +} + +func (f *messagingPlanInformer) Lister() v1beta2.MessagingPlanLister { + return v1beta2.NewMessagingPlanLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index f9cda7832d9..3736e0cb91a 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -71,10 +71,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=enmasse.io, Version=v1beta2 case enmassev1beta2.SchemeGroupVersion.WithResource("messagingaddresses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Enmasse().V1beta2().MessagingAddresses().Informer()}, nil + case enmassev1beta2.SchemeGroupVersion.WithResource("messagingaddressplans"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Enmasse().V1beta2().MessagingAddressPlans().Informer()}, nil case enmassev1beta2.SchemeGroupVersion.WithResource("messagingendpoints"): return &genericInformer{resource: resource.GroupResource(), informer: f.Enmasse().V1beta2().MessagingEndpoints().Informer()}, nil case enmassev1beta2.SchemeGroupVersion.WithResource("messaginginfrastructures"): return &genericInformer{resource: resource.GroupResource(), informer: f.Enmasse().V1beta2().MessagingInfrastructures().Informer()}, nil + case enmassev1beta2.SchemeGroupVersion.WithResource("messagingplans"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Enmasse().V1beta2().MessagingPlans().Informer()}, nil case enmassev1beta2.SchemeGroupVersion.WithResource("messagingtenants"): return &genericInformer{resource: resource.GroupResource(), informer: f.Enmasse().V1beta2().MessagingTenants().Informer()}, nil diff --git a/pkg/client/listers/enmasse/v1beta2/expansion_generated.go b/pkg/client/listers/enmasse/v1beta2/expansion_generated.go index cfdd10746c3..7008db74a56 100644 --- a/pkg/client/listers/enmasse/v1beta2/expansion_generated.go +++ b/pkg/client/listers/enmasse/v1beta2/expansion_generated.go @@ -15,6 +15,14 @@ type MessagingAddressListerExpansion interface{} // MessagingAddressNamespaceLister. type MessagingAddressNamespaceListerExpansion interface{} +// MessagingAddressPlanListerExpansion allows custom methods to be added to +// MessagingAddressPlanLister. +type MessagingAddressPlanListerExpansion interface{} + +// MessagingAddressPlanNamespaceListerExpansion allows custom methods to be added to +// MessagingAddressPlanNamespaceLister. +type MessagingAddressPlanNamespaceListerExpansion interface{} + // MessagingEndpointListerExpansion allows custom methods to be added to // MessagingEndpointLister. type MessagingEndpointListerExpansion interface{} @@ -31,6 +39,14 @@ type MessagingInfrastructureListerExpansion interface{} // MessagingInfrastructureNamespaceLister. type MessagingInfrastructureNamespaceListerExpansion interface{} +// MessagingPlanListerExpansion allows custom methods to be added to +// MessagingPlanLister. +type MessagingPlanListerExpansion interface{} + +// MessagingPlanNamespaceListerExpansion allows custom methods to be added to +// MessagingPlanNamespaceLister. +type MessagingPlanNamespaceListerExpansion interface{} + // MessagingTenantListerExpansion allows custom methods to be added to // MessagingTenantLister. type MessagingTenantListerExpansion interface{} diff --git a/pkg/client/listers/enmasse/v1beta2/messagingaddressplan.go b/pkg/client/listers/enmasse/v1beta2/messagingaddressplan.go new file mode 100644 index 00000000000..392d98dd64f --- /dev/null +++ b/pkg/client/listers/enmasse/v1beta2/messagingaddressplan.go @@ -0,0 +1,83 @@ +/* + * Copyright 2018-2019, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MessagingAddressPlanLister helps list MessagingAddressPlans. +type MessagingAddressPlanLister interface { + // List lists all MessagingAddressPlans in the indexer. + List(selector labels.Selector) (ret []*v1beta2.MessagingAddressPlan, err error) + // MessagingAddressPlans returns an object that can list and get MessagingAddressPlans. + MessagingAddressPlans(namespace string) MessagingAddressPlanNamespaceLister + MessagingAddressPlanListerExpansion +} + +// messagingAddressPlanLister implements the MessagingAddressPlanLister interface. +type messagingAddressPlanLister struct { + indexer cache.Indexer +} + +// NewMessagingAddressPlanLister returns a new MessagingAddressPlanLister. +func NewMessagingAddressPlanLister(indexer cache.Indexer) MessagingAddressPlanLister { + return &messagingAddressPlanLister{indexer: indexer} +} + +// List lists all MessagingAddressPlans in the indexer. +func (s *messagingAddressPlanLister) List(selector labels.Selector) (ret []*v1beta2.MessagingAddressPlan, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.MessagingAddressPlan)) + }) + return ret, err +} + +// MessagingAddressPlans returns an object that can list and get MessagingAddressPlans. +func (s *messagingAddressPlanLister) MessagingAddressPlans(namespace string) MessagingAddressPlanNamespaceLister { + return messagingAddressPlanNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MessagingAddressPlanNamespaceLister helps list and get MessagingAddressPlans. +type MessagingAddressPlanNamespaceLister interface { + // List lists all MessagingAddressPlans in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1beta2.MessagingAddressPlan, err error) + // Get retrieves the MessagingAddressPlan from the indexer for a given namespace and name. + Get(name string) (*v1beta2.MessagingAddressPlan, error) + MessagingAddressPlanNamespaceListerExpansion +} + +// messagingAddressPlanNamespaceLister implements the MessagingAddressPlanNamespaceLister +// interface. +type messagingAddressPlanNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MessagingAddressPlans in the indexer for a given namespace. +func (s messagingAddressPlanNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.MessagingAddressPlan, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.MessagingAddressPlan)) + }) + return ret, err +} + +// Get retrieves the MessagingAddressPlan from the indexer for a given namespace and name. +func (s messagingAddressPlanNamespaceLister) Get(name string) (*v1beta2.MessagingAddressPlan, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("messagingaddressplan"), name) + } + return obj.(*v1beta2.MessagingAddressPlan), nil +} diff --git a/pkg/client/listers/enmasse/v1beta2/messagingplan.go b/pkg/client/listers/enmasse/v1beta2/messagingplan.go new file mode 100644 index 00000000000..cf4de74eea6 --- /dev/null +++ b/pkg/client/listers/enmasse/v1beta2/messagingplan.go @@ -0,0 +1,83 @@ +/* + * Copyright 2018-2019, EnMasse authors. + * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). + */ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MessagingPlanLister helps list MessagingPlans. +type MessagingPlanLister interface { + // List lists all MessagingPlans in the indexer. + List(selector labels.Selector) (ret []*v1beta2.MessagingPlan, err error) + // MessagingPlans returns an object that can list and get MessagingPlans. + MessagingPlans(namespace string) MessagingPlanNamespaceLister + MessagingPlanListerExpansion +} + +// messagingPlanLister implements the MessagingPlanLister interface. +type messagingPlanLister struct { + indexer cache.Indexer +} + +// NewMessagingPlanLister returns a new MessagingPlanLister. +func NewMessagingPlanLister(indexer cache.Indexer) MessagingPlanLister { + return &messagingPlanLister{indexer: indexer} +} + +// List lists all MessagingPlans in the indexer. +func (s *messagingPlanLister) List(selector labels.Selector) (ret []*v1beta2.MessagingPlan, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.MessagingPlan)) + }) + return ret, err +} + +// MessagingPlans returns an object that can list and get MessagingPlans. +func (s *messagingPlanLister) MessagingPlans(namespace string) MessagingPlanNamespaceLister { + return messagingPlanNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MessagingPlanNamespaceLister helps list and get MessagingPlans. +type MessagingPlanNamespaceLister interface { + // List lists all MessagingPlans in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1beta2.MessagingPlan, err error) + // Get retrieves the MessagingPlan from the indexer for a given namespace and name. + Get(name string) (*v1beta2.MessagingPlan, error) + MessagingPlanNamespaceListerExpansion +} + +// messagingPlanNamespaceLister implements the MessagingPlanNamespaceLister +// interface. +type messagingPlanNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MessagingPlans in the indexer for a given namespace. +func (s messagingPlanNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.MessagingPlan, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.MessagingPlan)) + }) + return ret, err +} + +// Get retrieves the MessagingPlan from the indexer for a given namespace and name. +func (s messagingPlanNamespaceLister) Get(name string) (*v1beta2.MessagingPlan, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("messagingplan"), name) + } + return obj.(*v1beta2.MessagingPlan), nil +} diff --git a/templates/shared-infra/enmasse.io_messagingaddressplans.yaml b/templates/shared-infra/enmasse.io_messagingaddressplans.yaml new file mode 100644 index 00000000000..e57fcd9cabd --- /dev/null +++ b/templates/shared-infra/enmasse.io_messagingaddressplans.yaml @@ -0,0 +1,93 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.3.0 + creationTimestamp: null + name: messagingaddressplans.enmasse.io +spec: + additionalPrinterColumns: + - JSONPath: .status.phase + description: The current phase. + name: Phase + type: string + - JSONPath: .status.message + description: Message describing the reason for the current Phase. + name: Message + priority: 1 + type: string + - JSONPath: .metadata.creationTimestamp + name: Age + type: date + group: enmasse.io + names: + categories: + - enmasse + kind: MessagingAddressPlan + listKind: MessagingAddressPlanList + plural: messagingaddressplans + shortNames: + - msgp + - msgplan + - msgplans + singular: messagingaddressplan + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + type: object + status: + properties: + conditions: + items: + properties: + lastTransitionTime: + format: date-time + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + type: array + message: + type: string + phase: + type: string + type: object + type: object + version: v1beta2 + versions: + - name: v1beta2 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/templates/shared-infra/enmasse.io_messagingplans.yaml b/templates/shared-infra/enmasse.io_messagingplans.yaml new file mode 100644 index 00000000000..404c193e64a --- /dev/null +++ b/templates/shared-infra/enmasse.io_messagingplans.yaml @@ -0,0 +1,93 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.3.0 + creationTimestamp: null + name: messagingplans.enmasse.io +spec: + additionalPrinterColumns: + - JSONPath: .status.phase + description: The current phase. + name: Phase + type: string + - JSONPath: .status.message + description: Message describing the reason for the current Phase. + name: Message + priority: 1 + type: string + - JSONPath: .metadata.creationTimestamp + name: Age + type: date + group: enmasse.io + names: + categories: + - enmasse + kind: MessagingPlan + listKind: MessagingPlanList + plural: messagingplans + shortNames: + - msgp + - msgplan + - msgplans + singular: messagingplan + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + type: object + status: + properties: + conditions: + items: + properties: + lastTransitionTime: + format: date-time + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + type: array + message: + type: string + phase: + type: string + type: object + type: object + version: v1beta2 + versions: + - name: v1beta2 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: []