// CreateACLEntry creates and returns a new ACL entry.
488354
func (c *Client) CreateACLEntry(i *CreateACLEntryInput) (*ACLEntry, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.ACL == "" {
		return nil, ErrMissingACL
	}

	if i.IP == "" {
		return nil, ErrMissingIP
	}

	path := fmt.Sprintf("/service/%s/acl/%s/entry", i.Service, i.ACL)

	resp, err := c.PostForm(path, i, nil)
	if err != nil {
		return nil, err
	}

	var e *ACLEntry
	if err := decodeJSON(&e, resp.Body); err != nil {
		return nil, err
	}

	return e, nil
}
135223
func CreateOrg(c *context.APIContext, form api.CreateOrgOption) {
	org.CreateOrgForUser(c, form, user.GetUserByParams(c))
}
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)
}
1251403
func (c *Client) CreateAccount(ctx context.Context, path string, payload *CreateAccountPayload, contentType string) (*http.Response, error) {
	req, err := c.NewCreateAccountRequest(ctx, path, payload, contentType)
	if err != nil {
		return nil, err
	}
	return c.Client.Do(ctx, req)
}
1097240
func (client QuobyteClient) CreateVolume(request *CreateVolumeRequest) (string, error) {
	var response volumeUUID
	tenantUUID, err := client.GetTenantUUID(request.TenantID)
	if err != nil {
		return "", err
	}
	request.TenantID = tenantUUID

	if err = client.sendRequest("createVolume", request, &response); err != nil {
		return "", err
	}

	return response.VolumeUUID, nil
}
774516
func (p *StoragePool) Create(flags StoragePoolCreateFlags) error {
	var err C.virError
	result := C.virStoragePoolCreateWrapper(p.ptr, C.uint(flags), &err)
	if result == -1 {
		return makeError(&err)
	}
	return nil
}
583411
func (b *BigIP) CreateNode(name, address string) error {
	config := &Node{
		Name:    name,
		Address: address,
	}
	return b.post(config, uriLtm, uriNode)
}
1197284
func CreateEntries(addrs []string) (Entries, error) {
	entries := Entries{}
	if addrs == nil {
		return entries, nil
	}

	for _, addr := range addrs {
		if len(addr) == 0 {
			continue
		}
		entry, err := NewEntry(addr)
		if err != nil {
			return nil, err
		}
		entries = append(entries, entry)
	}
	return entries, nil
}
371744
func (client *Client) CreateNatGateway(args *CreateNatGatewayArgs) (resp *CreateNatGatewayResponse, err error) {
	response := CreateNatGatewayResponse{}
	err = client.Invoke("CreateNatGateway", args, &response)
	if err != nil {
		return nil, err
	}
	return &response, err
}
1001795
func (c *FakeOAuthAccessTokens) Create(oAuthAccessToken *oauth.OAuthAccessToken) (result *oauth.OAuthAccessToken, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootCreateAction(oauthaccesstokensResource, oAuthAccessToken), &oauth.OAuthAccessToken{})
	if obj == nil {
		return nil, err
	}
	return obj.(*oauth.OAuthAccessToken), err
}
784638
func (a *Account) CreateAcct(password string) (*Account, *http.Response, []error) {
	k := kumoru.New()

	k.Put(fmt.Sprintf("%s/v1/accounts/%s", k.EndPoint.Authorization, a.Email))
	k.Send(fmt.Sprintf("given_name=%s&surname=%s&password=%s", a.GivenName, a.Surname, password))

	resp, body, errs := k.End()

	if len(errs) > 0 {
		return a, resp, errs
	}

	if resp.StatusCode >= 400 {
		errs = append(errs, fmt.Errorf("%s", resp.Status))
	}

	err := json.Unmarshal([]byte(body), &a)

	if err != nil {
		errs = append(errs, err)
		return a, resp, errs
	}

	return a, resp, nil
}
417858
func NewEntry(url string) (*Entry, error) {
	host, port, err := net.SplitHostPort(url)
	if err != nil {
		return nil, err
	}
	return &Entry{host, port}, nil
}
1195294
func (s *IPDirectionalPoolsService) Create(k IPDirectionalPoolKey, val interface{}) (*http.Response, error) {
	return s.client.post(k.URI(), val, nil)
}
1167278
func Create(c *context.APIContext, opt api.CreateRepoOption) {
	// Shouldn't reach this condition, but just in case.
	if c.User.IsOrganization() {
		c.Error(422, "", "not allowed creating repository for organization")
		return
	}
	CreateUserRepo(c, c.User, opt)
}
361332
func (api *API) CreateUserAccessRule(accessRule AccessRule) (*AccessRuleResponse, error) {
	return api.createAccessRule("/user", accessRule)
}
40755
func (m *ManifestWriter) AddEntry(ctx context.Context, data io.Reader, e *ManifestEntry) (addr storage.Address, err error) {
	entry := newManifestTrieEntry(e, nil)
	if data != nil {
		var wait func(context.Context) error
		addr, wait, err = m.api.Store(ctx, data, e.Size, m.trie.encrypted)
		if err != nil {
			return nil, err
		}
		err = wait(ctx)
		if err != nil {
			return nil, err
		}
		entry.Hash = addr.Hex()
	}
	if entry.Hash == "" {
		return addr, errors.New("missing entry hash")
	}
	m.trie.addEntry(entry, m.quitC)
	return addr, nil
}
332944
func (c *Client) GetACLEntry(i *GetACLEntryInput) (*ACLEntry, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.ACL == "" {
		return nil, ErrMissingACL
	}

	if i.ID == "" {
		return nil, ErrMissingID
	}

	path := fmt.Sprintf("/service/%s/acl/%s/entry/%s", i.Service, i.ACL, i.ID)

	resp, err := c.Get(path, nil)
	if err != nil {
		return nil, err
	}

	var e *ACLEntry
	if err := decodeJSON(&e, resp.Body); err != nil {
		return nil, err
	}

	return e, nil
}