File: //snap/google-cloud-cli/current/help/man/man1/gcloud_secrets_versions_access.1
.TH "GCLOUD_SECRETS_VERSIONS_ACCESS" 1
.SH "NAME"
.HP
gcloud secrets versions access \- access a secret version's data
.SH "SYNOPSIS"
.HP
\f5gcloud secrets versions access\fR (\fIVERSION\fR\ :\ \fB\-\-secret\fR=\fISECRET\fR) [\fB\-\-location\fR=\fILOCATION\fR] [\fB\-\-out\-file\fR=\fIOUT\-FILE\-PATH\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
Access the data for the specified secret version.
.SH "EXAMPLES"
Access the data for version 123 of the secret 'my\-secret':
.RS 2m
$ gcloud secrets versions access 123 \-\-secret=my\-secret
.RE
Note: The output will be formatted as UTF\-8 which can corrupt binary secrets.
To write raw bytes to a file use \-\-out\-file flag:
.RS 2m
$ gcloud secrets versions access 123 \-\-secret=my\-secret \e
\-\-out\-file=/tmp/secret
.RE
To get the raw bytes, have Google Cloud CLI print the response as
base64\-encoded and decode:
.RS 2m
$ gcloud secrets versions access 123 \-\-secret=my\-secret \e
\-\-format='get(payload.data)' | tr '_\-' '/+' | base64 \-d
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
Version resource \- Numeric secret version to access or a configured alias
(including 'latest' to use the latest version). The arguments in this group can
be used to specify the attributes of this resource. (NOTE) Some attributes are
not given arguments in this group but can be set in other ways.
To set the \f5project\fR attribute:
.RS 2m
.IP "\(em" 2m
provide the argument \f5VERSION\fR on the command line with a fully specified
name;
.IP "\(em" 2m
provide the argument \f5\-\-project\fR on the command line;
.IP "\(em" 2m
set the property \f5core/project\fR.
.RE
.sp
This must be specified.
.RS 2m
.TP 2m
\fIVERSION\fR
ID of the version or fully qualified identifier for the version.
To set the \f5version\fR attribute:
.RS 2m
.IP "\(bu" 2m
provide the argument \f5VERSION\fR on the command line.
.RE
.sp
This positional argument must be specified if any of the other arguments in this
group are specified.
.TP 2m
\fB\-\-secret\fR=\fISECRET\fR
The secret of the version.
To set the \f5secret\fR attribute:
.RS 2m
.IP "\(bu" 2m
provide the argument \f5VERSION\fR on the command line with a fully specified
name;
.IP "\(bu" 2m
provide the argument \f5\-\-secret\fR on the command line.
.RE
.sp
.RE
.RE
.sp
.SH "FLAGS"
.RS 2m
.TP 2m
Location resource \- The location to access secret. This represents a Cloud
resource. (NOTE) Some attributes are not given arguments in this group but can
be set in other ways.
To set the \f5project\fR attribute:
.RS 2m
.IP "\(em" 2m
provide the argument \f5\-\-location\fR on the command line with a fully
specified name;
.IP "\(em" 2m
provide the argument \f5\-\-project\fR on the command line;
.IP "\(em" 2m
set the property \f5core/project\fR.
.RE
.sp
.RS 2m
.TP 2m
\fB\-\-location\fR=\fILOCATION\fR
ID of the location or fully qualified identifier for the location.
To set the \f5location\fR attribute:
.RS 2m
.IP "\(bu" 2m
provide the argument \f5\-\-location\fR on the command line.
.RE
.sp
.RE
.sp
.TP 2m
\fB\-\-out\-file\fR=\fIOUT\-FILE\-PATH\fR
File path to which secret data is written. If this flag is not provided secret
data will be written to stdout in UTF\-8 format.
.RE
.sp
.SH "GCLOUD WIDE FLAGS"
These flags are available to all commands: \-\-access\-token\-file, \-\-account,
\-\-billing\-project, \-\-configuration, \-\-flags\-file, \-\-flatten,
\-\-format, \-\-help, \-\-impersonate\-service\-account, \-\-log\-http,
\-\-project, \-\-quiet, \-\-trace\-token, \-\-user\-output\-enabled,
\-\-verbosity.
Run \fB$ gcloud help\fR for details.
.SH "NOTES"
This variant is also available:
.RS 2m
$ gcloud beta secrets versions access
.RE