You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/02/18 17:36:20 UTC

[camel-k] branch master updated: chore(api): Add Scale methods to the Integration generated client API

This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f4daeb  chore(api): Add Scale methods to the Integration generated client API
6f4daeb is described below

commit 6f4daeb87e7455586484847bf38c3896ae02da2a
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Feb 18 17:09:56 2021 +0100

    chore(api): Add Scale methods to the Integration generated client API
---
 pkg/apis/camel/v1/integration_types.go             |  2 ++
 .../typed/camel/v1/fake/fake_integration.go        | 23 +++++++++++++++
 .../versioned/typed/camel/v1/integration.go        | 33 ++++++++++++++++++++++
 3 files changed, 58 insertions(+)

diff --git a/pkg/apis/camel/v1/integration_types.go b/pkg/apis/camel/v1/integration_types.go
index 52a5853..678d0e6 100644
--- a/pkg/apis/camel/v1/integration_types.go
+++ b/pkg/apis/camel/v1/integration_types.go
@@ -65,6 +65,8 @@ type IntegrationStatus struct {
 }
 
 // +genclient
+// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
+// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
 // +kubebuilder:object:root=true
 // +kubebuilder:resource:path=integrations,scope=Namespaced,shortName=it,categories=kamel;camel
 // +kubebuilder:subresource:status
diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go
index d059544..7a976f6 100644
--- a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go
+++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go
@@ -23,6 +23,7 @@ import (
 	"context"
 
 	camelv1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+	autoscalingv1 "k8s.io/api/autoscaling/v1"
 	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	labels "k8s.io/apimachinery/pkg/labels"
 	schema "k8s.io/apimachinery/pkg/runtime/schema"
@@ -141,3 +142,25 @@ func (c *FakeIntegrations) Patch(ctx context.Context, name string, pt types.Patc
 	}
 	return obj.(*camelv1.Integration), err
 }
+
+// GetScale takes name of the integration, and returns the corresponding scale object, and an error if there is any.
+func (c *FakeIntegrations) GetScale(ctx context.Context, integrationName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
+	obj, err := c.Fake.
+		Invokes(testing.NewGetSubresourceAction(integrationsResource, c.ns, "scale", integrationName), &autoscalingv1.Scale{})
+
+	if obj == nil {
+		return nil, err
+	}
+	return obj.(*autoscalingv1.Scale), err
+}
+
+// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
+func (c *FakeIntegrations) UpdateScale(ctx context.Context, integrationName string, scale *autoscalingv1.Scale, opts v1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
+	obj, err := c.Fake.
+		Invokes(testing.NewUpdateSubresourceAction(integrationsResource, "scale", c.ns, scale), &autoscalingv1.Scale{})
+
+	if obj == nil {
+		return nil, err
+	}
+	return obj.(*autoscalingv1.Scale), err
+}
diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/integration.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/integration.go
index 01e6a9d..47b7d98 100644
--- a/pkg/client/camel/clientset/versioned/typed/camel/v1/integration.go
+++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/integration.go
@@ -25,6 +25,7 @@ import (
 
 	v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
 	scheme "github.com/apache/camel-k/pkg/client/camel/clientset/versioned/scheme"
+	autoscalingv1 "k8s.io/api/autoscaling/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	types "k8s.io/apimachinery/pkg/types"
 	watch "k8s.io/apimachinery/pkg/watch"
@@ -48,6 +49,9 @@ type IntegrationInterface interface {
 	List(ctx context.Context, opts metav1.ListOptions) (*v1.IntegrationList, error)
 	Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
 	Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Integration, err error)
+	GetScale(ctx context.Context, integrationName string, options metav1.GetOptions) (*autoscalingv1.Scale, error)
+	UpdateScale(ctx context.Context, integrationName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error)
+
 	IntegrationExpansion
 }
 
@@ -194,3 +198,32 @@ func (c *integrations) Patch(ctx context.Context, name string, pt types.PatchTyp
 		Into(result)
 	return
 }
+
+// GetScale takes name of the integration, and returns the corresponding autoscalingv1.Scale object, and an error if there is any.
+func (c *integrations) GetScale(ctx context.Context, integrationName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
+	result = &autoscalingv1.Scale{}
+	err = c.client.Get().
+		Namespace(c.ns).
+		Resource("integrations").
+		Name(integrationName).
+		SubResource("scale").
+		VersionedParams(&options, scheme.ParameterCodec).
+		Do(ctx).
+		Into(result)
+	return
+}
+
+// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
+func (c *integrations) UpdateScale(ctx context.Context, integrationName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
+	result = &autoscalingv1.Scale{}
+	err = c.client.Put().
+		Namespace(c.ns).
+		Resource("integrations").
+		Name(integrationName).
+		SubResource("scale").
+		VersionedParams(&opts, scheme.ParameterCodec).
+		Body(scale).
+		Do(ctx).
+		Into(result)
+	return
+}