Skip to content

Commit

Permalink
rename WatchStage to WatchStages
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
  • Loading branch information
alexmt committed Aug 17, 2023
1 parent e533775 commit 3e19c25
Show file tree
Hide file tree
Showing 8 changed files with 404 additions and 403 deletions.
6 changes: 3 additions & 3 deletions api/service/v1alpha1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ service KargoService {
rpc CreateStage(CreateStageRequest) returns (CreateStageResponse);
rpc ListStages(ListStagesRequest) returns (ListStagesResponse);
rpc GetStage(GetStageRequest) returns (GetStageResponse);
rpc WatchStage(WatchStageRequest) returns (stream WatchStageResponse);
rpc WatchStages(WatchStagesRequest) returns (stream WatchStagesResponse);
rpc UpdateStage(UpdateStageRequest) returns (UpdateStageResponse);
rpc DeleteStage(DeleteStageRequest) returns (DeleteStageResponse);
rpc PromoteStage(PromoteStageRequest) returns (PromoteStageResponse);
Expand Down Expand Up @@ -116,12 +116,12 @@ message GetStageResponse {
github.com.akuity.kargo.pkg.api.v1alpha1.Stage stage = 1;
}

message WatchStageRequest {
message WatchStagesRequest {
string project = 1;
string name = 2;
}

message WatchStageResponse {
message WatchStagesResponse {
github.com.akuity.kargo.pkg.api.v1alpha1.Stage stage = 1;
string type = 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (

type WatchStageV1Alpha1Func func(
context.Context,
*connect.Request[svcv1alpha1.WatchStageRequest],
*connect.ServerStream[svcv1alpha1.WatchStageResponse],
*connect.Request[svcv1alpha1.WatchStagesRequest],
*connect.ServerStream[svcv1alpha1.WatchStagesResponse],
) error

func WatchStageV1Alpha1(
Expand All @@ -32,8 +32,8 @@ func WatchStageV1Alpha1(
stageCli := dynamicCli.Resource(kargov1alpha1.GroupVersion.WithResource("stages"))
return func(
ctx context.Context,
req *connect.Request[svcv1alpha1.WatchStageRequest],
stream *connect.ServerStream[svcv1alpha1.WatchStageResponse],
req *connect.Request[svcv1alpha1.WatchStagesRequest],
stream *connect.ServerStream[svcv1alpha1.WatchStagesResponse],

Check warning on line 36 in internal/api/handler/watch_stages_v1alpha1.go

View check run for this annotation

Codecov / codecov/patch

internal/api/handler/watch_stages_v1alpha1.go#L35-L36

Added lines #L35 - L36 were not covered by tests
) error {
if req.Msg.GetProject() == "" {
return connect.NewError(connect.CodeInvalidArgument, errors.New("project should not be empty"))
Expand Down Expand Up @@ -79,7 +79,7 @@ func WatchStageV1Alpha1(
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(u.Object, &stage); err != nil {
return errors.Wrap(err, "from unstructured")
}
if err := stream.Send(&svcv1alpha1.WatchStageResponse{
if err := stream.Send(&svcv1alpha1.WatchStagesResponse{

Check warning on line 82 in internal/api/handler/watch_stages_v1alpha1.go

View check run for this annotation

Codecov / codecov/patch

internal/api/handler/watch_stages_v1alpha1.go#L82

Added line #L82 was not covered by tests
Stage: typesv1alpha1.ToStageProto(*stage),
Type: string(e.Type),

Check warning on line 84 in internal/api/handler/watch_stages_v1alpha1.go

View check run for this annotation

Codecov / codecov/patch

internal/api/handler/watch_stages_v1alpha1.go#L84

Added line #L84 was not covered by tests
}); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions internal/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ func (s *server) GetStage(
return handler.GetStageV1Alpha1(s.kubeCli)(ctx, req)
}

func (s *server) WatchStage(
func (s *server) WatchStages(
ctx context.Context,
req *connect.Request[svcv1alpha1.WatchStageRequest],
stream *connect.ServerStream[svcv1alpha1.WatchStageResponse],
req *connect.Request[svcv1alpha1.WatchStagesRequest],
stream *connect.ServerStream[svcv1alpha1.WatchStagesResponse],
) error {
return handler.WatchStageV1Alpha1(s.kubeCli, s.dynamicCli)(ctx, req, stream)
}
Expand Down
688 changes: 344 additions & 344 deletions pkg/api/service/v1alpha1/service.pb.go

Large diffs are not rendered by default.

35 changes: 18 additions & 17 deletions pkg/api/service/v1alpha1/svcv1alpha1connect/service.connect.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const ProjectDetails = () => {
const watchStages = async () => {
const transport = createConnectTransport({ baseUrl: '' });
const promiseClient = createPromiseClient(KargoService, transport);
const stream = promiseClient.watchStage(
const stream = promiseClient.watchStages(
{ project: 'kargo-demo', name: 'test' },
{ signal: cancel.signal }
);
Expand Down
12 changes: 6 additions & 6 deletions ui/src/gen/service/v1alpha1/service_connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint-disable */
// @ts-nocheck

import { AdminLoginRequest, AdminLoginResponse, CreateProjectRequest, CreateProjectResponse, CreatePromotionPolicyRequest, CreatePromotionPolicyResponse, CreateStageRequest, CreateStageResponse, DeleteProjectRequest, DeleteProjectResponse, DeletePromotionPolicyRequest, DeletePromotionPolicyResponse, DeleteStageRequest, DeleteStageResponse, GetPromotionPolicyRequest, GetPromotionPolicyResponse, GetPublicConfigRequest, GetPublicConfigResponse, GetStageRequest, GetStageResponse, GetVersionInfoRequest, GetVersionInfoResponse, ListProjectsRequest, ListProjectsResponse, ListPromotionPoliciesRequest, ListPromotionPoliciesResponse, ListStagesRequest, ListStagesResponse, PromoteStageRequest, PromoteStageResponse, SetAutoPromotionForStageRequest, SetAutoPromotionForStageResponse, UpdatePromotionPolicyRequest, UpdatePromotionPolicyResponse, UpdateStageRequest, UpdateStageResponse, WatchStageRequest, WatchStageResponse } from "./service_pb.js";
import { AdminLoginRequest, AdminLoginResponse, CreateProjectRequest, CreateProjectResponse, CreatePromotionPolicyRequest, CreatePromotionPolicyResponse, CreateStageRequest, CreateStageResponse, DeleteProjectRequest, DeleteProjectResponse, DeletePromotionPolicyRequest, DeletePromotionPolicyResponse, DeleteStageRequest, DeleteStageResponse, GetPromotionPolicyRequest, GetPromotionPolicyResponse, GetPublicConfigRequest, GetPublicConfigResponse, GetStageRequest, GetStageResponse, GetVersionInfoRequest, GetVersionInfoResponse, ListProjectsRequest, ListProjectsResponse, ListPromotionPoliciesRequest, ListPromotionPoliciesResponse, ListStagesRequest, ListStagesResponse, PromoteStageRequest, PromoteStageResponse, SetAutoPromotionForStageRequest, SetAutoPromotionForStageResponse, UpdatePromotionPolicyRequest, UpdatePromotionPolicyResponse, UpdateStageRequest, UpdateStageResponse, WatchStagesRequest, WatchStagesResponse } from "./service_pb.js";
import { MethodKind } from "@bufbuild/protobuf";

/**
Expand Down Expand Up @@ -67,12 +67,12 @@ export const KargoService = {
kind: MethodKind.Unary,
},
/**
* @generated from rpc akuity.io.kargo.service.v1alpha1.KargoService.WatchStage
* @generated from rpc akuity.io.kargo.service.v1alpha1.KargoService.WatchStages
*/
watchStage: {
name: "WatchStage",
I: WatchStageRequest,
O: WatchStageResponse,
watchStages: {
name: "WatchStages",
I: WatchStagesRequest,
O: WatchStagesResponse,
kind: MethodKind.ServerStreaming,
},
/**
Expand Down
48 changes: 24 additions & 24 deletions ui/src/gen/service/v1alpha1/service_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,9 @@ export class GetStageResponse extends Message<GetStageResponse> {
}

/**
* @generated from message akuity.io.kargo.service.v1alpha1.WatchStageRequest
* @generated from message akuity.io.kargo.service.v1alpha1.WatchStagesRequest
*/
export class WatchStageRequest extends Message<WatchStageRequest> {
export class WatchStagesRequest extends Message<WatchStagesRequest> {
/**
* @generated from field: string project = 1;
*/
Expand All @@ -692,39 +692,39 @@ export class WatchStageRequest extends Message<WatchStageRequest> {
*/
name = "";

constructor(data?: PartialMessage<WatchStageRequest>) {
constructor(data?: PartialMessage<WatchStagesRequest>) {
super();
proto3.util.initPartial(data, this);
}

static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "akuity.io.kargo.service.v1alpha1.WatchStageRequest";
static readonly typeName = "akuity.io.kargo.service.v1alpha1.WatchStagesRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "project", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WatchStageRequest {
return new WatchStageRequest().fromBinary(bytes, options);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WatchStagesRequest {
return new WatchStagesRequest().fromBinary(bytes, options);
}

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WatchStageRequest {
return new WatchStageRequest().fromJson(jsonValue, options);
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WatchStagesRequest {
return new WatchStagesRequest().fromJson(jsonValue, options);
}

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WatchStageRequest {
return new WatchStageRequest().fromJsonString(jsonString, options);
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WatchStagesRequest {
return new WatchStagesRequest().fromJsonString(jsonString, options);
}

static equals(a: WatchStageRequest | PlainMessage<WatchStageRequest> | undefined, b: WatchStageRequest | PlainMessage<WatchStageRequest> | undefined): boolean {
return proto3.util.equals(WatchStageRequest, a, b);
static equals(a: WatchStagesRequest | PlainMessage<WatchStagesRequest> | undefined, b: WatchStagesRequest | PlainMessage<WatchStagesRequest> | undefined): boolean {
return proto3.util.equals(WatchStagesRequest, a, b);
}
}

/**
* @generated from message akuity.io.kargo.service.v1alpha1.WatchStageResponse
* @generated from message akuity.io.kargo.service.v1alpha1.WatchStagesResponse
*/
export class WatchStageResponse extends Message<WatchStageResponse> {
export class WatchStagesResponse extends Message<WatchStagesResponse> {
/**
* @generated from field: github.com.akuity.kargo.pkg.api.v1alpha1.Stage stage = 1;
*/
Expand All @@ -735,32 +735,32 @@ export class WatchStageResponse extends Message<WatchStageResponse> {
*/
type = "";

constructor(data?: PartialMessage<WatchStageResponse>) {
constructor(data?: PartialMessage<WatchStagesResponse>) {
super();
proto3.util.initPartial(data, this);
}

static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "akuity.io.kargo.service.v1alpha1.WatchStageResponse";
static readonly typeName = "akuity.io.kargo.service.v1alpha1.WatchStagesResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "stage", kind: "message", T: Stage },
{ no: 2, name: "type", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WatchStageResponse {
return new WatchStageResponse().fromBinary(bytes, options);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WatchStagesResponse {
return new WatchStagesResponse().fromBinary(bytes, options);
}

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WatchStageResponse {
return new WatchStageResponse().fromJson(jsonValue, options);
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WatchStagesResponse {
return new WatchStagesResponse().fromJson(jsonValue, options);
}

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WatchStageResponse {
return new WatchStageResponse().fromJsonString(jsonString, options);
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WatchStagesResponse {
return new WatchStagesResponse().fromJsonString(jsonString, options);
}

static equals(a: WatchStageResponse | PlainMessage<WatchStageResponse> | undefined, b: WatchStageResponse | PlainMessage<WatchStageResponse> | undefined): boolean {
return proto3.util.equals(WatchStageResponse, a, b);
static equals(a: WatchStagesResponse | PlainMessage<WatchStagesResponse> | undefined, b: WatchStagesResponse | PlainMessage<WatchStagesResponse> | undefined): boolean {
return proto3.util.equals(WatchStagesResponse, a, b);
}
}

Expand Down

0 comments on commit 3e19c25

Please sign in to comment.