operationv1

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package operationv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	OperationService_Get_FullMethodName    = "/kacho.cloud.operation.OperationService/Get"
	OperationService_Cancel_FullMethodName = "/kacho.cloud.operation.OperationService/Cancel"
)

Variables

View Source
var File_kacho_cloud_operation_operation_proto protoreflect.FileDescriptor
View Source
var File_kacho_cloud_operation_operation_service_proto protoreflect.FileDescriptor
View Source
var File_kacho_cloud_operation_package_options_proto protoreflect.FileDescriptor
View Source
var OperationService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "kacho.cloud.operation.OperationService",
	HandlerType: (*OperationServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Get",
			Handler:    _OperationService_Get_Handler,
		},
		{
			MethodName: "Cancel",
			Handler:    _OperationService_Cancel_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "kacho/cloud/operation/operation_service.proto",
}

OperationService_ServiceDesc is the grpc.ServiceDesc for OperationService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterOperationServiceHandler

func RegisterOperationServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterOperationServiceHandler registers the http handlers for service OperationService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterOperationServiceHandlerClient

func RegisterOperationServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OperationServiceClient) error

RegisterOperationServiceHandlerClient registers the http handlers for service OperationService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "OperationServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "OperationServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "OperationServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterOperationServiceHandlerFromEndpoint

func RegisterOperationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterOperationServiceHandlerFromEndpoint is same as RegisterOperationServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterOperationServiceHandlerServer

func RegisterOperationServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OperationServiceServer) error

RegisterOperationServiceHandlerServer registers the http handlers for service OperationService to "mux". UnaryRPC :call OperationServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterOperationServiceHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterOperationServiceServer

func RegisterOperationServiceServer(s grpc.ServiceRegistrar, srv OperationServiceServer)

Types

type CancelOperationRequest

