// Create creates a new tracker query in the repository
// returns BadParameterError, ConversionError or InternalError
176804
func (r *GormTrackerQueryRepository) Create(ctx context.Context, tq TrackerQuery) (*TrackerQuery, error) {
	wiType, err := r.witr.Load(ctx, tq.WorkItemTypeID)
	if err != nil {
		return nil, errors.NewBadParameterError("WorkItemTypeID", tq.WorkItemTypeID)
	}

	allowedWIT, err := r.wir.CheckTypeAndSpaceShareTemplate(ctx, wiType, tq.SpaceID)
	if err != nil {
		return nil, err

	}
	if !allowedWIT {
		return nil, err
	}

	if err := r.db.Create(&tq).Error; err != nil {
		return nil, errors.NewInternalError(ctx, r.db.Error)
	}
	return &tq, nil
}
1360042
func (m *Mercury) Create(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.TxnResponse, error) {
	return m.BatchCreate(ctx, map[string]string{key: val}, opts...)
}
868264
func (c *persistentVolumes) Create(persistentVolume *api.PersistentVolume) (result *api.PersistentVolume, err error) {
	result = &api.PersistentVolume{}
	err = c.client.Post().
		Resource("persistentvolumes").
		Body(persistentVolume).
		Do().
		Into(result)
	return
}
384110
func (c *services) Create(service *api.Service) (result *api.Service, err error) {
	result = &api.Service{}
	err = c.client.Post().
		Namespace(c.ns).
		Resource("services").
		Body(service).
		Do().
		Into(result)
	return
}
195646
func (c *resourceQuotas) Create(resourceQuota *api.ResourceQuota) (result *api.ResourceQuota, err error) {
	result = &api.ResourceQuota{}
	err = c.r.Post().Namespace(c.ns).Resource("resourceQuotas").Body(resourceQuota).Do().Into(result)
	return
}
1366782
func (tx *tx) create(table string, o api.StoreObject) error {
	if tx.lookup(table, indexID, o.GetID()) != nil {
		return ErrExist
	}

	copy := o.CopyStoreObject()
	meta := copy.GetMeta()
	if err := touchMeta(&meta, tx.curVersion); err != nil {
		return err
	}
	copy.SetMeta(meta)

	err := tx.memDBTx.Insert(table, copy)
	if err == nil {
		tx.changelist = append(tx.changelist, copy.EventCreate())
		o.SetMeta(meta)
	}
	return err
}
790727
func (c *projects) Create(projectResource *project.Project) (result *project.Project, err error) {
	result = &project.Project{}
	err = c.client.Post().
		Resource("projects").
		Body(projectResource).
		Do().
		Into(result)
	return
}
1120089
func (c *FakeEndpoints) Create(endpoints *corev1.Endpoints) (result *corev1.Endpoints, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(endpointsResource, c.ns, endpoints), &corev1.Endpoints{})

	if obj == nil {
		return nil, err
	}
	return obj.(*corev1.Endpoints), err
}
1263410
func (m *GormAreaRepository) Create(ctx context.Context, u *Area) error {
	defer goa.MeasureSince([]string{"goa", "db", "area", "create"}, time.Now())

	u.HumanFriendlyNumber = numbersequence.NewHumanFriendlyNumber(u.SpaceID, u.TableName())

	if u.ID == uuid.Nil {
		u.ID = uuid.NewV4()
		u.Path = path.Path{u.ID}
	}
	if u.Path == nil || len(u.Path) == 0 {
		u.Path = path.Path{u.ID}
	} else {
		if u.Path.This() != u.ID {
			return errs.Errorf("area path has to end with area ID %s", u.ID)
		}
	}

	err := m.db.Create(u).Error
	if err != nil {
		// ( name, spaceID ,path ) needs to be unique
		if gormsupport.IsUniqueViolation(err, "areas_name_space_id_path_unique") {
			log.Error(ctx, map[string]interface{}{
				"err":      err,
				"name":     u.Name,
				"path":     u.Path,
				"space_id": u.SpaceID,
			}, "unable to create child area because an area in the same path already exists")
			return errors.NewDataConflictError(fmt.Sprintf("area already exists with name = %s , space_id = %s , path = %s ", u.Name, u.SpaceID.String(), u.Path.ParentPath().String()))
		}
		log.Error(ctx, map[string]interface{}{}, "error adding Area: %s", err.Error())
		return err
	}
	return nil
}
1157545
func (s *FriendshipService) Create(params *FriendshipCreateParams) (*User, *http.Response, error) {
	user := new(User)
	apiError := new(APIError)
	resp, err := s.sling.New().Post("create.json").QueryStruct(params).Receive(user, apiError)
	return user, resp, relevantError(err, *apiError)
}
1066250
func (s *InstantiateREST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
	if err := rest.BeforeCreate(Strategy, ctx, obj); err != nil {
		return nil, err
	}
	if err := createValidation(obj); err != nil {
		return nil, err
	}

	request := obj.(*buildapi.BuildRequest)
	if request.TriggeredBy == nil {
		buildTriggerCauses := []buildapi.BuildTriggerCause{}
		request.TriggeredBy = append(buildTriggerCauses,
			buildapi.BuildTriggerCause{
				Message: buildapi.BuildTriggerCauseManualMsg,
			},
		)
	}
	return s.generator.InstantiateInternal(ctx, request)
}
383558
func (s *REST) Create(ctx context.Context, obj runtime.Object, _ rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
	mapping, ok := obj.(*userinternal.UserIdentityMapping)
	if !ok {
		return nil, kerrs.NewBadRequest("invalid type")
	}
	Strategy.PrepareForCreate(ctx, mapping)
	createdMapping, _, err := s.createOrUpdate(ctx, obj, true)
	return createdMapping, err
}
797467
func (c *persistentVolumeClaims) Create(persistentVolumeClaim *v1.PersistentVolumeClaim) (result *v1.PersistentVolumeClaim, err error) {
	result = &v1.PersistentVolumeClaim{}
	err = c.client.Post().
		Namespace(c.ns).
		Resource("persistentvolumeclaims").
		Body(persistentVolumeClaim).
		Do().
		Into(result)
	return
}
15540
func (c *ciliumEndpoints) Create(ciliumEndpoint *v2.CiliumEndpoint) (result *v2.CiliumEndpoint, err error) {
	result = &v2.CiliumEndpoint{}
	err = c.client.Post().
		Namespace(c.ns).
		Resource("ciliumendpoints").
		Body(ciliumEndpoint).
		Do().
		Into(result)
	return
}
1080562
func (s *Server) Create(ctx context.Context, q *SessionCreateRequest) (*SessionResponse, error) {
	if q.Token != "" {
		return nil, status.Errorf(codes.Unauthenticated, "token-based session creation no longer supported. please upgrade argocd cli to v0.7+")
	}
	if q.Username == "" || q.Password == "" {
		return nil, status.Errorf(codes.Unauthenticated, "no credentials supplied")
	}
	err := s.mgr.VerifyUsernamePassword(q.Username, q.Password)
	if err != nil {
		return nil, err
	}
	jwtToken, err := s.mgr.Create(q.Username, 0)
	if err != nil {
		return nil, err
	}
	return &SessionResponse{Token: jwtToken}, nil
}
721056
func (db *Database) Create() error {
	resp := &struct {
		Error  string `json:"error"`
		Reason string `json:"reason"`
		Ok     bool   `json:"ok"`
	}{}

	body, err := db.Req.Put("")
	err = json.Unmarshal(body, resp)
	if err != nil {
		return err
	}

	if resp.Error != "" {
		return errors.New(resp.Error + " " + resp.Reason)
	}
	if !resp.Ok {
		return errors.New("Couch returned failure when creating [" + db.Name + "]")
	}

	return nil
}
1286583
func (remoteAccessVpnUserApi *RemoteAccessVpnUserApi) Create(remoteAccessVpnUser RemoteAccessVpnUser) (bool, error) {
	send, merr := json.Marshal(remoteAccessVpnUser)
	if merr != nil {
		return false, merr
	}
	_, err := remoteAccessVpnUserApi.entityService.Create(send, map[string]string{})
	return err == nil, err
}