Unverified Commit 884df0e0 authored by rithu leena john's avatar rithu leena john Committed by GitHub
Browse files

k8s: add list events API (#1647)

parent 53496b83
Showing with 2392 additions and 606 deletions
+2392 -606
......@@ -227,6 +227,14 @@ service K8sAPI {
};
option (clutch.api.v1.action).type = READ;
}
rpc ListEvents(ListEventsRequest) returns (ListEventsResponse) {
option (google.api.http) = {
post : "/v1/k8s/listEvents"
body : "*"
};
option (clutch.api.v1.action).type = READ;
}
}
message DescribePodRequest {
......@@ -1055,6 +1063,54 @@ message DescribeNamespaceResponse {
Namespace namespace = 1 [ (clutch.api.v1.log) = false ];
}
// ObjectKind represent a persistent entity in the system
// For now we only support the kind Pod, we can expand on this
// list as we add support for different kinds.
enum ObjectKind {
UNSPECIFIED = 0;
UNKNOWN = 1;
POD = 2;
}
// this represents a Kubernetes event: https://pkg.go.dev/k8s.io/api/core/v1#Event
// for a given object
message Event {
string name = 1;
string reason = 2;
string description = 3;
// these values represent info of the object
// this event is about
string cluster = 4;
string namespace = 5;
// name of the object i.e pod name, deployment name, etc
string involved_object_name = 6;
// kind of the object e.g pod, deployment, service, etc
ObjectKind kind = 7;
}
message ListEventsRequest {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.k8s.v1.Namespace",
// requests for all events associated with a given object
pattern : "{cluster}/{namespace}/{object_name}"
};
string clientset = 1 [ (validate.rules).string = {min_bytes : 1} ];
string cluster = 2 [ (validate.rules).string = {min_bytes : 1} ];
string namespace = 3 [ (validate.rules).string = {min_bytes : 1} ];
// name of the object i.e pod name, deployment name, etc
string object_name = 4 [ (validate.rules).string = {min_bytes : 1} ];
// kind of the object e.g pod, deployment, service, etc
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds
ObjectKind kind = 5 [ (validate.rules).enum = {defined_only : true} ];
}
message ListEventsResponse {
option (clutch.api.v1.reference).fields = "events";
repeated Event events = 1 [ (clutch.api.v1.log) = false ];
}
// This message type is used to add support for nullable strings and is an
// alternative to the well-known `StringValue` type. We need it, because the
// grpc-gateway used by Clutch deserializes a null `StringValue` as an empty
......
This diff is collapsed.
......@@ -949,6 +949,40 @@ func local_request_K8SAPI_DescribeNamespace_0(ctx context.Context, marshaler run
}
func request_K8SAPI_ListEvents_0(ctx context.Context, marshaler runtime.Marshaler, client K8SAPIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListEventsRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ListEvents(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_K8SAPI_ListEvents_0(ctx context.Context, marshaler runtime.Marshaler, server K8SAPIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListEventsRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ListEvents(ctx, &protoReq)
return msg, metadata, err
}
// RegisterK8SAPIHandlerServer registers the http handlers for service K8SAPI to "mux".
// UnaryRPC :call K8SAPIServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
......@@ -1576,6 +1610,29 @@ func RegisterK8SAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser
})
mux.Handle("POST", pattern_K8SAPI_ListEvents_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/clutch.k8s.v1.K8SAPI/ListEvents", runtime.WithHTTPPathPattern("/v1/k8s/listEvents"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_K8SAPI_ListEvents_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_K8SAPI_ListEvents_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
......@@ -2157,6 +2214,26 @@ func RegisterK8SAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli
})
mux.Handle("POST", pattern_K8SAPI_ListEvents_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/clutch.k8s.v1.K8SAPI/ListEvents", runtime.WithHTTPPathPattern("/v1/k8s/listEvents"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_K8SAPI_ListEvents_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_K8SAPI_ListEvents_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
......@@ -2214,6 +2291,8 @@ var (
pattern_K8SAPI_CreateJob_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "k8s", "createJob"}, ""))
pattern_K8SAPI_DescribeNamespace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "k8s", "describeNamespace"}, ""))
pattern_K8SAPI_ListEvents_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "k8s", "listEvents"}, ""))
)
var (
......@@ -2270,4 +2349,6 @@ var (
forward_K8SAPI_CreateJob_0 = runtime.ForwardResponseMessage
forward_K8SAPI_DescribeNamespace_0 = runtime.ForwardResponseMessage
forward_K8SAPI_ListEvents_0 = runtime.ForwardResponseMessage
)
......@@ -6059,6 +6059,268 @@ var _ interface {
ErrorName() string
} = DescribeNamespaceResponseValidationError{}
// Validate checks the field values on Event with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned.
func (m *Event) Validate() error {
if m == nil {
return nil
}
// no validation rules for Name
// no validation rules for Reason
// no validation rules for Description
// no validation rules for Cluster
// no validation rules for Namespace
// no validation rules for InvolvedObjectName
// no validation rules for Kind
return nil
}
// EventValidationError is the validation error returned by Event.Validate if
// the designated constraints aren't met.
type EventValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e EventValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e EventValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e EventValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e EventValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e EventValidationError) ErrorName() string { return "EventValidationError" }
// Error satisfies the builtin error interface
func (e EventValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sEvent.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = EventValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = EventValidationError{}
// Validate checks the field values on ListEventsRequest with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *ListEventsRequest) Validate() error {
if m == nil {
return nil
}
if len(m.GetClientset()) < 1 {
return ListEventsRequestValidationError{
field: "Clientset",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetCluster()) < 1 {
return ListEventsRequestValidationError{
field: "Cluster",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetNamespace()) < 1 {
return ListEventsRequestValidationError{
field: "Namespace",
reason: "value length must be at least 1 bytes",
}
}
if len(m.GetObjectName()) < 1 {
return ListEventsRequestValidationError{
field: "ObjectName",
reason: "value length must be at least 1 bytes",
}
}
if _, ok := ObjectKind_name[int32(m.GetKind())]; !ok {
return ListEventsRequestValidationError{
field: "Kind",
reason: "value must be one of the defined enum values",
}
}
return nil
}
// ListEventsRequestValidationError is the validation error returned by
// ListEventsRequest.Validate if the designated constraints aren't met.
type ListEventsRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListEventsRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListEventsRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListEventsRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListEventsRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListEventsRequestValidationError) ErrorName() string {
return "ListEventsRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ListEventsRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sListEventsRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListEventsRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListEventsRequestValidationError{}
// Validate checks the field values on ListEventsResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, an error is returned.
func (m *ListEventsResponse) Validate() error {
if m == nil {
return nil
}
for idx, item := range m.GetEvents() {
_, _ = idx, item
if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListEventsResponseValidationError{
field: fmt.Sprintf("Events[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
return nil
}
// ListEventsResponseValidationError is the validation error returned by
// ListEventsResponse.Validate if the designated constraints aren't met.
type ListEventsResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListEventsResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListEventsResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListEventsResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListEventsResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListEventsResponseValidationError) ErrorName() string {
return "ListEventsResponseValidationError"
}
// Error satisfies the builtin error interface
func (e ListEventsResponseValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sListEventsResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListEventsResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListEventsResponseValidationError{}
// Validate checks the field values on NullableString with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned.
......
......@@ -45,6 +45,7 @@ type K8SAPIClient interface {
DeleteJob(ctx context.Context, in *DeleteJobRequest, opts ...grpc.CallOption) (*DeleteJobResponse, error)
CreateJob(ctx context.Context, in *CreateJobRequest, opts ...grpc.CallOption) (*CreateJobResponse, error)
DescribeNamespace(ctx context.Context, in *DescribeNamespaceRequest, opts ...grpc.CallOption) (*DescribeNamespaceResponse, error)
ListEvents(ctx context.Context, in *ListEventsRequest, opts ...grpc.CallOption) (*ListEventsResponse, error)
}
type k8SAPIClient struct {
......@@ -298,6 +299,15 @@ func (c *k8SAPIClient) DescribeNamespace(ctx context.Context, in *DescribeNamesp
return out, nil
}
func (c *k8SAPIClient) ListEvents(ctx context.Context, in *ListEventsRequest, opts ...grpc.CallOption) (*ListEventsResponse, error) {
out := new(ListEventsResponse)
err := c.cc.Invoke(ctx, "/clutch.k8s.v1.K8sAPI/ListEvents", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// K8SAPIServer is the server API for K8SAPI service.
// All implementations should embed UnimplementedK8SAPIServer
// for forward compatibility
......@@ -329,6 +339,7 @@ type K8SAPIServer interface {
DeleteJob(context.Context, *DeleteJobRequest) (*DeleteJobResponse, error)
CreateJob(context.Context, *CreateJobRequest) (*CreateJobResponse, error)
DescribeNamespace(context.Context, *DescribeNamespaceRequest) (*DescribeNamespaceResponse, error)
ListEvents(context.Context, *ListEventsRequest) (*ListEventsResponse, error)
}
// UnimplementedK8SAPIServer should be embedded to have forward compatible implementations.
......@@ -416,6 +427,9 @@ func (UnimplementedK8SAPIServer) CreateJob(context.Context, *CreateJobRequest) (
func (UnimplementedK8SAPIServer) DescribeNamespace(context.Context, *DescribeNamespaceRequest) (*DescribeNamespaceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DescribeNamespace not implemented")
}
func (UnimplementedK8SAPIServer) ListEvents(context.Context, *ListEventsRequest) (*ListEventsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListEvents not implemented")
}
// UnsafeK8SAPIServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to K8SAPIServer will
......@@ -914,6 +928,24 @@ func _K8SAPI_DescribeNamespace_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _K8SAPI_ListEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListEventsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(K8SAPIServer).ListEvents(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/clutch.k8s.v1.K8sAPI/ListEvents",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(K8SAPIServer).ListEvents(ctx, req.(*ListEventsRequest))
}
return interceptor(ctx, in, info, handler)
}
// K8SAPI_ServiceDesc is the grpc.ServiceDesc for K8SAPI service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
......@@ -1029,6 +1061,10 @@ var K8SAPI_ServiceDesc = grpc.ServiceDesc{
MethodName: "DescribeNamespace",
Handler: _K8SAPI_DescribeNamespace_Handler,
},
{
MethodName: "ListEvents",
Handler: _K8SAPI_ListEvents_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "k8s/v1/k8s.proto",
......
......@@ -325,6 +325,20 @@ func (s *svc) DescribeNamespace(_ context.Context, clientset, cluster, name stri
}, nil
}
func (s *svc) ListEvents(_ context.Context, clientset, cluster, namespace, name string, kind k8sv1.ObjectKind) ([]*k8sv1.Event, error) {
return []*k8sv1.Event{
&k8sv1.Event{
Name: "event1",
Reason: "reason-1",
Description: "description-1",
Cluster: "fake-cluster-name",
Namespace: namespace,
InvolvedObjectName: "pod1",
Kind: kind,
},
}, nil
}
func (*svc) Clientsets(ctx context.Context) ([]string, error) {
return []string{"fake-user@fake-cluster"}, nil
}
......
package k8s
import (
"context"
k8sapiv1 "github.com/lyft/clutch/backend/api/k8s/v1"
)
func (a *k8sAPI) ListEvents(ctx context.Context, req *k8sapiv1.ListEventsRequest) (*k8sapiv1.ListEventsResponse, error) {
events, err := a.k8s.ListEvents(ctx, req.Clientset, req.Cluster, req.Namespace, req.ObjectName, req.Kind)
if err != nil {
return nil, err
}
return &k8sapiv1.ListEventsResponse{Events: events}, nil
}
package k8s
import (
"context"
"strings"
"github.com/iancoleman/strcase"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8sapiv1 "github.com/lyft/clutch/backend/api/k8s/v1"
)
func (s *svc) ListEvents(ctx context.Context, clientset, cluster, namespace, object string, kind k8sapiv1.ObjectKind) ([]*k8sapiv1.Event, error) {
cs, err := s.manager.GetK8sClientset(ctx, clientset, cluster, namespace)
if err != nil {
return nil, err
}
objKind := strcase.ToCamel(strings.ToLower(kind.String()))
// returns the appropriate field selector based on the object involved
fieldSelector := cs.CoreV1().Events(cs.Namespace()).GetFieldSelector(&object, &namespace, &objKind, nil)
eventList, err := cs.CoreV1().Events(cs.Namespace()).List(ctx, metav1.ListOptions{FieldSelector: fieldSelector.String()})
if err != nil {
return nil, err
}
var events []*k8sapiv1.Event
for i := range eventList.Items {
events = append(events, ProtoForEvent(cs.Cluster(), &eventList.Items[i]))
}
return events, nil
}
func ProtoForEvent(cluster string, k8sEvent *corev1.Event) *k8sapiv1.Event {
clusterName := k8sEvent.ClusterName
if clusterName == "" {
clusterName = cluster
}
return &k8sapiv1.Event{
Cluster: clusterName,
Namespace: k8sEvent.Namespace,
Name: k8sEvent.Name,
Reason: k8sEvent.Reason,
Description: k8sEvent.Message,
InvolvedObjectName: k8sEvent.InvolvedObject.Name,
Kind: protoForObjectKind(k8sEvent.InvolvedObject.Kind),
}
}
func protoForObjectKind(kind string) k8sapiv1.ObjectKind {
// Look up value in generated enum map after ensuring consistent case with generated code.
val, ok := k8sapiv1.ObjectKind_value[strcase.ToScreamingSnake(kind)]
if !ok {
return k8sapiv1.ObjectKind_UNKNOWN
}
return k8sapiv1.ObjectKind(val)
}
package k8s
import (
"context"
"fmt"
"strings"
"testing"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
k8s "k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/fake"
k8sapiv1 "github.com/lyft/clutch/backend/api/k8s/v1"
)
func testEventClientset() k8s.Interface {
testEvents := []runtime.Object{
&corev1.Event{
ObjectMeta: metav1.ObjectMeta{
Name: "testing-event-name-1",
Namespace: "testing-namespace",
},
InvolvedObject: corev1.ObjectReference{
Kind: "Pod",
Namespace: "testing-namespace",
Name: "Pod1",
},
Reason: "testing-reason-1",
Message: "testing-message-1",
},
&corev1.Event{
ObjectMeta: metav1.ObjectMeta{
Name: "testing-event-name-2",
Namespace: "testing-namespace",
},
InvolvedObject: corev1.ObjectReference{
Kind: "Pod",
Namespace: "testing-namespace",
Name: "Pod1",
},
Reason: "testing-reason-2",
Message: "testing-message-2",
},
}
return fake.NewSimpleClientset(testEvents...)
}
func TestListEvents(t *testing.T) {
cs := testEventClientset()
s := &svc{
manager: &managerImpl{
clientsets: map[string]*ctxClientsetImpl{"foo": &ctxClientsetImpl{
Interface: cs,
namespace: "default",
cluster: "core-testing",
}},
},
}
val, ok := k8sapiv1.ObjectKind_value[strings.ToUpper("Pod")]
assert.Equal(t, true, ok)
kind := k8sapiv1.ObjectKind(val)
list, err := s.ListEvents(context.Background(), "foo", "core-testing", "testing-namespace", "Pod1", kind)
assert.NoError(t, err)
assert.Equal(t, 2, len(list))
for i, v := range list {
reason := fmt.Sprintf("testing-reason-%d", i+1)
assert.Equal(t, reason, v.Reason)
assert.Equal(t, kind, v.Kind)
}
}
......@@ -98,6 +98,9 @@ type Service interface {
// Namespace management functions.
DescribeNamespace(ctx context.Context, clientset, cluster, name string) (*k8sapiv1.Namespace, error)
// Event management functions.
ListEvents(ctx context.Context, clientset, cluster, namespace, object string, kind k8sapiv1.ObjectKind) ([]*k8sapiv1.Event, error)
}
type svc struct {
......
......@@ -12271,6 +12271,20 @@ export namespace clutch {
* @returns Promise
*/
public describeNamespace(request: clutch.k8s.v1.IDescribeNamespaceRequest): Promise<clutch.k8s.v1.DescribeNamespaceResponse>;
/**
* Calls ListEvents.
* @param request ListEventsRequest message or plain object
* @param callback Node-style callback called with the error, if any, and ListEventsResponse
*/
public listEvents(request: clutch.k8s.v1.IListEventsRequest, callback: clutch.k8s.v1.K8sAPI.ListEventsCallback): void;
/**
* Calls ListEvents.
* @param request ListEventsRequest message or plain object
* @returns Promise
*/
public listEvents(request: clutch.k8s.v1.IListEventsRequest): Promise<clutch.k8s.v1.ListEventsResponse>;
}
 
namespace K8sAPI {
......@@ -12463,6 +12477,13 @@ export namespace clutch {
* @param [response] DescribeNamespaceResponse
*/
type DescribeNamespaceCallback = (error: (Error|null), response?: clutch.k8s.v1.DescribeNamespaceResponse) => void;
/**
* Callback as used by {@link clutch.k8s.v1.K8sAPI#listEvents}.
* @param error Error, if any
* @param [response] ListEventsResponse
*/
type ListEventsCallback = (error: (Error|null), response?: clutch.k8s.v1.ListEventsResponse) => void;
}
 
/** Properties of a DescribePodRequest. */
......@@ -17247,6 +17268,217 @@ export namespace clutch {
public toJSON(): { [k: string]: any };
}
 
/** ObjectKind enum. */
enum ObjectKind {
UNSPECIFIED = 0,
UNKNOWN = 1,
POD = 2
}
/** Properties of an Event. */
interface IEvent {
/** Event name */
name?: (string|null);
/** Event reason */
reason?: (string|null);
/** Event description */
description?: (string|null);
/** Event cluster */
cluster?: (string|null);
/** Event namespace */
namespace?: (string|null);
/** Event involvedObjectName */
involvedObjectName?: (string|null);
/** Event kind */
kind?: (clutch.k8s.v1.ObjectKind|null);
}
/** Represents an Event. */
class Event implements IEvent {
/**
* Constructs a new Event.
* @param [properties] Properties to set
*/
constructor(properties?: clutch.k8s.v1.IEvent);
/** Event name. */
public name: string;
/** Event reason. */
public reason: string;
/** Event description. */
public description: string;
/** Event cluster. */
public cluster: string;
/** Event namespace. */
public namespace: string;
/** Event involvedObjectName. */
public involvedObjectName: string;
/** Event kind. */
public kind: clutch.k8s.v1.ObjectKind;
/**
* Verifies an Event message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates an Event message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Event
*/
public static fromObject(object: { [k: string]: any }): clutch.k8s.v1.Event;
/**
* Creates a plain object from an Event message. Also converts values to other types if specified.
* @param message Event
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: clutch.k8s.v1.Event, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Event to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
/** Properties of a ListEventsRequest. */
interface IListEventsRequest {
/** ListEventsRequest clientset */
clientset?: (string|null);
/** ListEventsRequest cluster */
cluster?: (string|null);
/** ListEventsRequest namespace */
namespace?: (string|null);
/** ListEventsRequest objectName */
objectName?: (string|null);
/** ListEventsRequest kind */
kind?: (clutch.k8s.v1.ObjectKind|null);
}
/** Represents a ListEventsRequest. */
class ListEventsRequest implements IListEventsRequest {
/**
* Constructs a new ListEventsRequest.
* @param [properties] Properties to set
*/
constructor(properties?: clutch.k8s.v1.IListEventsRequest);
/** ListEventsRequest clientset. */
public clientset: string;
/** ListEventsRequest cluster. */
public cluster: string;
/** ListEventsRequest namespace. */
public namespace: string;
/** ListEventsRequest objectName. */
public objectName: string;
/** ListEventsRequest kind. */
public kind: clutch.k8s.v1.ObjectKind;
/**
* Verifies a ListEventsRequest message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a ListEventsRequest message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns ListEventsRequest
*/
public static fromObject(object: { [k: string]: any }): clutch.k8s.v1.ListEventsRequest;
/**
* Creates a plain object from a ListEventsRequest message. Also converts values to other types if specified.
* @param message ListEventsRequest
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: clutch.k8s.v1.ListEventsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this ListEventsRequest to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
/** Properties of a ListEventsResponse. */
interface IListEventsResponse {
/** ListEventsResponse events */
events?: (clutch.k8s.v1.IEvent[]|null);
}
/** Represents a ListEventsResponse. */
class ListEventsResponse implements IListEventsResponse {
/**
* Constructs a new ListEventsResponse.
* @param [properties] Properties to set
*/
constructor(properties?: clutch.k8s.v1.IListEventsResponse);
/** ListEventsResponse events. */
public events: clutch.k8s.v1.IEvent[];
/**
* Verifies a ListEventsResponse message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a ListEventsResponse message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns ListEventsResponse
*/
public static fromObject(object: { [k: string]: any }): clutch.k8s.v1.ListEventsResponse;
/**
* Creates a plain object from a ListEventsResponse message. Also converts values to other types if specified.
* @param message ListEventsResponse
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: clutch.k8s.v1.ListEventsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this ListEventsResponse to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
/** Properties of a NullableString. */
interface INullableString {
 
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment