longrunning

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package longrunning is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	OperationStatus_name = map[int32]string{
		0: "OPERATION_STATUS_UNSPECIFIED",
		1: "PENDING",
		2: "COMPLETED",
		3: "FAILED",
	}
	OperationStatus_value = map[string]int32{
		"OPERATION_STATUS_UNSPECIFIED": 0,
		"PENDING":                      1,
		"COMPLETED":                    2,
		"FAILED":                       3,
	}
)

Enum value maps for OperationStatus.

View Source
var File_longrunning_proto protoreflect.FileDescriptor

Functions

func RegisterOperationAPIHandler

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

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

func RegisterOperationAPIHandlerClient

func RegisterOperationAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OperationAPIClient) error

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

func RegisterOperationAPIHandlerFromEndpoint

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

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

func RegisterOperationAPIHandlerServer

func RegisterOperationAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OperationAPIServer) error

RegisterOperationAPIHandlerServer registers the http handlers for service OperationAPI to "mux". UnaryRPC :call OperationAPIServer 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 RegisterOperationAPIHandlerFromEndpoint instead.

func RegisterOperationAPIServer

func RegisterOperationAPIServer(s grpc.ServiceRegistrar, srv OperationAPIServer)

Types

type CreateOperationRequest

type CreateOperationRequest struct {
	Operation *Operation `protobuf:"bytes,1,opt,name=operation,proto3" json:"operation,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateOperationRequest) Descriptor deprecated

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

Deprecated: Use CreateOperationRequest.ProtoReflect.Descriptor instead.

func (*CreateOperationRequest) GetOperation

func (x *CreateOperationRequest) GetOperation() *Operation

func (*CreateOperationRequest) ProtoMessage

func (*CreateOperationRequest) ProtoMessage()

func (*CreateOperationRequest) ProtoReflect

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

func (*CreateOperationRequest) Reset

func (x *CreateOperationRequest) Reset()

func (*CreateOperationRequest) String

func (x *CreateOperationRequest) String() string

type DeleteOperationRequest

type DeleteOperationRequest struct {
	UserId      string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	OperationId string `protobuf:"bytes,2,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteOperationRequest) Descriptor deprecated

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

Deprecated: Use DeleteOperationRequest.ProtoReflect.Descriptor instead.

func (*DeleteOperationRequest) GetOperationId

func (x *DeleteOperationRequest) GetOperationId() string

func (*DeleteOperationRequest) GetUserId

func (x *DeleteOperationRequest) GetUserId() string

func (*DeleteOperationRequest) ProtoMessage

func (*DeleteOperationRequest) ProtoMessage()

func (*DeleteOperationRequest) ProtoReflect

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

func (*DeleteOperationRequest) Reset

func (x *DeleteOperationRequest) Reset()

func (*DeleteOperationRequest) String

func (x *DeleteOperationRequest) String() string

type GetOperationRequest

type GetOperationRequest struct {
	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 ListOperationsFilter

type ListOperationsFilter struct {
	UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ListOperationsFilter) Descriptor deprecated

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

Deprecated: Use ListOperationsFilter.ProtoReflect.Descriptor instead.

func (*ListOperationsFilter) GetUserId

func (x *ListOperationsFilter) GetUserId() string

func (*ListOperationsFilter) ProtoMessage

func (*ListOperationsFilter) ProtoMessage()

func (*ListOperationsFilter) ProtoReflect

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

func (*ListOperationsFilter) Reset

func (x *ListOperationsFilter) Reset()

func (*ListOperationsFilter) String

func (x *ListOperationsFilter) String() string

type ListOperationsRequest

type ListOperationsRequest struct {
	PageToken string                `protobuf:"bytes,1,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
	PageSize  int32                 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	Filter    *ListOperationsFilter `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"`
	// contains filtered or unexported fields
}

func (*ListOperationsRequest) Descriptor deprecated

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

Deprecated: Use ListOperationsRequest.ProtoReflect.Descriptor instead.

func (*ListOperationsRequest) GetFilter

func (*ListOperationsRequest) GetPageSize

func (x *ListOperationsRequest) GetPageSize() int32

func (*ListOperationsRequest) GetPageToken

func (x *ListOperationsRequest) GetPageToken() string

func (*ListOperationsRequest) ProtoMessage

func (*ListOperationsRequest) ProtoMessage()

func (*ListOperationsRequest) ProtoReflect

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

func (*ListOperationsRequest) Reset

func (x *ListOperationsRequest) Reset()

func (*ListOperationsRequest) String

func (x *ListOperationsRequest) String() string

type ListOperationsResponse

type ListOperationsResponse struct {
	Operations      []*Operation `protobuf:"bytes,1,rep,name=operations,proto3" json:"operations,omitempty"`
	NextPageToken   string       `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	CollectionCount int64        `protobuf:"varint,3,opt,name=collection_count,json=collectionCount,proto3" json:"collection_count,omitempty"`
	// contains filtered or unexported fields
}

func (*ListOperationsResponse) Descriptor deprecated

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

Deprecated: Use ListOperationsResponse.ProtoReflect.Descriptor instead.

func (*ListOperationsResponse) GetCollectionCount

func (x *ListOperationsResponse) GetCollectionCount() int64

func (*ListOperationsResponse) GetNextPageToken

func (x *ListOperationsResponse) GetNextPageToken() string

func (*ListOperationsResponse) GetOperations

func (x *ListOperationsResponse) GetOperations() []*Operation

func (*ListOperationsResponse) ProtoMessage

func (*ListOperationsResponse) ProtoMessage()

func (*ListOperationsResponse) ProtoReflect

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

func (*ListOperationsResponse) Reset

func (x *ListOperationsResponse) Reset()

func (*ListOperationsResponse) String

func (x *ListOperationsResponse) String() string

type Operation

type Operation struct {
	Id           string          `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	UserId       string          `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	Details      string          `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"`
	Result       string          `protobuf:"bytes,4,opt,name=result,proto3" json:"result,omitempty"`
	Origin       string          `protobuf:"bytes,5,opt,name=origin,proto3" json:"origin,omitempty"`
	Status       OperationStatus `protobuf:"varint,6,opt,name=status,proto3,enum=gidyon.apis.OperationStatus" json:"status,omitempty"`
	TimestampSec int64           `protobuf:"varint,7,opt,name=timestamp_sec,json=timestampSec,proto3" json:"timestamp_sec,omitempty"`
	// contains filtered or unexported fields
}

func (*Operation) Descriptor deprecated

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

Deprecated: Use Operation.ProtoReflect.Descriptor instead.

func (*Operation) GetDetails

func (x *Operation) GetDetails() string

func (*Operation) GetId

func (x *Operation) GetId() string

func (*Operation) GetOrigin

func (x *Operation) GetOrigin() string

func (*Operation) GetResult

func (x *Operation) GetResult() string

func (*Operation) GetStatus

func (x *Operation) GetStatus() OperationStatus

func (*Operation) GetTimestampSec

func (x *Operation) GetTimestampSec() int64

func (*Operation) GetUserId

func (x *Operation) GetUserId() string

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 OperationAPIClient

type OperationAPIClient interface {
	// Creates a long running operation
	CreateOperation(ctx context.Context, in *CreateOperationRequest, opts ...grpc.CallOption) (*Operation, error)
	// Updates a long running operation
	UpdateOperation(ctx context.Context, in *UpdateOperationRequest, opts ...grpc.CallOption) (*Operation, error)
	// Deletes a long running operation
	DeleteOperation(ctx context.Context, in *DeleteOperationRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Retrieves collection of long running operations
	ListOperations(ctx context.Context, in *ListOperationsRequest, opts ...grpc.CallOption) (*ListOperationsResponse, error)
	// Retrives a single long running operation
	GetOperation(ctx context.Context, in *GetOperationRequest, opts ...grpc.CallOption) (*Operation, error)
}

OperationAPIClient is the client API for OperationAPI 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.

type OperationAPIServer

type OperationAPIServer interface {
	// Creates a long running operation
	CreateOperation(context.Context, *CreateOperationRequest) (*Operation, error)
	// Updates a long running operation
	UpdateOperation(context.Context, *UpdateOperationRequest) (*Operation, error)
	// Deletes a long running operation
	DeleteOperation(context.Context, *DeleteOperationRequest) (*empty.Empty, error)
	// Retrieves collection of long running operations
	ListOperations(context.Context, *ListOperationsRequest) (*ListOperationsResponse, error)
	// Retrives a single long running operation
	GetOperation(context.Context, *GetOperationRequest) (*Operation, error)
	// contains filtered or unexported methods
}

OperationAPIServer is the server API for OperationAPI service. All implementations must embed UnimplementedOperationAPIServer for forward compatibility

type OperationStatus

type OperationStatus int32

OperationStatus

const (
	OperationStatus_OPERATION_STATUS_UNSPECIFIED OperationStatus = 0
	OperationStatus_PENDING                      OperationStatus = 1
	OperationStatus_COMPLETED                    OperationStatus = 2
	OperationStatus_FAILED                       OperationStatus = 3
)

func (OperationStatus) Descriptor

func (OperationStatus) Enum

func (x OperationStatus) Enum() *OperationStatus

func (OperationStatus) EnumDescriptor deprecated

func (OperationStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use OperationStatus.Descriptor instead.

func (OperationStatus) Number

func (OperationStatus) String

func (x OperationStatus) String() string

func (OperationStatus) Type

type UnimplementedOperationAPIServer

type UnimplementedOperationAPIServer struct {
}

UnimplementedOperationAPIServer must be embedded to have forward compatible implementations.

func (UnimplementedOperationAPIServer) CreateOperation

func (UnimplementedOperationAPIServer) DeleteOperation

func (UnimplementedOperationAPIServer) GetOperation

func (UnimplementedOperationAPIServer) ListOperations

func (UnimplementedOperationAPIServer) UpdateOperation

type UnsafeOperationAPIServer

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

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

type UpdateOperationRequest

type UpdateOperationRequest struct {
	OperationId string          `protobuf:"bytes,1,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
	Result      string          `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
	Status      OperationStatus `protobuf:"varint,3,opt,name=status,proto3,enum=gidyon.apis.OperationStatus" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateOperationRequest) Descriptor deprecated

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

Deprecated: Use UpdateOperationRequest.ProtoReflect.Descriptor instead.

func (*UpdateOperationRequest) GetOperationId

func (x *UpdateOperationRequest) GetOperationId() string

func (*UpdateOperationRequest) GetResult

func (x *UpdateOperationRequest) GetResult() string

func (*UpdateOperationRequest) GetStatus

func (x *UpdateOperationRequest) GetStatus() OperationStatus

func (*UpdateOperationRequest) ProtoMessage

func (*UpdateOperationRequest) ProtoMessage()

func (*UpdateOperationRequest) ProtoReflect

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

func (*UpdateOperationRequest) Reset

func (x *UpdateOperationRequest) Reset()

func (*UpdateOperationRequest) String

func (x *UpdateOperationRequest) String() string

Jump to

Keyboard shortcuts

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