// Create takes the representation of a imageResource and creates it.  Returns the server's representation of the imageResource, and an error, if there is any.
353581
func (c *images) Create(imageResource *image.Image) (result *image.Image, err error) {
	result = &image.Image{}
	err = c.client.Post().
		Resource("images").
		Body(imageResource).
		Do().
		Into(result)
	return
}
702164
func (s *ServicesService) Create(service *Service) (*Service, *http.Response, error) {
	req, err := s.client.NewRequest("POST", "services", service)
	if err != nil {
		return nil, nil, err
	}

	sv := new(Service)
	resp, err := s.client.Do(req, sv)
	if err != nil {
		return nil, resp, err
	}

	return sv, resp, err
}
999315
func (c *imageSignatures) Create(imageSignature *image.ImageSignature) (result *image.ImageSignature, err error) {
	result = &image.ImageSignature{}
	err = c.client.Post().
		Resource("imagesignatures").
		Body(imageSignature).
		Do().
		Into(result)
	return
}
572752
func (n *Interface) Create(flags uint32) error {
	var err C.virError
	result := C.virInterfaceCreateWrapper(n.ptr, C.uint(flags), &err)
	if result == -1 {
		return makeError(&err)
	}
	return 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
}
1183946
func (c *FakeServices) Create(service *corev1.Service) (result *corev1.Service, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(servicesResource, c.ns, service), &corev1.Service{})

	if obj == nil {
		return nil, err
	}
	return obj.(*corev1.Service), err
}
1138491
func (c *middlewares) Create(middleware *v1alpha1.Middleware) (result *v1alpha1.Middleware, err error) {
	result = &v1alpha1.Middleware{}
	err = c.client.Post().
		Namespace(c.ns).
		Resource("middlewares").
		Body(middleware).
		Do().
		Into(result)
	return
}
679611
func (c *FakeTemplates) Create(templateResource *template.Template) (result *template.Template, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(templatesResource, c.ns, templateResource), &template.Template{})

	if obj == nil {
		return nil, err
	}
	return obj.(*template.Template), err
}
464581
func (al *Apps) Create(img string) {
	al.apps = append(al.apps, App{Image: img})
}
38230
func (s *Service) Create(ctx context.Context, options options.Create) error {
	containers, err := s.collectContainers(ctx)
	if err != nil {
		return err
	}

	if err := s.ensureImageExists(ctx, options.NoBuild, options.ForceBuild); err != nil {
		return err
	}

	if len(containers) != 0 {
		return s.eachContainer(ctx, containers, func(c *container.Container) error {
			_, err := s.recreateIfNeeded(ctx, c, options.NoRecreate, options.ForceRecreate)
			return err
		})
	}

	namer, err := s.namer(ctx, 1)
	if err != nil {
		return err
	}

	_, err = s.createContainer(ctx, namer, "", nil, false)
	return err
}
995777
func (e *EnvironmentService) Create(environment *Environment) (data *EnvironmentResult, err error) {
	body, err := JSONReader(environment)
	if err != nil {
		return
	}

	err = e.client.magicRequestDecoder("POST", "environments", body, &data)
	return
}
217250
func (c Creator) Create(obj *unstructured.Unstructured, namespace string) (*unstructured.Unstructured, error) {
	if len(obj.GetNamespace()) > 0 {
		namespace = obj.GetNamespace()
	}
	mapping, err := c.RESTMapper.RESTMapping(obj.GroupVersionKind().GroupKind(), obj.GroupVersionKind().Version)
	if err != nil {
		return nil, err
	}
	if mapping.Scope.Name() == meta.RESTScopeNameRoot {
		namespace = ""
	}

	return c.Client.Resource(mapping.Resource).Namespace(namespace).Create(obj, metav1.CreateOptions{})
}
1361526
func (c *FakeProjects) Create(projectResource *project.Project) (result *project.Project, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootCreateAction(projectsResource, projectResource), &project.Project{})
	if obj == nil {
		return nil, err
	}
	return obj.(*project.Project), err
}
1197380
func (c *imageStreamMappings) Create(imageStreamMapping *image.ImageStreamMapping) (result *v1.Status, err error) {
	result = &v1.Status{}
	err = c.client.Post().
		Namespace(c.ns).
		Resource("imagestreammappings").
		Body(imageStreamMapping).
		Do().
		Into(result)
	return
}
523302
func (m *GormResourceRepository) Create(ctx context.Context, resource *Resource) error {
	defer goa.MeasureSince([]string{"goa", "db", "resource", "create"}, time.Now())

	// If no identifier has been specified for the new resource, then generate one
	if resource.ResourceID == "" {
		resource.ResourceID = uuid.NewV4().String()
	}

	if resource.ResourceTypeID.String() == "" {
		resourceType, err := m.resourceTypeRepo.Lookup(ctx, resource.ResourceType.Name)
		if err != nil {
			log.Error(ctx, map[string]interface{}{
				"resource_type": resource.ResourceType.Name,
				"err":           err,
			}, "unable to find the resource type")
			return errs.WithStack(err)
		}
		resource.ResourceTypeID = resourceType.ResourceTypeID
	}

	err := m.db.Create(resource).Error
	if err != nil {
		// Organization names must be unique
		if gormsupport.IsUniqueViolation(err, "unique_organization_names") {
			log.Error(ctx, map[string]interface{}{
				"err":  err,
				"name": resource.Name,
			}, "unable to create organization resource as an organization with the same name already exists")
			return errors.NewDataConflictError(fmt.Sprintf("organization with same name already exists, '%s'", resource.Name))
		}
		if gormsupport.IsUniqueViolation(err, "resource_pkey") {
			return errors.NewDataConflictError(fmt.Sprintf("resource with ID %s already exists", resource.ResourceID))
		}

		log.Error(ctx, map[string]interface{}{
			"resource_id": resource.ResourceID,
			"err":         err,
		}, "unable to create the resource")
		return errs.WithStack(err)
	}

	log.Info(ctx, map[string]interface{}{
		"resource_id": resource.ResourceID,
	}, "Resource created!")
	return nil
}
15001
func (c *Captcha) Create(num int, t StrType) (*Image, string) {
	if num <= 0 {
		num = 4
	}
	dst := NewImage(c.size.X, c.size.Y)
	//tmp := NewImage(c.size.X, c.size.Y)
	c.drawBkg(dst)
	c.drawNoises(dst)

	str := string(c.randStr(num, int(t)))
	c.drawString(dst, str)
	//c.drawString(tmp, str)

	return dst, str
}
510896
func (r *REST) Create(ctx context.Context, obj runtime.Object, _ rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error) {
	resourceAccessReview, ok := obj.(*authorizationapi.ResourceAccessReview)
	if !ok {
		return nil, kapierrors.NewBadRequest(fmt.Sprintf("not a resourceAccessReview: %#v", obj))
	}
	if errs := authorizationvalidation.ValidateResourceAccessReview(resourceAccessReview); len(errs) > 0 {
		return nil, kapierrors.NewInvalid(authorization.Kind(resourceAccessReview.Kind), "", errs)
	}

	user, ok := apirequest.UserFrom(ctx)
	if !ok {
		return nil, kapierrors.NewInternalError(errors.New("missing user on request"))
	}

	// if a namespace is present on the request, then the namespace on the on the RAR is overwritten.
	// This is to support backwards compatibility.  To have gotten here in this state, it means that
	// the authorizer decided that a user could run an RAR against this namespace
	if namespace := apirequest.NamespaceValue(ctx); len(namespace) > 0 {
		resourceAccessReview.Action.Namespace = namespace

	} else if err := r.isAllowed(user, resourceAccessReview); err != nil {
		// this check is mutually exclusive to the condition above.  localSAR and localRAR both clear the namespace before delegating their calls
		// We only need to check if the RAR is allowed **again** if the authorizer didn't already approve the request for a legacy call.
		return nil, err
	}

	attributes := util.ToDefaultAuthorizationAttributes(nil, resourceAccessReview.Action.Namespace, resourceAccessReview.Action)
	subjects, err := r.subjectLocator.AllowedSubjects(attributes)
	users, groups := authorizationutil.RBACSubjectsToUsersAndGroups(subjects, attributes.GetNamespace())

	response := &authorizationapi.ResourceAccessReviewResponse{
		Namespace: resourceAccessReview.Action.Namespace,
		Users:     sets.NewString(users...),
		Groups:    sets.NewString(groups...),
	}
	if err != nil {
		response.EvaluationError = err.Error()
	}

	return response, nil
}