code: func (s *Server) CreateNetwork(ctx context.Context, request *api.CreateNetworkRequest) (*api.CreateNetworkResponse, error) {
  	if err := validateNetworkSpec(request.Spec, s.pg); err != nil {
  		return nil, err
  	}
  
  	// TODO(mrjana): Consider using `Name` as a primary key to handle
  	// duplicate creations. See #65
  	n := &api.Network{
  		ID:   identity.NewID(),
  		Spec: *request.Spec,
  	}
  
  	err := s.store.Update(func(tx store.Tx) error {
  		if request.Spec.Ingress {
  			if n, err := allocator.GetIngressNetwork(s.store); err == nil {
  				return status.Errorf(codes.AlreadyExists, "ingress network (%s) is already present", n.ID)
  			} else if err != allocator.ErrNoIngress {
  				return status.Errorf(codes.Internal, "failed ingress network presence check: %v", err)
  			}
  		}
  		return store.CreateNetwork(tx, n)
  	})
  	if err != nil {
  		return nil, err
  	}
  
  	return &api.CreateNetworkResponse{
  		Network: n,
  	}, nil
  }
docs: // CreateNetwork creates and returns a Network based on the provided NetworkSpec.
  // - Returns `InvalidArgument` if the NetworkSpec is malformed.
  // - Returns an error if the creation fails.