mirror of
https://github.com/hanzoai/ca.git
synced 2026-11-03 18:08:27 +00:00
752 lines
26 KiB
Go
752 lines
26 KiB
Go
// Code generated by protoc-gen-go-proxy. DO NOT EDIT.
|
|
// source: orgs.proto
|
|
|
|
package proxypb
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/effective-security/porto/pkg/retriable"
|
|
"github.com/effective-security/porto/xhttp/correlation"
|
|
"github.com/effective-security/porto/xhttp/httperror"
|
|
"github.com/effective-security/trustyca/api/pb"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/protobuf/types/known/emptypb"
|
|
)
|
|
|
|
type proxyOrgsServer struct {
|
|
srv pb.OrgsServer
|
|
}
|
|
|
|
type proxyOrgsClient struct {
|
|
remote pb.OrgsClient
|
|
callOpts []grpc.CallOption
|
|
}
|
|
|
|
type postproxyOrgsClient struct {
|
|
client retriable.PostRequester
|
|
}
|
|
|
|
// OrgsServerToClient returns pb.OrgsClient
|
|
func OrgsServerToClient(srv pb.OrgsServer) pb.OrgsClient {
|
|
return &proxyOrgsServer{srv}
|
|
}
|
|
|
|
// NewOrgsClient returns instance of the OrgsClient
|
|
func NewOrgsClient(conn *grpc.ClientConn, callOpts []grpc.CallOption) pb.OrgsServer {
|
|
return &proxyOrgsClient{
|
|
remote: pb.NewOrgsClient(conn),
|
|
callOpts: callOpts,
|
|
}
|
|
}
|
|
|
|
// NewOrgsClientFromProxy returns instance of OrgsClient
|
|
func NewOrgsClientFromProxy(proxy pb.OrgsClient) pb.OrgsServer {
|
|
return &proxyOrgsClient{
|
|
remote: proxy,
|
|
}
|
|
}
|
|
|
|
// NewOrgsClientFromProxy returns instance of OrgsClient
|
|
func NewHTTPOrgsClient(client retriable.PostRequester) pb.OrgsServer {
|
|
return &postproxyOrgsClient{
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
// RegisterOrg registers a new org. The caller becomes its Owner.
|
|
func (s *proxyOrgsServer) RegisterOrg(ctx context.Context, req *pb.RegisterOrgRequest, opts ...grpc.CallOption) (*pb.Org, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.RegisterOrg(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// RegisterOrg registers a new org. The caller becomes its Owner.
|
|
func (s *proxyOrgsClient) RegisterOrg(ctx context.Context, req *pb.RegisterOrgRequest) (*pb.Org, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.RegisterOrg(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// RegisterOrg registers a new org. The caller becomes its Owner.
|
|
func (s *postproxyOrgsClient) RegisterOrg(ctx context.Context, req *pb.RegisterOrgRequest) (*pb.Org, error) {
|
|
var res pb.Org
|
|
path := pb.Orgs_RegisterOrg_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// GetOrg returns the org selected in the token
|
|
func (s *proxyOrgsServer) GetOrg(ctx context.Context, req *emptypb.Empty, opts ...grpc.CallOption) (*pb.Org, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.GetOrg(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetOrg returns the org selected in the token
|
|
func (s *proxyOrgsClient) GetOrg(ctx context.Context, req *emptypb.Empty) (*pb.Org, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.GetOrg(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetOrg returns the org selected in the token
|
|
func (s *postproxyOrgsClient) GetOrg(ctx context.Context, req *emptypb.Empty) (*pb.Org, error) {
|
|
var res pb.Org
|
|
path := pb.Orgs_GetOrg_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// UpdateOrg updates the org selected in the token
|
|
func (s *proxyOrgsServer) UpdateOrg(ctx context.Context, req *pb.UpdateOrgRequest, opts ...grpc.CallOption) (*pb.Org, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.UpdateOrg(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// UpdateOrg updates the org selected in the token
|
|
func (s *proxyOrgsClient) UpdateOrg(ctx context.Context, req *pb.UpdateOrgRequest) (*pb.Org, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.UpdateOrg(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// UpdateOrg updates the org selected in the token
|
|
func (s *postproxyOrgsClient) UpdateOrg(ctx context.Context, req *pb.UpdateOrgRequest) (*pb.Org, error) {
|
|
var res pb.Org
|
|
path := pb.Orgs_UpdateOrg_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// DeleteOrg deactivates the org selected in the token
|
|
func (s *proxyOrgsServer) DeleteOrg(ctx context.Context, req *emptypb.Empty, opts ...grpc.CallOption) (*pb.Org, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.DeleteOrg(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// DeleteOrg deactivates the org selected in the token
|
|
func (s *proxyOrgsClient) DeleteOrg(ctx context.Context, req *emptypb.Empty) (*pb.Org, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.DeleteOrg(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// DeleteOrg deactivates the org selected in the token
|
|
func (s *postproxyOrgsClient) DeleteOrg(ctx context.Context, req *emptypb.Empty) (*pb.Org, error) {
|
|
var res pb.Org
|
|
path := pb.Orgs_DeleteOrg_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// GetUserOrgs returns the orgs the caller can select, each once, with the
|
|
// resolved org role. Available before an org is selected.
|
|
func (s *proxyOrgsServer) GetUserOrgs(ctx context.Context, req *emptypb.Empty, opts ...grpc.CallOption) (*pb.UserOrgsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.GetUserOrgs(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetUserOrgs returns the orgs the caller can select, each once, with the
|
|
// resolved org role. Available before an org is selected.
|
|
func (s *proxyOrgsClient) GetUserOrgs(ctx context.Context, req *emptypb.Empty) (*pb.UserOrgsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.GetUserOrgs(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetUserOrgs returns the orgs the caller can select, each once, with the
|
|
// resolved org role. Available before an org is selected.
|
|
func (s *postproxyOrgsClient) GetUserOrgs(ctx context.Context, req *emptypb.Empty) (*pb.UserOrgsResponse, error) {
|
|
var res pb.UserOrgsResponse
|
|
path := pb.Orgs_GetUserOrgs_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// GetUserMemberships returns the caller's resolved access to the org
|
|
// selected in the token and the caller's explicit grants in that org
|
|
func (s *proxyOrgsServer) GetUserMemberships(ctx context.Context, req *emptypb.Empty, opts ...grpc.CallOption) (*pb.UserMemberships, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.GetUserMemberships(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetUserMemberships returns the caller's resolved access to the org
|
|
// selected in the token and the caller's explicit grants in that org
|
|
func (s *proxyOrgsClient) GetUserMemberships(ctx context.Context, req *emptypb.Empty) (*pb.UserMemberships, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.GetUserMemberships(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetUserMemberships returns the caller's resolved access to the org
|
|
// selected in the token and the caller's explicit grants in that org
|
|
func (s *postproxyOrgsClient) GetUserMemberships(ctx context.Context, req *emptypb.Empty) (*pb.UserMemberships, error) {
|
|
var res pb.UserMemberships
|
|
path := pb.Orgs_GetUserMemberships_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// GetMembers returns memberships and invites of the org selected in the
|
|
// token. With ProjectID only the project's grants are returned; with
|
|
// Scope Org only the org-wide grants are returned.
|
|
func (s *proxyOrgsServer) GetMembers(ctx context.Context, req *pb.GetMembersRequest, opts ...grpc.CallOption) (*pb.MembersResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.GetMembers(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetMembers returns memberships and invites of the org selected in the
|
|
// token. With ProjectID only the project's grants are returned; with
|
|
// Scope Org only the org-wide grants are returned.
|
|
func (s *proxyOrgsClient) GetMembers(ctx context.Context, req *pb.GetMembersRequest) (*pb.MembersResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.GetMembers(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetMembers returns memberships and invites of the org selected in the
|
|
// token. With ProjectID only the project's grants are returned; with
|
|
// Scope Org only the org-wide grants are returned.
|
|
func (s *postproxyOrgsClient) GetMembers(ctx context.Context, req *pb.GetMembersRequest) (*pb.MembersResponse, error) {
|
|
var res pb.MembersResponse
|
|
path := pb.Orgs_GetMembers_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// AddMember grants a role to a user at org scope (empty ProjectID) or in
|
|
// a project. If the user does not exist yet, an invite is created.
|
|
func (s *proxyOrgsServer) AddMember(ctx context.Context, req *pb.AddMemberRequest, opts ...grpc.CallOption) (*pb.AddMemberResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.AddMember(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// AddMember grants a role to a user at org scope (empty ProjectID) or in
|
|
// a project. If the user does not exist yet, an invite is created.
|
|
func (s *proxyOrgsClient) AddMember(ctx context.Context, req *pb.AddMemberRequest) (*pb.AddMemberResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.AddMember(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// AddMember grants a role to a user at org scope (empty ProjectID) or in
|
|
// a project. If the user does not exist yet, an invite is created.
|
|
func (s *postproxyOrgsClient) AddMember(ctx context.Context, req *pb.AddMemberRequest) (*pb.AddMemberResponse, error) {
|
|
var res pb.AddMemberResponse
|
|
path := pb.Orgs_AddMember_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// ChangeMemberRole changes the role of an existing grant at the given scope
|
|
func (s *proxyOrgsServer) ChangeMemberRole(ctx context.Context, req *pb.ChangeMemberRoleRequest, opts ...grpc.CallOption) (*pb.Membership, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.ChangeMemberRole(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// ChangeMemberRole changes the role of an existing grant at the given scope
|
|
func (s *proxyOrgsClient) ChangeMemberRole(ctx context.Context, req *pb.ChangeMemberRoleRequest) (*pb.Membership, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.ChangeMemberRole(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// ChangeMemberRole changes the role of an existing grant at the given scope
|
|
func (s *postproxyOrgsClient) ChangeMemberRole(ctx context.Context, req *pb.ChangeMemberRoleRequest) (*pb.Membership, error) {
|
|
var res pb.Membership
|
|
path := pb.Orgs_ChangeMemberRole_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// DeleteMember removes the grant at the given scope
|
|
func (s *proxyOrgsServer) DeleteMember(ctx context.Context, req *pb.DeleteMemberRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.DeleteMember(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// DeleteMember removes the grant at the given scope
|
|
func (s *proxyOrgsClient) DeleteMember(ctx context.Context, req *pb.DeleteMemberRequest) (*emptypb.Empty, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.DeleteMember(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// DeleteMember removes the grant at the given scope
|
|
func (s *postproxyOrgsClient) DeleteMember(ctx context.Context, req *pb.DeleteMemberRequest) (*emptypb.Empty, error) {
|
|
var res emptypb.Empty
|
|
path := pb.Orgs_DeleteMember_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// DeleteInvite removes the invite at the given scope
|
|
func (s *proxyOrgsServer) DeleteInvite(ctx context.Context, req *pb.DeleteInviteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.DeleteInvite(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// DeleteInvite removes the invite at the given scope
|
|
func (s *proxyOrgsClient) DeleteInvite(ctx context.Context, req *pb.DeleteInviteRequest) (*emptypb.Empty, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.DeleteInvite(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// DeleteInvite removes the invite at the given scope
|
|
func (s *postproxyOrgsClient) DeleteInvite(ctx context.Context, req *pb.DeleteInviteRequest) (*emptypb.Empty, error) {
|
|
var res emptypb.Empty
|
|
path := pb.Orgs_DeleteInvite_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// RegisterProject creates a project in the org selected in the token
|
|
func (s *proxyOrgsServer) RegisterProject(ctx context.Context, req *pb.RegisterProjectRequest, opts ...grpc.CallOption) (*pb.Project, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.RegisterProject(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// RegisterProject creates a project in the org selected in the token
|
|
func (s *proxyOrgsClient) RegisterProject(ctx context.Context, req *pb.RegisterProjectRequest) (*pb.Project, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.RegisterProject(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// RegisterProject creates a project in the org selected in the token
|
|
func (s *postproxyOrgsClient) RegisterProject(ctx context.Context, req *pb.RegisterProjectRequest) (*pb.Project, error) {
|
|
var res pb.Project
|
|
path := pb.Orgs_RegisterProject_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// UpdateProject updates a project
|
|
func (s *proxyOrgsServer) UpdateProject(ctx context.Context, req *pb.UpdateProjectRequest, opts ...grpc.CallOption) (*pb.Project, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.UpdateProject(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// UpdateProject updates a project
|
|
func (s *proxyOrgsClient) UpdateProject(ctx context.Context, req *pb.UpdateProjectRequest) (*pb.Project, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.UpdateProject(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// UpdateProject updates a project
|
|
func (s *postproxyOrgsClient) UpdateProject(ctx context.Context, req *pb.UpdateProjectRequest) (*pb.Project, error) {
|
|
var res pb.Project
|
|
path := pb.Orgs_UpdateProject_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// GetProject returns a project by ID or alias
|
|
func (s *proxyOrgsServer) GetProject(ctx context.Context, req *pb.GetProjectRequest, opts ...grpc.CallOption) (*pb.Project, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.GetProject(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetProject returns a project by ID or alias
|
|
func (s *proxyOrgsClient) GetProject(ctx context.Context, req *pb.GetProjectRequest) (*pb.Project, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.GetProject(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetProject returns a project by ID or alias
|
|
func (s *postproxyOrgsClient) GetProject(ctx context.Context, req *pb.GetProjectRequest) (*pb.Project, error) {
|
|
var res pb.Project
|
|
path := pb.Orgs_GetProject_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// ListProjects returns the projects of the org selected in the token that
|
|
// the caller can access
|
|
func (s *proxyOrgsServer) ListProjects(ctx context.Context, req *pb.ListProjectsRequest, opts ...grpc.CallOption) (*pb.ProjectsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.ListProjects(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// ListProjects returns the projects of the org selected in the token that
|
|
// the caller can access
|
|
func (s *proxyOrgsClient) ListProjects(ctx context.Context, req *pb.ListProjectsRequest) (*pb.ProjectsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.ListProjects(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// ListProjects returns the projects of the org selected in the token that
|
|
// the caller can access
|
|
func (s *postproxyOrgsClient) ListProjects(ctx context.Context, req *pb.ListProjectsRequest) (*pb.ProjectsResponse, error) {
|
|
var res pb.ProjectsResponse
|
|
path := pb.Orgs_ListProjects_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// DeleteProject deactivates a project. Records owned by the project are
|
|
// kept.
|
|
func (s *proxyOrgsServer) DeleteProject(ctx context.Context, req *pb.DeleteProjectRequest, opts ...grpc.CallOption) (*pb.Project, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.DeleteProject(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// DeleteProject deactivates a project. Records owned by the project are
|
|
// kept.
|
|
func (s *proxyOrgsClient) DeleteProject(ctx context.Context, req *pb.DeleteProjectRequest) (*pb.Project, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.DeleteProject(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// DeleteProject deactivates a project. Records owned by the project are
|
|
// kept.
|
|
func (s *postproxyOrgsClient) DeleteProject(ctx context.Context, req *pb.DeleteProjectRequest) (*pb.Project, error) {
|
|
var res pb.Project
|
|
path := pb.Orgs_DeleteProject_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// ListEvents returns the audit events of the org selected in the token,
|
|
// newest first: every event of the org for a caller with an org-wide
|
|
// role or an org-wide API key, the org-wide events and those of the
|
|
// caller's projects for a member with project grants only, and the
|
|
// events of one project with ProjectID, or for an API key restricted to
|
|
// the project
|
|
func (s *proxyOrgsServer) ListEvents(ctx context.Context, req *pb.ListEventsRequest, opts ...grpc.CallOption) (*pb.EventsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.ListEvents(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// ListEvents returns the audit events of the org selected in the token,
|
|
// newest first: every event of the org for a caller with an org-wide
|
|
// role or an org-wide API key, the org-wide events and those of the
|
|
// caller's projects for a member with project grants only, and the
|
|
// events of one project with ProjectID, or for an API key restricted to
|
|
// the project
|
|
func (s *proxyOrgsClient) ListEvents(ctx context.Context, req *pb.ListEventsRequest) (*pb.EventsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.ListEvents(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// ListEvents returns the audit events of the org selected in the token,
|
|
// newest first: every event of the org for a caller with an org-wide
|
|
// role or an org-wide API key, the org-wide events and those of the
|
|
// caller's projects for a member with project grants only, and the
|
|
// events of one project with ProjectID, or for an API key restricted to
|
|
// the project
|
|
func (s *postproxyOrgsClient) ListEvents(ctx context.Context, req *pb.ListEventsRequest) (*pb.EventsResponse, error) {
|
|
var res pb.EventsResponse
|
|
path := pb.Orgs_ListEvents_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// CreateAPIKey creates a new API key
|
|
func (s *proxyOrgsServer) CreateAPIKey(ctx context.Context, req *pb.CreateAPIKeyRequest, opts ...grpc.CallOption) (*pb.APIKey, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.CreateAPIKey(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// CreateAPIKey creates a new API key
|
|
func (s *proxyOrgsClient) CreateAPIKey(ctx context.Context, req *pb.CreateAPIKeyRequest) (*pb.APIKey, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.CreateAPIKey(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// CreateAPIKey creates a new API key
|
|
func (s *postproxyOrgsClient) CreateAPIKey(ctx context.Context, req *pb.CreateAPIKeyRequest) (*pb.APIKey, error) {
|
|
var res pb.APIKey
|
|
path := pb.Orgs_CreateAPIKey_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// ListAPIKeys lists the API keys of the org selected in the token
|
|
func (s *proxyOrgsServer) ListAPIKeys(ctx context.Context, req *pb.ListAPIKeysRequest, opts ...grpc.CallOption) (*pb.APIKeysResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.ListAPIKeys(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// ListAPIKeys lists the API keys of the org selected in the token
|
|
func (s *proxyOrgsClient) ListAPIKeys(ctx context.Context, req *pb.ListAPIKeysRequest) (*pb.APIKeysResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.ListAPIKeys(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// ListAPIKeys lists the API keys of the org selected in the token
|
|
func (s *postproxyOrgsClient) ListAPIKeys(ctx context.Context, req *pb.ListAPIKeysRequest) (*pb.APIKeysResponse, error) {
|
|
var res pb.APIKeysResponse
|
|
path := pb.Orgs_ListAPIKeys_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// DeleteAPIKey deletes an API key
|
|
func (s *proxyOrgsServer) DeleteAPIKey(ctx context.Context, req *pb.APIKeyRequest, opts ...grpc.CallOption) (*pb.RecordsResult, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.DeleteAPIKey(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// DeleteAPIKey deletes an API key
|
|
func (s *proxyOrgsClient) DeleteAPIKey(ctx context.Context, req *pb.APIKeyRequest) (*pb.RecordsResult, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.DeleteAPIKey(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// DeleteAPIKey deletes an API key
|
|
func (s *postproxyOrgsClient) DeleteAPIKey(ctx context.Context, req *pb.APIKeyRequest) (*pb.RecordsResult, error) {
|
|
var res pb.RecordsResult
|
|
path := pb.Orgs_DeleteAPIKey_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|