Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error
- func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error
- func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
- type ServiceAccount
- func (*ServiceAccount) Descriptor() ([]byte, []int)deprecated
- func (x *ServiceAccount) GetDescription() string
- func (x *ServiceAccount) GetEmail() string
- func (x *ServiceAccount) GetExpiresAt() int64
- func (x *ServiceAccount) GetIssuedAt() int64
- func (x *ServiceAccount) GetName() string
- func (x *ServiceAccount) GetNotBefore() int64
- func (*ServiceAccount) ProtoMessage()
- func (x *ServiceAccount) ProtoReflect() protoreflect.Message
- func (x *ServiceAccount) Reset()
- func (x *ServiceAccount) String() string
- type TokenResponse
- func (*TokenResponse) Descriptor() ([]byte, []int)deprecated
- func (x *TokenResponse) GetAccount() *ServiceAccount
- func (x *TokenResponse) GetToken() string
- func (*TokenResponse) ProtoMessage()
- func (x *TokenResponse) ProtoReflect() protoreflect.Message
- func (x *TokenResponse) Reset()
- func (x *TokenResponse) String() string
- type UnimplementedUserServiceServer
- func (UnimplementedUserServiceServer) CreateToken(context.Context, *ServiceAccount) (*TokenResponse, error)
- func (UnimplementedUserServiceServer) Token(context.Context, *emptypb.Empty) (*TokenResponse, error)
- func (UnimplementedUserServiceServer) Whoami(context.Context, *emptypb.Empty) (*WhoamiResponse, error)
- type UnsafeUserServiceServer
- type User
- func (*User) Descriptor() ([]byte, []int)deprecated
- func (x *User) GetEmail() string
- func (x *User) GetExpiry() *timestamppb.Timestamp
- func (x *User) GetName() string
- func (x *User) GetPicture() string
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
- type UserServiceClient
- type UserServiceServer
- type WhoamiResponse
- func (*WhoamiResponse) Descriptor() ([]byte, []int)deprecated
- func (m *WhoamiResponse) GetPrincipal() isWhoamiResponse_Principal
- func (x *WhoamiResponse) GetServiceAccount() *ServiceAccount
- func (x *WhoamiResponse) GetUser() *User
- func (*WhoamiResponse) ProtoMessage()
- func (x *WhoamiResponse) ProtoReflect() protoreflect.Message
- func (x *WhoamiResponse) Reset()
- func (x *WhoamiResponse) String() string
- type WhoamiResponse_ServiceAccount
- type WhoamiResponse_User
Constants ¶
const ( UserService_Whoami_FullMethodName = "/proto.api.v1.UserService/Whoami" UserService_CreateToken_FullMethodName = "/proto.api.v1.UserService/CreateToken" UserService_Token_FullMethodName = "/proto.api.v1.UserService/Token" )
Variables ¶
var File_proto_api_v1_user_proto protoreflect.FileDescriptor
var UserService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "proto.api.v1.UserService", HandlerType: (*UserServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Whoami", Handler: _UserService_Whoami_Handler, }, { MethodName: "CreateToken", Handler: _UserService_CreateToken_Handler, }, { MethodName: "Token", Handler: _UserService_Token_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/api/v1/user.proto", }
UserService_ServiceDesc is the grpc.ServiceDesc for UserService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterUserServiceHandler ¶
func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterUserServiceHandler registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserServiceHandlerClient ¶
func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error
RegisterUserServiceHandlerClient registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserServiceClient" to call the correct interceptors.
func RegisterUserServiceHandlerFromEndpoint ¶
func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserServiceHandlerFromEndpoint is same as RegisterUserServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserServiceHandlerServer ¶
func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error
RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux". UnaryRPC :call UserServiceServer 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 RegisterUserServiceHandlerFromEndpoint instead.
func RegisterUserServiceServer ¶
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
Types ¶
type ServiceAccount ¶
type ServiceAccount struct { // Name is a human readable name for the service account. Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` // Description is a human readable description for the service account. Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` // Email is the Red Hat email address for the service account. Email string `protobuf:"bytes,3,opt,name=Email,proto3" json:"Email,omitempty"` // IssuedAt is the time of issuing the service account token. IssuedAt int64 `protobuf:"varint,4,opt,name=IssuedAt,proto3" json:"IssuedAt,omitempty"` // NotBefore is the beginning of service account token valid time period. NotBefore int64 `protobuf:"varint,5,opt,name=NotBefore,proto3" json:"NotBefore,omitempty"` // ExpiresAt is the end of service account token valid time period. ExpiresAt int64 `protobuf:"varint,6,opt,name=ExpiresAt,proto3" json:"ExpiresAt,omitempty"` // contains filtered or unexported fields }
ServiceAccount represents an authenticated service account (robot) principal.
func (*ServiceAccount) Descriptor
deprecated
func (*ServiceAccount) Descriptor() ([]byte, []int)
Deprecated: Use ServiceAccount.ProtoReflect.Descriptor instead.
func (*ServiceAccount) GetDescription ¶
func (x *ServiceAccount) GetDescription() string
func (*ServiceAccount) GetEmail ¶
func (x *ServiceAccount) GetEmail() string
func (*ServiceAccount) GetExpiresAt ¶
func (x *ServiceAccount) GetExpiresAt() int64
func (*ServiceAccount) GetIssuedAt ¶
func (x *ServiceAccount) GetIssuedAt() int64
func (*ServiceAccount) GetName ¶
func (x *ServiceAccount) GetName() string
func (*ServiceAccount) GetNotBefore ¶
func (x *ServiceAccount) GetNotBefore() int64
func (*ServiceAccount) ProtoMessage ¶
func (*ServiceAccount) ProtoMessage()
func (*ServiceAccount) ProtoReflect ¶
func (x *ServiceAccount) ProtoReflect() protoreflect.Message
func (*ServiceAccount) Reset ¶
func (x *ServiceAccount) Reset()
func (*ServiceAccount) String ¶
func (x *ServiceAccount) String() string
type TokenResponse ¶
type TokenResponse struct { // Account is the service account the token was generated for. Account *ServiceAccount `protobuf:"bytes,1,opt,name=Account,proto3" json:"Account,omitempty"` // Token is the token generated for the service account. Token string `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` // contains filtered or unexported fields }
func (*TokenResponse) Descriptor
deprecated
func (*TokenResponse) Descriptor() ([]byte, []int)
Deprecated: Use TokenResponse.ProtoReflect.Descriptor instead.
func (*TokenResponse) GetAccount ¶
func (x *TokenResponse) GetAccount() *ServiceAccount
func (*TokenResponse) GetToken ¶
func (x *TokenResponse) GetToken() string
func (*TokenResponse) ProtoMessage ¶
func (*TokenResponse) ProtoMessage()
func (*TokenResponse) ProtoReflect ¶
func (x *TokenResponse) ProtoReflect() protoreflect.Message
func (*TokenResponse) Reset ¶
func (x *TokenResponse) Reset()
func (*TokenResponse) String ¶
func (x *TokenResponse) String() string
type UnimplementedUserServiceServer ¶
type UnimplementedUserServiceServer struct { }
UnimplementedUserServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedUserServiceServer) CreateToken ¶
func (UnimplementedUserServiceServer) CreateToken(context.Context, *ServiceAccount) (*TokenResponse, error)
func (UnimplementedUserServiceServer) Token ¶
func (UnimplementedUserServiceServer) Token(context.Context, *emptypb.Empty) (*TokenResponse, error)
func (UnimplementedUserServiceServer) Whoami ¶
func (UnimplementedUserServiceServer) Whoami(context.Context, *emptypb.Empty) (*WhoamiResponse, error)
type UnsafeUserServiceServer ¶
type UnsafeUserServiceServer interface {
// contains filtered or unexported methods
}
UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UserServiceServer will result in compilation errors.
type User ¶
type User struct { // Expiry is the expiration date of this user session. Used only as a hint // to the user and not for enforcement. Expiry *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=Expiry,proto3" json:"Expiry,omitempty"` // Name is the full name of the user. Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` // Email is the email address of the user. Email string `protobuf:"bytes,3,opt,name=Email,proto3" json:"Email,omitempty"` // Picture is a URL linking to this user's profile picture, if available. Picture string `protobuf:"bytes,4,opt,name=Picture,proto3" json:"Picture,omitempty"` // contains filtered or unexported fields }
User represents an authenticated (human) principal.
func (*User) Descriptor
deprecated
func (*User) GetExpiry ¶
func (x *User) GetExpiry() *timestamppb.Timestamp
func (*User) GetPicture ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type UserServiceClient ¶
type UserServiceClient interface { // Whoami provides information about the currently authenticated principal. Whoami(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*WhoamiResponse, error) // CreateToken generates an arbitrary service account token CreateToken(ctx context.Context, in *ServiceAccount, opts ...grpc.CallOption) (*TokenResponse, error) // Token generates a service account token for the current user. Token(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TokenResponse, error) }
UserServiceClient is the client API for UserService 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.
func NewUserServiceClient ¶
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient
type UserServiceServer ¶
type UserServiceServer interface { // Whoami provides information about the currently authenticated principal. Whoami(context.Context, *emptypb.Empty) (*WhoamiResponse, error) // CreateToken generates an arbitrary service account token CreateToken(context.Context, *ServiceAccount) (*TokenResponse, error) // Token generates a service account token for the current user. Token(context.Context, *emptypb.Empty) (*TokenResponse, error) // contains filtered or unexported methods }
UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility
type WhoamiResponse ¶
type WhoamiResponse struct { // Principal represents a possible type of authenticated principal. // // Types that are assignable to Principal: // // *WhoamiResponse_User // *WhoamiResponse_ServiceAccount Principal isWhoamiResponse_Principal `protobuf_oneof:"principal"` // contains filtered or unexported fields }
WhoamiResponse represents details about the current authenticated principal.
func (*WhoamiResponse) Descriptor
deprecated
func (*WhoamiResponse) Descriptor() ([]byte, []int)
Deprecated: Use WhoamiResponse.ProtoReflect.Descriptor instead.
func (*WhoamiResponse) GetPrincipal ¶
func (m *WhoamiResponse) GetPrincipal() isWhoamiResponse_Principal
func (*WhoamiResponse) GetServiceAccount ¶
func (x *WhoamiResponse) GetServiceAccount() *ServiceAccount
func (*WhoamiResponse) GetUser ¶
func (x *WhoamiResponse) GetUser() *User
func (*WhoamiResponse) ProtoMessage ¶
func (*WhoamiResponse) ProtoMessage()
func (*WhoamiResponse) ProtoReflect ¶
func (x *WhoamiResponse) ProtoReflect() protoreflect.Message
func (*WhoamiResponse) Reset ¶
func (x *WhoamiResponse) Reset()
func (*WhoamiResponse) String ¶
func (x *WhoamiResponse) String() string
type WhoamiResponse_ServiceAccount ¶
type WhoamiResponse_ServiceAccount struct { // ServiceAccount represents an authenticated service account robot. ServiceAccount *ServiceAccount `protobuf:"bytes,2,opt,name=ServiceAccount,proto3,oneof"` }
type WhoamiResponse_User ¶
type WhoamiResponse_User struct { // User represents an authenticated human. User *User `protobuf:"bytes,1,opt,name=User,proto3,oneof"` }