type CancelOperationRequest struct {

	// ID of the operation to cancel.
	OperationId string `protobuf:"bytes,1,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
	// contains filtered or unexported fields
}

func (*CancelOperationRequest) Descriptor deprecated

func (*CancelOperationRequest) Descriptor() ([]byte, []int)

Deprecated: Use CancelOperationRequest.ProtoReflect.Descriptor instead.

func (*CancelOperationRequest) GetOperationId

func (x *CancelOperationRequest) GetOperationId() string

func (*CancelOperationRequest) ProtoMessage

func (*CancelOperationRequest) ProtoMessage()

func (*CancelOperationRequest) ProtoReflect

func (x *CancelOperationRequest) ProtoReflect() protoreflect.Message

func (*CancelOperationRequest) Reset

func (x *CancelOperationRequest) Reset()

func (*CancelOperationRequest) String

func (x *CancelOperationRequest) String() string

type GetOperationRequest

type GetOperationRequest struct {

	// ID of the Operation resource to return.
	OperationId string `protobuf:"bytes,1,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetOperationRequest) Descriptor deprecated

func (*GetOperationRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetOperationRequest.ProtoReflect.Descriptor instead.

func (*GetOperationRequest) GetOperationId

func (x *GetOperationRequest) GetOperationId() string

func (*GetOperationRequest) ProtoMessage

func (*GetOperationRequest) ProtoMessage()

func (*GetOperationRequest) ProtoReflect

func (x *GetOperationRequest) ProtoReflect() protoreflect.Message

func (*GetOperationRequest) Reset

func (x *GetOperationRequest) Reset()

func (*GetOperationRequest) String

func (x *GetOperationRequest) String() string

type Operation

type Operation struct {

	// ID of the operation.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Description of the operation. 0-256 characters long.
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // ex: Create VM, Stop VM, Delete Disk, Snapshot Disk, etc
	// Creation timestamp.
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// ID of the user or service account who initiated the operation.
	CreatedBy string `protobuf:"bytes,4,opt,name=created_by,json=createdBy,proto3" json:"created_by,omitempty"`
	// The time when the Operation resource was last modified.
	ModifiedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=modified_at,json=modifiedAt,proto3" json:"modified_at,omitempty"`
	// If the value is `false`, it means the operation is still in progress.
	// If `true`, the operation is completed, and either `error` or `response` is available.
	Done bool `protobuf:"varint,6,opt,name=done,proto3" json:"done,omitempty"`
	// Service-specific metadata associated with the operation.
	// It typically contains the ID of the target resource that the operation is performed on.
	// Any method that returns a long-running operation should document the metadata type, if any.
	//
	// The resource ID here is assigned when the operation is ACCEPTED, before the
	// work is carried out — so it is present even when the operation ultimately
	// fails, and then points at a resource that does not exist. Do NOT treat it as
	// "the created resource" on `done == true` alone: check `result` first and use
	// the ID only when `error` is not set. Reading it on a failed operation yields
	// a phantom ID whose later use fails as NOT_FOUND, or worse, resolves to an
	// unrelated resource.
	Metadata *anypb.Any `protobuf:"bytes,7,opt,name=metadata,proto3" json:"metadata,omitempty"`
	// The operation result.
	// If `done == false` and there was no failure detected, neither `error` nor `response` is set.
	// If `done == false` and there was a failure detected, `error` is set.
	// If `done == true`, exactly one of `error` or `response` is set.
	//
	// Types that are valid to be assigned to Result:
	//
	//	*Operation_Error
	//	*Operation_Response
	Result isOperation_Result `protobuf_oneof:"result"`
	// Тип subject'а: "user" | "service_account" | "system".
	PrincipalType string `protobuf:"bytes,10,opt,name=principal_type,json=principalType,proto3" json:"principal_type,omitempty"`
	// ID subject'а в kacho-iam (например `usr-...`, `sva-...`) или системный токен
	// (`bootstrap` для миграций, `system` для internal workers).
	PrincipalId string `protobuf:"bytes,11,opt,name=principal_id,json=principalId,proto3" json:"principal_id,omitempty"`
	// Человеко-читаемое имя (email / display_name) — для UI и логов. Snapshot на момент
	// операции; может расходиться с актуальным значением `User.display_name`.
	PrincipalDisplayName string `protobuf:"bytes,12,opt,name=principal_display_name,json=principalDisplayName,proto3" json:"principal_display_name,omitempty"`
	// contains filtered or unexported fields
}

An Operation resource — the result of an asynchronous (long-running) API request.

func (*Operation) Descriptor deprecated

func (*Operation) Descriptor() ([]byte, []int)

Deprecated: Use Operation.ProtoReflect.Descriptor instead.

func (*Operation) GetCreatedAt

func (x *Operation) GetCreatedAt() *timestamppb.Timestamp

func (*Operation) GetCreatedBy

func (x *Operation) GetCreatedBy() string

func (*Operation) GetDescription

func (x *Operation) GetDescription() string

func (*Operation) GetDone

func (x *Operation) GetDone() bool

func (*Operation) GetError

func (x *Operation) GetError() *status.Status

func (*Operation) GetId

func (x *Operation) GetId() string

func (*Operation) GetMetadata

func (x *Operation) GetMetadata() *anypb.Any

func (*Operation) GetModifiedAt

func (x *Operation) GetModifiedAt() *timestamppb.Timestamp

func (*Operation) GetPrincipalDisplayName

func (x *Operation) GetPrincipalDisplayName() string

func (*Operation) GetPrincipalId

func (x *Operation) GetPrincipalId() string

func (*Operation) GetPrincipalType

func (x *Operation) GetPrincipalType() string

func (*Operation) GetResponse

func (x *Operation) GetResponse() *anypb.Any

func (*Operation) GetResult

func (x *Operation) GetResult() isOperation_Result

func (*Operation) ProtoMessage

func (*Operation) ProtoMessage()

func (*Operation) ProtoReflect

func (x *Operation) ProtoReflect() protoreflect.Message

func (*Operation) Reset

func (x *Operation) Reset()

func (*Operation) String

func (x *Operation) String() string

type OperationServiceClient

type OperationServiceClient interface {
	// Returns the specified Operation resource.
	Get(ctx context.Context, in *GetOperationRequest, opts ...grpc.CallOption) (*Operation, error)
	// Cancels the specified operation.
	//
	// Note that currently Object Storage API does not support cancelling operations.
	Cancel(ctx context.Context, in *CancelOperationRequest, opts ...grpc.CallOption) (*Operation, error)
}

OperationServiceClient is the client API for OperationService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

A set of methods for managing operations for asynchronous API requests.

type OperationServiceServer

type OperationServiceServer interface {
	// Returns the specified Operation resource.
	Get(context.Context, *GetOperationRequest) (*Operation, error)
	// Cancels the specified operation.
	//
	// Note that currently Object Storage API does not support cancelling operations.
	Cancel(context.Context, *CancelOperationRequest) (*Operation, error)
	// contains filtered or unexported methods
}

OperationServiceServer is the server API for OperationService service. All implementations must embed UnimplementedOperationServiceServer for forward compatibility.

A set of methods for managing operations for asynchronous API requests.

type Operation_Error

type Operation_Error struct {
	// The error result of the operation in case of failure or cancellation.
	Error *status.Status `protobuf:"bytes,8,opt,name=error,proto3,oneof"`
}

type Operation_Response

type Operation_Response struct {
	// The normal response of the operation in case of success.
	// If the original method returns no data on success, such as Delete,
	// the response is [google.protobuf.Empty].
	// If the original method is the standard Create/Update,
	// the response should be the target resource of the operation.
	// Any method that returns a long-running operation should document the response type, if any.
	Response *anypb.Any `protobuf:"bytes,9,opt,name=response,proto3,oneof"`
}

type UnimplementedOperationServiceServer

type UnimplementedOperationServiceServer struct{}

UnimplementedOperationServiceServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedOperationServiceServer) Cancel

func (UnimplementedOperationServiceServer) Get

type UnsafeOperationServiceServer

type UnsafeOperationServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeOperationServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to OperationServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL