// CREATE REST call
333197
func httpCreateAciGw(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	log.Debugf("Received httpGetAciGw: %+v", vars)

	var obj AciGw
	key := vars["key"]

	// Get object from the request
	err := json.NewDecoder(r.Body).Decode(&obj)
	if err != nil {
		log.Errorf("Error decoding aciGw create request. Err %v", err)
		return nil, err
	}

	// set the key
	obj.Key = key

	// Create the object
	err = CreateAciGw(&obj)
	if err != nil {
		log.Errorf("CreateAciGw error for: %+v. Err: %v", obj, err)
		return nil, err
	}

	// Return the obj
	return obj, 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)
}
1258516
func (callflow *CallFlow) Create(client *messagebird.Client) error {
	var data struct {
		Data []CallFlow `json:"data"`
	}
	if err := client.Request(&data, http.MethodPost, apiRoot+"/call-flows/", callflow); err != nil {
		return err
	}
	*callflow = data.Data[0]
	return nil
}
447825
func (r *REST) Create(ctx context.Context, obj runtime.Object, _ rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
	rulesReview, ok := obj.(*authorizationapi.SubjectRulesReview)
	if !ok {
		return nil, kapierrors.NewBadRequest(fmt.Sprintf("not a SubjectRulesReview: %#v", obj))
	}
	namespace := apirequest.NamespaceValue(ctx)
	if len(namespace) == 0 {
		return nil, kapierrors.NewBadRequest(fmt.Sprintf("namespace is required on this type: %v", namespace))
	}

	userToCheck := &user.DefaultInfo{
		Name:   rulesReview.Spec.User,
		Groups: rulesReview.Spec.Groups,
		Extra:  map[string][]string{},
	}
	if len(rulesReview.Spec.Scopes) > 0 {
		userToCheck.Extra[authorizationapi.ScopesKey] = rulesReview.Spec.Scopes
	}

	rules, errors := GetEffectivePolicyRules(apirequest.WithUser(ctx, userToCheck), r.ruleResolver, r.clusterRoleGetter)

	ret := &authorizationapi.SubjectRulesReview{
		Status: authorizationapi.SubjectRulesReviewStatus{
			Rules: rbacconversion.Convert_rbacv1_PolicyRules_To_authorization_PolicyRules(rules), //TODO can we fix this ?
		},
	}

	if len(errors) != 0 {
		ret.Status.EvaluationError = kutilerrors.NewAggregate(errors).Error()
	}

	return ret, nil
}
1247193
func (mr *MockSecretInterfaceMockRecorder) Create(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockSecretInterface)(nil).Create), arg0)
}
115007
func (s *ServicesService) Create(svc *Service) (*Service, *http.Response, error) {
	return s.CreateWithContext(context.TODO(), svc)
}
281403
func (g *GistsService) Create(uri *Hyperlink, uriParams M, requestParams interface{}) (gist *Gist, result *Result) {
	url, err := ExpandWithDefault(uri, &GistsURL, uriParams)
	if err != nil {
		return nil, &Result{Err: err}
	}

	result = g.client.post(url, requestParams, &gist)
	return
}
125624
func httpCreateGlobal(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	log.Debugf("Received httpGetGlobal: %+v", vars)

	var obj Global
	key := vars["key"]

	// Get object from the request
	err := json.NewDecoder(r.Body).Decode(&obj)
	if err != nil {
		log.Errorf("Error decoding global create request. Err %v", err)
		return nil, err
	}

	// set the key
	obj.Key = key

	// Create the object
	err = CreateGlobal(&obj)
	if err != nil {
		log.Errorf("CreateGlobal error for: %+v. Err: %v", obj, err)
		return nil, err
	}

	// Return the obj
	return obj, nil
}
21886
func (mr *MockNodeInterfaceMockRecorder) Create(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockNodeInterface)(nil).Create), arg0)
}
711044
func (s *IssueService) create(req *restful.Request, resp *restful.Response) {
	// TODO (m0sth8): Check permissions
	raw := &TargetIssueEntity{}

	if err := req.ReadEntity(raw); err != nil {
		logrus.Error(stackerr.Wrap(err))
		resp.WriteServiceError(
			http.StatusBadRequest,
			services.WrongEntityErr,
		)
		return
	}
	// check target field, it must be present
	if !s.IsId(raw.Target) {
		resp.WriteServiceError(
			http.StatusBadRequest,
			services.NewBadReq("Target is wrong"),
		)
		return
	}
	// validate other fields
	if err := validator.WithTag("creating").Validate(raw); err != nil {
		resp.WriteServiceError(
			http.StatusBadRequest,
			services.NewBadReq("Validation error: %s", err.Error()),
		)
		return
	}

	mgr := s.Manager()
	defer mgr.Close()

	// load target and project
	t, err := mgr.Targets.GetById(mgr.ToId(raw.Target))
	if err != nil {
		if mgr.IsNotFound(err) {
			resp.WriteServiceError(http.StatusBadRequest, services.NewBadReq("Target not found"))
			return
		}
		logrus.Error(stackerr.Wrap(err))
		resp.WriteServiceError(http.StatusInternalServerError, services.DbErr)
		return
	}

	//	current user should have a permission to create issue there
	u := filters.GetUser(req)

	if sErr := services.Must(services.HasProjectIdPermission(mgr, u, t.Project)); sErr != nil {
		sErr.Write(resp)
		return
	}

	newObj := &issue.TargetIssue{
		Project: t.Project,
		Target:  t.Id,
	}
	updateTargetIssue(raw, newObj)
	newObj.AddUserReportActivity(u.Id)

	obj, err := mgr.Issues.Create(newObj)
	if err != nil {
		if mgr.IsDup(err) {
			resp.WriteServiceError(
				http.StatusConflict,
				services.DuplicateErr)
			return
		}
		logrus.Error(stackerr.Wrap(err))
		resp.WriteServiceError(http.StatusInternalServerError, services.DbErr)
		return
	}
	// TODO (m0sth8): extract to worker
	func(mgr *manager.Manager) {
		tgt, err := mgr.Targets.GetById(obj.Target)
		if err != nil {
			logrus.Error(stackerr.Wrap(err))
			return
		}
		err = mgr.Targets.UpdateSummary(tgt)
		if err != nil {
			logrus.Error(stackerr.Wrap(err))
			return
		}
	}(s.Manager())
	resp.WriteHeader(http.StatusCreated)
	resp.WriteEntity(obj)
}
1360212
func (mr *MockStorageClassInterfaceMockRecorder) Create(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockStorageClassInterface)(nil).Create), arg0)
}
820228
func CreateResource(r rest.Creater, scope *RequestScope, admission admission.Interface) http.HandlerFunc {
	return createHandler(&namedCreaterAdapter{r}, scope, admission, false)
}
105526
func (r Account_Reports_Request) CreateRequest(recipientContact *datatypes.Account_Contact, reason *string, reportType *string, requestorContact *datatypes.Account_Contact) (resp datatypes.Account_Reports_Request, err error) {
	params := []interface{}{
		recipientContact,
		reason,
		reportType,
		requestorContact,
	}
	err = r.Session.DoRequest("SoftLayer_Account_Reports_Request", "createRequest", params, &r.Options, &resp)
	return
}
1172291
func (a *API) Create(args params.BackupsCreateArgs) (params.BackupsMetadataResult, error) {
	args.KeepCopy = true
	args.NoDownload = true

	apiv2 := APIv2{a}
	result, err := apiv2.Create(args)
	if err != nil {
		return result, errors.Trace(err)
	}
	return result, nil
}
979122
func (_m *SessionServiceServer) Create(_a0 context.Context, _a1 *session.SessionCreateRequest) (*session.SessionResponse, error) {
	ret := _m.Called(_a0, _a1)

	var r0 *session.SessionResponse
	if rf, ok := ret.Get(0).(func(context.Context, *session.SessionCreateRequest) *session.SessionResponse); ok {
		r0 = rf(_a0, _a1)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*session.SessionResponse)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, *session.SessionCreateRequest) error); ok {
		r1 = rf(_a0, _a1)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1319367
func (ps *PropertiesService) Create(ctx context.Context, name string, value string, pr *PropertyRequest) (responseIsValid bool, resp *APIResponse, err error) {
	responseBuffer := bytes.NewBuffer([]byte(""))

	ps.log.WithField("endpoint", "PropertiesServices.Create").Info("Calling endpoint")
	_, resp, err = ps.client.postAction(ctx, &APIClientRequest{
		Path: fmt.Sprintf("/properties/%s/%d/%s/%d/%s/%s",
			pr.Pipeline, pr.PipelineCounter,
			pr.Stage, pr.StageCounter,
			pr.Job, name,
		),
		ResponseType: responseTypeText,
		ResponseBody: responseBuffer,
		RequestBody:  fmt.Sprintf("%s=%s", name, value),
		Headers: map[string]string{
			"Confirm": "true",
		},
	})
	resp.Body = responseBuffer.String()
	responseIsValid = resp.Body == fmt.Sprintf("Property '%s' created with value '%s'", name, value)

	return
}
1143388
func (r *BindingREST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (out runtime.Object, err error) {
	binding := obj.(*api.Binding)

	// TODO: move me to a binding strategy
	if errs := validation.ValidatePodBinding(binding); len(errs) != 0 {
		return nil, errs.ToAggregate()
	}

	if createValidation != nil {
		if err := createValidation(binding.DeepCopyObject()); err != nil {
			return nil, err
		}
	}

	err = r.assignPod(ctx, binding.Name, binding.Target.Name, binding.Annotations, dryrun.IsDryRun(options.DryRun))
	out = &metav1.Status{Status: metav1.StatusSuccess}
	return
}