code: func (s *Server) CreateExtension(ctx context.Context, request *api.CreateExtensionRequest) (*api.CreateExtensionResponse, error) {
  	if request.Annotations == nil || request.Annotations.Name == "" {
  		return nil, status.Errorf(codes.InvalidArgument, "extension name must be provided")
  	}
  
  	extension := &api.Extension{
  		ID:          identity.NewID(),
  		Annotations: *request.Annotations,
  		Description: request.Description,
  	}
  
  	err := s.store.Update(func(tx store.Tx) error {
  		return store.CreateExtension(tx, extension)
  	})
  
  	switch err {
  	case store.ErrNameConflict:
  		return nil, status.Errorf(codes.AlreadyExists, "extension %s already exists", request.Annotations.Name)
  	case nil:
  		log.G(ctx).WithFields(logrus.Fields{
  			"extension.Name": request.Annotations.Name,
  			"method":         "CreateExtension",
  		}).Debugf("extension created")
  
  		return &api.CreateExtensionResponse{Extension: extension}, nil
  	default:
  		return nil, status.Errorf(codes.Internal, "could not create extension: %v", err.Error())
  	}
  }
docs: // CreateExtension creates an `Extension` based on the provided `CreateExtensionRequest.Extension`
  // and returns a `CreateExtensionResponse`.
  // - Returns `InvalidArgument` if the `CreateExtensionRequest.Extension` is malformed,
  //   or fails validation.
  // - Returns an error if the creation fails.