diff --git a/docs/docs/apis/proto/admin.md b/docs/docs/apis/proto/admin.md index 98aed2c13f..4b8106d53c 100644 --- a/docs/docs/apis/proto/admin.md +++ b/docs/docs/apis/proto/admin.md @@ -56,16 +56,28 @@ Set the default language GET: /languages/default +### GetMyInstance + +> **rpc** GetMyInstance([GetMyInstanceRequest](#getmyinstancerequest)) +[GetMyInstanceResponse](#getmyinstanceresponse) + +Returns the details of the instance + + + + GET: /instances/me + + ### ListInstanceDomains > **rpc** ListInstanceDomains([ListInstanceDomainsRequest](#listinstancedomainsrequest)) [ListInstanceDomainsResponse](#listinstancedomainsresponse) -Returns the domains of an instance +Returns the domains of the instance - GET: /domains + POST: /domains/_search ### ListSecretGenerators @@ -2348,6 +2360,23 @@ This is an empty request +### GetMyInstanceRequest +This is an empty request + + + + +### GetMyInstanceResponse + + + +| Field | Type | Description | Validation | +| ----- | ---- | ----------- | ----------- | +| instance | zitadel.instance.v1.InstanceDetail | - | | + + + + ### GetOIDCSettingsRequest This is an empty request diff --git a/internal/api/grpc/admin/instance.go b/internal/api/grpc/admin/instance.go index d7d3046f0a..4359e73f18 100644 --- a/internal/api/grpc/admin/instance.go +++ b/internal/api/grpc/admin/instance.go @@ -8,7 +8,17 @@ import ( admin_pb "github.com/zitadel/zitadel/pkg/grpc/admin" ) -func (s *Server) GetInstanceDomains(ctx context.Context, req *admin_pb.ListInstanceDomainsRequest) (*admin_pb.ListInstanceDomainsResponse, error) { +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) { queries, err := ListInstanceDomainsRequestToModel(req) if err != nil { return nil, err diff --git a/internal/api/grpc/instance/converter.go b/internal/api/grpc/instance/converter.go index 3feb9e675d..8cbbed0902 100644 --- a/internal/api/grpc/instance/converter.go +++ b/internal/api/grpc/instance/converter.go @@ -1,6 +1,7 @@ package org import ( + "github.com/zitadel/zitadel/cmd/build" "github.com/zitadel/zitadel/internal/api/grpc/object" "github.com/zitadel/zitadel/internal/errors" "github.com/zitadel/zitadel/internal/query" @@ -26,6 +27,7 @@ func InstanceToPb(instance *query.Instance) *instance_pb.Instance { Id: instance.InstanceID(), Name: instance.Name, Domains: DomainsToPb(instance.Domains), + Version: build.Version(), } } @@ -40,6 +42,7 @@ func InstanceDetailToPb(instance *query.Instance) *instance_pb.InstanceDetail { Id: instance.InstanceID(), Name: instance.Name, Domains: DomainsToPb(instance.Domains), + Version: build.Version(), } } diff --git a/proto/zitadel/admin.proto b/proto/zitadel/admin.proto index c9e0add517..2217a8bd97 100644 --- a/proto/zitadel/admin.proto +++ b/proto/zitadel/admin.proto @@ -184,10 +184,21 @@ service AdminService { }; } - // Returns the domains of an instance + // Returns the details of the instance + rpc GetMyInstance(GetMyInstanceRequest) returns (GetMyInstanceResponse) { + option (google.api.http) = { + get: "/instances/me"; + }; + + option (zitadel.v1.auth_option) = { + permission: "iam.read"; + }; + } + + // Returns the domains of the instance rpc ListInstanceDomains(ListInstanceDomainsRequest) returns (ListInstanceDomainsResponse) { option (google.api.http) = { - get: "/domains"; + post: "/domains/_search"; }; } @@ -2664,6 +2675,13 @@ message GetDefaultOrgResponse { zitadel.org.v1.Org org = 1; } +//This is an empty request +message GetMyInstanceRequest {} + +message GetMyInstanceResponse { + zitadel.instance.v1.InstanceDetail instance = 1; +} + message ListInstanceDomainsRequest { zitadel.v1.ListQuery query = 1; // the field the result is sorted