class Libvirt::Secret
Constants
- USAGE_TYPE_VOLUME
Attributes
Public Instance Methods
Call
virSecretFree[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretFree]
to free this secret. After this call the secret object is no longer valid.
static VALUE libvirt_secret_free(VALUE s) {
gen_call_free(Secret, s);
}
Call
virSecretGetValue[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetValue]
to retrieve the value from this secret.
static VALUE libvirt_secret_get_value(int argc, VALUE *argv, VALUE s) {
virSecretPtr secret = secret_get(s);
VALUE flags;
unsigned char *val;
size_t value_size;
VALUE ret;
int exception = 0;
struct rb_str_new_arg args;
rb_scan_args(argc, argv, "01", &flags);
if (NIL_P(flags))
flags = INT2NUM(0);
val = virSecretGetValue(secret, &value_size, NUM2UINT(flags));
_E(val == NULL, create_error(e_RetrieveError, "virSecretGetValue",
conn(s)));
args.val = (char *)val;
args.size = value_size;
ret = rb_protect(rb_str_new_wrap, (VALUE)&args, &exception);
if (exception) {
free(val);
rb_jump_tag(exception);
}
free(val);
return ret;
}
Call
virSecretSetValue[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretSetValue]
to set a new value in this secret.
static VALUE libvirt_secret_set_value(int argc, VALUE *argv, VALUE s) {
VALUE flags;
VALUE value;
rb_scan_args(argc, argv, "11", &value, &flags);
if (NIL_P(flags))
flags = INT2NUM(0);
StringValue(value);
gen_call_void(virSecretSetValue, conn(s), secret_get(s),
(unsigned char *)RSTRING_PTR(value), RSTRING_LEN(value),
NUM2UINT(flags));
}
Call
virSecretUndefine[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretUndefine]
to undefine this secret.
static VALUE libvirt_secret_undefine(VALUE s) {
gen_call_void(virSecretUndefine, conn(s), secret_get(s));
}
Call
virSecretGetUsageID[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUsageID]
to retrieve the usageid for this secret.
static VALUE libvirt_secret_usageid(VALUE s) {
gen_call_string(virSecretGetUsageID, conn(s), 0, secret_get(s));
}
Call
virSecretGetUsageType[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUsageType]
to retrieve the usagetype for this secret.
static VALUE libvirt_secret_usagetype(VALUE s) {
gen_call_int(virSecretGetUsageType, conn(s), secret_get(s));
}
Call
virSecretGetUUIDString[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetUUIDString]
to retrieve the UUID for this secret.
static VALUE libvirt_secret_uuid(VALUE s) {
virSecretPtr secret = secret_get(s);
int r;
char uuid[VIR_UUID_STRING_BUFLEN];
r = virSecretGetUUIDString(secret, uuid);
_E(r < 0, create_error(e_RetrieveError, "virSecretGetUUIDString", conn(s)));
return rb_str_new2((char *)uuid);
}
Call
virSecretGetXMLDesc[http://www.libvirt.org/html/libvirt-libvirt.html#virSecretGetXMLDesc]
to retrieve the XML for this secret.
static VALUE libvirt_secret_xml_desc(int argc, VALUE *argv, VALUE s) {
VALUE flags;
rb_scan_args(argc, argv, "01", &flags);
if (NIL_P(flags))
flags = INT2NUM(0);
gen_call_string(virSecretGetXMLDesc, conn(s), 1, secret_get(s),
NUM2UINT(flags));
}