Skip to content

Commit

Permalink
Enable use of json client ID credentials
Browse files Browse the repository at this point in the history
Changed k8s_auth() to allow for arg 'json'. Can now provide OAuth Client ID credentials via json file.
  • Loading branch information
RhysJackson committed Jan 21, 2018
1 parent e93b0e9 commit c81ed41
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.RData
test.R
.httr-oauth
secret.json
10 changes: 8 additions & 2 deletions R/k8s_auth.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
#'
#' Calls googleAuthR to authenticate with the Google Cloud Platform
#' @keywords k8s_auth
#' @param json Path to your json client_secret credentials.
#' @importFrom googleAuthR gar_auth
#' @export
#' @examples
#' k8s_auth()
#' k8s_auth(json = "client_secret.json")

k8s_auth <- function() {
googleAuthR::gar_auth()
k8s_auth <- function(json = NULL) {
if(is.null(json)) {
googleAuthR::gar_auth()
} else {
googleAuthR::gar_set_client(json)
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ k8s_auth()

### Create a cluster
```r
# Create a 3 node, n1-standard-1, 100Gb disk, cluster with the name 'r-cluster'
# Create a 3 node, n1-standard-1, 100Gb disk, cluster with the default name 'r-cluster'
# Cluster comes configured with recommended scopes https://www.googleapis.com/auth/compute and https://www.googleapis.com/auth/devstorage.read_only
createCluster(projectId = "myProject", "europe-west1-d")
```
Expand Down
6 changes: 5 additions & 1 deletion man/k8s_auth.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c81ed41

Please sign in to comment.