// Create returns a new pointer to Carbon instance from a specific date and time.
// If the location is invalid, it returns an error instead.
16880
func Create(y int, mon time.Month, d, h, m, s, ns int, location string) (*Carbon, error) {
	l, err := time.LoadLocation(location)
	if err != nil {
		return nil, err
	}
	return create(y, mon, d, h, m, s, ns, l), nil
}
958646
func (m *Memory) Create(ctx context.Context, i backend.Item) (*backend.Lease, error) {
	if len(i.Key) == 0 {
		return nil, trace.BadParameter("missing parameter key")
	}
	m.Lock()
	defer m.Unlock()
	m.removeExpired()
	if m.tree.Get(&btreeItem{Item: i}) != nil {
		return nil, trace.AlreadyExists("key %q already exists", string(i.Key))
	}
	m.processEvent(backend.Event{
		Type: backend.OpPut,
		Item: i,
	})
	return m.newLease(i), nil
}
1360212
func (mr *MockStorageClassInterfaceMockRecorder) Create(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockStorageClassInterface)(nil).Create), arg0)
}
1179170
func (instanceApi *InstanceApi) Create(instance Instance) (*Instance, error) {
	send, merr := json.Marshal(instance)
	if merr != nil {
		return nil, merr
	}
	body, err := instanceApi.entityService.Create(send, map[string]string{})
	if err != nil {
		return nil, err
	}
	return parseInstance(body), nil
}
1010802
func (c *CodebaseController) Create(ctx *app.CreateCodebaseContext) error {
	_, err := login.ContextIdentity(ctx)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))
	}
	var cb *codebase.Codebase
	err = application.Transactional(c.db, func(appl application.Application) error {
		cb, err = appl.Codebases().Load(ctx, ctx.CodebaseID)
		return err
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	ns, err := c.getCheNamespace(ctx)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, goa.ErrInternal(err.Error()))
	}
	cheClient, err := c.NewCheClient(ctx, ns)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, goa.ErrInternal(err.Error()))
	}

	stackID := "java-centos"
	if cb.StackID != nil && *cb.StackID != "" {
		stackID = *cb.StackID
	}

	workspace := che.WorkspaceRequest{
		Branch:     getWorkspaceBranch(ctx),
		StackID:    stackID,
		Repository: cb.URL,
	}
	workspaceResp, err := cheClient.CreateWorkspace(ctx, workspace)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"codebase_id": cb.ID,
			"stack_id":    stackID,
			"err":         err,
		}, "unable to create workspaces")
		if werr, ok := err.(*che.StarterError); ok {
			log.Error(ctx, map[string]interface{}{
				"codebase_id": cb.ID,
				"stack_id":    stackID,
				"err":         err,
			}, "unable to create workspaces: %s", werr.String())
		}
		return jsonapi.JSONErrorResponse(ctx, goa.ErrInternal(err.Error()))
	}

	err = application.Transactional(c.db, func(appl application.Application) error {
		cb.LastUsedWorkspace = workspaceResp.Config.Name
		_, err := appl.Codebases().Save(ctx, cb)
		return err
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	ideURL := workspaceResp.GetHrefByRelOfWorkspaceLink(che.IdeUrlRel)
	resp := &app.WorkspaceOpen{
		Links: &app.WorkspaceOpenLinks{
			Open: &ideURL,
		},
	}
	return ctx.OK(resp)
}
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...)
}
397682
func (c *SpaceCodebasesController) Create(ctx *app.CreateSpaceCodebasesContext) error {
	identityID, err := login.ContextIdentity(ctx)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))
	}
	// Validate Request
	if ctx.Payload.Data == nil {
		return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("data", nil).Expected("not nil"))
	}
	reqIter := ctx.Payload.Data
	if reqIter.Attributes.Type == nil {
		return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("data.attributes.type", nil).Expected("not nil"))
	}
	if reqIter.Attributes.URL == nil {
		return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("data.attributes.url", nil).Expected("not nil"))
	}
	// the default value of cveScan
	cveScan := false
	if reqIter.Attributes.CveScan != nil {
		cveScan = *reqIter.Attributes.CveScan
	}

	var cdb *codebase.Codebase
	err = application.Transactional(c.db, func(appl application.Application) error {
		sp, err := appl.Spaces().Load(ctx, ctx.SpaceID)
		if err != nil {
			return err
		}
		if *identityID != sp.OwnerID {
			return errors.NewForbiddenError("user is not the space owner")
		}
		cdb = &codebase.Codebase{
			SpaceID: ctx.SpaceID,
			Type:    *reqIter.Attributes.Type,
			URL:     *reqIter.Attributes.URL,
			StackID: reqIter.Attributes.StackID,
			CVEScan: cveScan,
		}
		return appl.Codebases().Create(ctx, cdb)
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}

	res := &app.CodebaseSingle{
		Data: ConvertCodebase(ctx.Request, *cdb),
	}
	ctx.ResponseData.Header().Set("Location", rest.AbsoluteURL(ctx.Request, app.CodebaseHref(res.Data.ID)))
	return ctx.Created(res)
}
849652
func (d *DevTools) Create(ctx context.Context) (*Target, error) {
	return d.CreateURL(ctx, "")
}
408039
func (s *DB) Create(value interface{}) *DB {
	scope := s.NewScope(value)
	return scope.callCallbacks(s.parent.callbacks.creates).db
}
28074
func (m *GenericDriver) Create() error {
	err := transaction(m.DB, func(tx *sql.Tx) error {
		_, err := tx.Exec(m.Dialect.CreateTableSQL())
		return err
	})

	return err
}
893656
func (c *FakeExamples) Create(example *crv1.Example) (result *crv1.Example, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(examplesResource, c.ns, example), &crv1.Example{})

	if obj == nil {
		return nil, err
	}
	return obj.(*crv1.Example), 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
}
740083
func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) (retErr error) {
	if opts != nil && len(opts.StorageOpt) != 0 {
		if _, ok := opts.StorageOpt["size"]; ok {
			return fmt.Errorf("--storage-opt size is only supported for ReadWrite Layers")
		}
	}
	return d.create(id, parent, opts)
}
1089143
func (p *Project) Create(ctx context.Context, options options.Create, services ...string) error {
	if options.NoRecreate && options.ForceRecreate {
		return fmt.Errorf("no-recreate and force-recreate cannot be combined")
	}
	if err := p.initialize(ctx); err != nil {
		return err
	}
	return p.perform(events.ProjectCreateStart, events.ProjectCreateDone, services, wrapperAction(func(wrapper *serviceWrapper, wrappers map[string]*serviceWrapper) {
		wrapper.Do(wrappers, events.ServiceCreateStart, events.ServiceCreate, func(service Service) error {
			return service.Create(ctx, options)
		})
	}), nil)
}
300895
func (c *ResourceClient) Create(ctx context.Context, resourceCreateRequest *ResourceCreateRequest) (*Resource, error) {
	p := "/resource"

	req, err := c.backend.NewRequest(http.MethodPost, p, nil, resourceCreateRequest)
	if err != nil {
		return nil, err
	}

	var resp Resource
	_, err = c.backend.Do(ctx, req, &resp, func(code int) error {
		switch code {
		case 400, 401, 409, 500:
			return &Error{}
		default:
			return nil
		}
	})
	if err != nil {
		return nil, err
	}

	return &resp, nil
}
203069
func (c *FakeRuntimeClasses) Create(runtimeClass *v1alpha1.RuntimeClass) (result *v1alpha1.RuntimeClass, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootCreateAction(runtimeclassesResource, runtimeClass), &v1alpha1.RuntimeClass{})
	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.RuntimeClass), err
}
1097315
func (co *Consolidator) Create(query string) (r *Result, created bool) {
	co.mu.Lock()
	defer co.mu.Unlock()
	if r, ok := co.queries[query]; ok {
		return r, false
	}
	r = &Result{consolidator: co, query: query}
	r.executing.Lock()
	co.queries[query] = r
	return r, true
}