class Libvirt::Secret

Constants

USAGE_TYPE_VOLUME

Attributes

connection[R]

Public Instance Methods

free → nil click to toggle source

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);
}
get_value(flags=0) → string click to toggle source

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;
}
set_value(value, flags=0) → nil click to toggle source

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));
}
undefine → nil click to toggle source

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));
}
usageid → string click to toggle source

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));
}
usagetype → fixnum click to toggle source

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));
}
uuid → string click to toggle source

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);
}
xml_desc(flags=0) → string click to toggle source

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));
}