// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetKey
517098
func (v *StorageVol) GetKey() (string, error) {
	var err C.virError
	key := C.virStorageVolGetKeyWrapper(v.ptr, &err)
	if key == nil {
		return "", makeError(&err)
	}
	return C.GoString(key), nil
}
489197
func (c *RPCClient) InstallKey(key string) (map[string]string, error) {
	header := requestHeader{
		Command: installKeyCommand,
		Seq:     c.getSeq(),
	}
	req := keyRequest{
		Key: key,
	}

	resp := keyResponse{}
	err := c.genericRPC(&header, &req, &resp)

	return resp.Messages, err
}
1343728
func (k ResourceTransformationKey) key() string {
	if len(k.elements) == 0 {
		return k.name
	}

	sb := bp.GetBuffer()
	defer bp.PutBuffer(sb)

	sb.WriteString(k.name)
	for _, element := range k.elements {
		hash, err := hashstructure.Hash(element, nil)
		if err != nil {
			panic(err)
		}
		sb.WriteString("_")
		sb.WriteString(strconv.FormatUint(hash, 10))
	}

	return sb.String()
}
1164807
func (vtg *VTGate) GetSrvKeyspace(ctx context.Context, keyspace string) (*topodatapb.SrvKeyspace, error) {
	return vtg.resolver.toposerv.GetSrvKeyspace(ctx, vtg.resolver.cell, keyspace)
}
149877
func (g *Goon) Key(src interface{}) *datastore.Key {
	if k, err := g.KeyError(src); err == nil {
		return k
	}
	return nil
}
43573
func (ca *CertAuthorityV2) FirstSigningKey() ([]byte, error) {
	if len(ca.Spec.SigningKeys) == 0 {
		return nil, trace.NotFound("%v has no signing keys", ca.Metadata.Name)
	}
	return ca.Spec.SigningKeys[0], nil
}
655737
func (f *SeriesFile) SeriesIDTypedBySeriesKey(key []byte) SeriesIDTyped {
	keyPartition := f.SeriesKeyPartition(key)
	if keyPartition == nil {
		return SeriesIDTyped{}
	}
	return keyPartition.FindIDTypedBySeriesKey(key)
}
678438
func ValidateVolume(obj *Volume) error {
	collections.volumeMutex.Lock()
	defer collections.volumeMutex.Unlock()

	// Validate key is correct
	keyStr := obj.TenantName + ":" + obj.VolumeName
	if obj.Key != keyStr {
		log.Errorf("Expecting Volume Key: %s. Got: %s", keyStr, obj.Key)
		return errors.New("Invalid Key")
	}

	// Validate each field

	return nil
}
1274265
func generateSecretKey() ([keySize]byte, error) {
	var data32 [keySize]byte
	data := make([]byte, keySize)
	_, err := rand.Read(data)
	if err != nil {
		return data32, err
	}
	total := copy(data32[:], data[:keySize])
	if total != keySize {
		return data32, KeyGenerationError
	}
	return data32, nil
}
1209119
func (v *version) PersistentVolumeClaims() PersistentVolumeClaimInformer {
	return &persistentVolumeClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
1077734
func (v *StorageVol) Free() error {
	var err C.virError
	ret := C.virStorageVolFreeWrapper(v.ptr, &err)
	if ret == -1 {
		return makeError(&err)
	}
	return nil
}
738904
func FromThriftToPrimaryKey(key *dosarpc.PrimaryKey) *dosa.PrimaryKey {
	pk := key.PartitionKeys
	ck := make([]*dosa.ClusteringKey, len(key.ClusteringKeys))
	for i, v := range key.ClusteringKeys {
		ck[i] = &dosa.ClusteringKey{
			Name:       *v.Name,
			Descending: !*v.Asc,
		}
	}

	return &dosa.PrimaryKey{
		PartitionKeys:  pk,
		ClusteringKeys: ck,
	}
}
593987
func (c *Connect) GetStoragePoolCapabilities(flags uint32) (string, error) {
	if C.LIBVIR_VERSION_NUMBER < 5002000 {
		return "", makeNotImplementedError("virConnectGetStoragePoolCapabilities")
	}

	var err C.virError
	ret := C.virConnectGetStoragePoolCapabilitiesWrapper(c.ptr, C.uint(flags), &err)
	if ret == nil {
		return "", makeError(&err)
	}

	defer C.free(unsafe.Pointer(ret))

	return C.GoString(ret), nil
}
618487
func VtctldSrvKeyspace(cell, keyspace string) template.HTML {
	return MakeVtctldRedirect(keyspace, map[string]string{
		"type":     "srv_keyspace",
		"cell":     cell,
		"keyspace": keyspace,
	})
}
508265
func (p *siprng) rekey() {
	var k [16]byte
	if _, err := io.ReadFull(rand.Reader, k[:]); err != nil {
		panic(err.Error())
	}
	p.k0 = binary.LittleEndian.Uint64(k[0:8])
	p.k1 = binary.LittleEndian.Uint64(k[8:16])
	p.ctr = 1
}
1188954
func (m VirtualDiskManager) ShrinkVirtualDisk(ctx context.Context, name string, dc *Datacenter, copy *bool) (*Task, error) {
	req := types.ShrinkVirtualDisk_Task{
		This: m.Reference(),
		Name: name,
		Copy: copy,
	}

	if dc != nil {
		ref := dc.Reference()
		req.Datacenter = &ref
	}

	res, err := methods.ShrinkVirtualDisk_Task(ctx, m.c, &req)
	if err != nil {
		return nil, err
	}

	return NewTask(m.c, res.Returnval), nil
}
167527
func (g *GPG) FormatKey(ctx context.Context, id string) string {
	return g.findKey(ctx, id).OneLine()
}