2022-04-14 12:19:18 +00:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
instance_grpc "github.com/zitadel/zitadel/internal/api/grpc/instance"
|
|
|
|
"github.com/zitadel/zitadel/internal/api/grpc/object"
|
|
|
|
admin_pb "github.com/zitadel/zitadel/pkg/grpc/admin"
|
2022-04-14 12:19:18 +00:00
|
|
|
)
|
|
|
|
|
2022-06-27 09:12:06 +00:00
|
|
|
func (s *Server) GetMyInstance(ctx context.Context, _ *admin_pb.GetMyInstanceRequest) (*admin_pb.GetMyInstanceResponse, error) {
|
|
|
|
instance, err := s.query.Instance(ctx, true)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.GetMyInstanceResponse{
|
|
|
|
Instance: instance_grpc.InstanceDetailToPb(instance),
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) ListInstanceDomains(ctx context.Context, req *admin_pb.ListInstanceDomainsRequest) (*admin_pb.ListInstanceDomainsResponse, error) {
|
2022-04-14 12:19:18 +00:00
|
|
|
queries, err := ListInstanceDomainsRequestToModel(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
domains, err := s.query.SearchInstanceDomains(ctx, queries)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &admin_pb.ListInstanceDomainsResponse{
|
|
|
|
Result: instance_grpc.DomainsToPb(domains.Domains),
|
|
|
|
Details: object.ToListDetails(
|
|
|
|
domains.Count,
|
|
|
|
domains.Sequence,
|
|
|
|
domains.Timestamp,
|
|
|
|
),
|
|
|
|
}, nil
|
|
|
|
}
|