From fb8a11f1beb851c84a9b56155acf2d091d4b7a81 Mon Sep 17 00:00:00 2001 From: Hong Ooi Date: Thu, 25 Apr 2019 20:34:26 +1000 Subject: [PATCH] stored object print methods --- R/stored_acct.R | 7 +++++++ R/stored_cert.R | 10 ++++++++++ R/stored_key.R | 9 +++++++++ R/stored_object.R | 6 ++++++ R/stored_secret.R | 6 ++++++ 5 files changed, 38 insertions(+) diff --git a/R/stored_acct.R b/R/stored_acct.R index c76ef1e..2f803cb 100644 --- a/R/stored_acct.R +++ b/R/stored_acct.R @@ -144,5 +144,12 @@ public=list( { secret_url <- self$get_sas_definition(sas_name)$sid call_vault_url(self$token, secret_url)$value + }, + + print=function(...) + { + cat("\n", sep="") + cat(" account:", basename(self$resourceId), "\n") + invisible(self) } )) diff --git a/R/stored_cert.R b/R/stored_cert.R index 780cb0c..bc2a908 100644 --- a/R/stored_cert.R +++ b/R/stored_cert.R @@ -173,5 +173,15 @@ public=list( pol <- self$do_operation(op, body=body, encode="json", version=NULL, http_verb="PATCH") self$policy <- pol pol + }, + + print=function(...) + { + cat("\n", sep="") + cat(" version:", if(is.null(self$version)) "" else self$version, "\n") + cat(" subject:", self$policy$x509_props$subject, "\n") + cat(" issuer:", self$policy$issuer$name, "\n") + cat(" valid for:", self$policy$x509_props$validity_months, "months\n") + invisible(self) } )) diff --git a/R/stored_key.R b/R/stored_key.R index 26a4833..dfa2bd8 100644 --- a/R/stored_key.R +++ b/R/stored_key.R @@ -201,5 +201,14 @@ public=list( self$do_operation("unwrapkey", body=body, encode="json", http_verb="POST")$value) if(as_raw) out else rawToChar(out) + }, + + print=function(...) + { + cat("\n", sep="") + cat(" version:", if(is.null(self$version)) "" else self$version, "\n") + cat(" type:", self$key$kty, "\n") + cat(" operations:", unlist(self$key$key_ops), "\n") + invisible(self) } )) diff --git a/R/stored_object.R b/R/stored_object.R index 7312187..bf111a2 100644 --- a/R/stored_object.R +++ b/R/stored_object.R @@ -57,6 +57,12 @@ public=list( url$path <- construct_path(self$type, self$name, version, op) url$query <- options call_vault_url(self$token, url, ...) + }, + + print=function(...) + { + cat("\n") + invisible(self) } )) diff --git a/R/stored_secret.R b/R/stored_secret.R index 0026b8f..c3e4662 100644 --- a/R/stored_secret.R +++ b/R/stored_secret.R @@ -90,5 +90,11 @@ public=list( ) }) do.call(rbind, lst) + }, + + print=function(...) + { + cat("\n", sep="") + invisible(self) } ))