// CreateUnlock calls the underlying root key store's CreateUnlock and returns
// the result.
351157
func (svc *Service) CreateUnlock(password *[]byte) error {
	return svc.rks.CreateUnlock(password)
}
134850
func (oc *OpCommon) AddUnrefBlock(ptr data.BlockPointer) {
	oc.UnrefBlocks = append(oc.UnrefBlocks, ptr)
}
554563
func (c *CloudAPI) CreateKey(keyName, key string) (*cloudapi.Key, error) {
	if err := c.ProcessFunctionHook(c, keyName, key); err != nil {
		return nil, err
	}

	// check if key already exists or keyName already in use
	for _, k := range c.keys {
		if k.Name == keyName {
			return nil, fmt.Errorf("Key name %s already in use", keyName)
		}
		if k.Key == key {
			return nil, fmt.Errorf("Key %s already exists", key)
		}
	}

	newKey := cloudapi.Key{Name: keyName, Fingerprint: "", Key: key}
	c.keys = append(c.keys, newKey)

	return &newKey, nil
}
663638
func (client *Client) CreateKeyPair(args *CreateKeyPairArgs) (resp *CreateKeyPairResponse, err error) {
	response := CreateKeyPairResponse{}
	err = client.Invoke("CreateKeyPair", args, &response)
	if err != nil {
		return nil, err
	}
	return &response, err
}
305204
func (f *TeeFactory) Create(cell, serverAddr, root string) (topo.Conn, error) {
	ctx := context.Background()
	primaryConn, err := f.primary.ConnForCell(ctx, cell)
	if err != nil {
		return nil, err
	}
	secondaryConn, err := f.secondary.ConnForCell(ctx, cell)
	if err != nil {
		return nil, err
	}

	lockFirst := primaryConn
	lockSecond := secondaryConn
	if f.reverseLockOrder {
		lockFirst = secondaryConn
		lockSecond = primaryConn
	}

	return &TeeConn{
		primary:    primaryConn,
		secondary:  secondaryConn,
		lockFirst:  lockFirst,
		lockSecond: lockSecond,
	}, nil
}
1269209
func (s *store) Create(ctx context.Context, key string, obj, out runtime.Object, ttl uint64) error {
	if version, err := s.versioner.ObjectResourceVersion(obj); err == nil && version != 0 {
		return errors.New("resourceVersion should not be set on objects to be created")
	}
	if err := s.versioner.PrepareObjectForStorage(obj); err != nil {
		return fmt.Errorf("PrepareObjectForStorage failed: %v", err)
	}
	data, err := runtime.Encode(s.codec, obj)
	if err != nil {
		return err
	}
	key = path.Join(s.pathPrefix, key)

	opts, err := s.ttlOpts(ctx, int64(ttl))
	if err != nil {
		return err
	}

	newData, err := s.transformer.TransformToStorage(data, authenticatedDataString(key))
	if err != nil {
		return storage.NewInternalError(err.Error())
	}

	startTime := time.Now()
	txnResp, err := s.client.KV.Txn(ctx).If(
		notFound(key),
	).Then(
		clientv3.OpPut(key, string(newData), opts...),
	).Commit()
	metrics.RecordEtcdRequestLatency("create", getTypeName(obj), startTime)
	if err != nil {
		return err
	}
	if !txnResp.Succeeded {
		return storage.NewKeyExistsError(key, 0)
	}

	if out != nil {
		putResp := txnResp.Responses[0].GetResponsePut()
		return decode(s.codec, s.versioner, data, out, putResp.Header.Revision)
	}
	return nil
}
1287867
func (sshKeyApi *SSHKeyApi) Create(key SSHKey) (*SSHKey, error) {
	send, merr := json.Marshal(key)
	if merr != nil {
		return nil, merr
	}
	body, err := sshKeyApi.entityService.Create(send, map[string]string{})
	if err != nil {
		return nil, err
	}
	return parseSSHKey(body), nil
}
1124968
func (cli *Client) SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error {
	serverResp, err := cli.post(ctx, "/swarm/unlock", nil, req, nil)
	ensureReaderClosed(serverResp)
	return err
}
146566
func NewUnlocked(maxEntries int) *Cache {
	c := New(maxEntries)
	c.nolock = true
	return c
}
1328438
func (c *Client) KeyCreate(publicKey string) (*Key, error) {
	params := struct {
		PublicKey string `json:"public_key"`
	}{
		PublicKey: publicKey,
	}
	var keyRes Key
	return &keyRes, c.Post(&keyRes, "/account/keys", params)
}
457701
func (t *keyStringValueTree) Create(keys ...string) KeyStringValueChanger {
	var path []nodeContent
	for _, key := range keys {
		path = append(path, keyValue{key, ""})
	}
	n, err := t.container.root.create(path...)
	return &keyStringValueChanger{n, err}
}
1243882
func (s *GetJobUnlockCodeOutput) SetUnlockCode(v string) *GetJobUnlockCodeOutput {
	s.UnlockCode = &v
	return s
}
306660
func (c *consulClient) createIfExists(condKey, key string, value []byte, lease bool) error {
	// Consul does not support transactions which would allow to check for
	// the presence of a conditional key if the key is not the key being
	// manipulated
	//
	// Lock the conditional key to serialize all CreateIfExists() calls

	l, err := LockPath(context.Background(), condKey)
	if err != nil {
		return fmt.Errorf("unable to lock condKey for CreateIfExists: %s", err)
	}

	defer l.Unlock()

	// Create the key if it does not exist
	if _, err := c.CreateOnly(context.TODO(), key, value, lease); err != nil {
		return err
	}

	// Consul does not support transactions which would allow to check for
	// the presence of another key
	masterKey, err := c.Get(condKey)
	if err != nil || masterKey == nil {
		c.Delete(key)
		return fmt.Errorf("conditional key not present")
	}

	return nil
}
1120022
func (z *ZkPlus) Create(path string, data []byte, flags int32, acl []zk.ACL) (string, error) {
	z.forPath(path).Log(logkey.ZkMethod, "Create")
	p, err := z.blockOnConn().Create(z.realPath(path), data, flags, acl)
	if strings.HasPrefix(p, z.pathPrefix) && z.pathPrefix != "" {
		p = p[len(z.pathPrefix)+1:]
	}
	return p, errors.Annotatef(err, "cannot create zk path %s", path)
}
952456
func (r *RepoKeyResource) CreateUpdate(owner, repo, key, title string) (*Key, error) {
	if found, err := r.FindName(owner, repo, title); err == nil {
		// if the public keys are different we should update
		if found.Key != key {
			return r.Update(owner, repo, key, title, found.Id)
		}

		// otherwise we should just return the key, since there
		// is nothing to update
		return found, nil
	}

	return r.Create(owner, repo, key, title)
}
1109004
func UnmarshalBlock(encoded []byte) (*cb.Block, error) {
	block := &cb.Block{}
	err := proto.Unmarshal(encoded, block)
	return block, errors.Wrap(err, "error unmarshaling Block")
}
733656
func (_m *Store) CreateLock(key string, ttl int) (lock.DistributedLock, error) {
	ret := _m.Called(key, ttl)

	var r0 lock.DistributedLock
	if rf, ok := ret.Get(0).(func(string, int) lock.DistributedLock); ok {
		r0 = rf(key, ttl)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(lock.DistributedLock)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string, int) error); ok {
		r1 = rf(key, ttl)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}