Class: Keel::GCloud::Auth
- Inherits:
-
Object
- Object
- Keel::GCloud::Auth
- Defined in:
- lib/keel/gcloud/auth.rb
Overview
This is a wrapper to call authentication related APIs with GCloud.
Instance Attribute Summary collapse
-
#cli ⇒ Object
Returns the value of attribute cli.
-
#config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
-
.authenticate ⇒ Boolean
Calls the ‘login` API for GCLoud.
Instance Method Summary collapse
-
#authenticate_k8s ⇒ Boolean
Calls the ‘get-credentials` API for GCLoud for a specific container/cluster.
-
#initialize(config:) ⇒ Auth
constructor
A new instance of Auth.
Constructor Details
#initialize(config:) ⇒ Auth
Returns a new instance of Auth.
8 9 10 11 |
# File 'lib/keel/gcloud/auth.rb', line 8 def initialize config: @config = config @cli = Cli.new end |
Instance Attribute Details
#cli ⇒ Object
Returns the value of attribute cli.
6 7 8 |
# File 'lib/keel/gcloud/auth.rb', line 6 def cli @cli end |
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/keel/gcloud/auth.rb', line 6 def config @config end |
Class Method Details
.authenticate ⇒ Boolean
Calls the ‘login` API for GCLoud.
18 19 20 |
# File 'lib/keel/gcloud/auth.rb', line 18 def self.authenticate Cli.new.system_call 'gcloud auth login' end |
Instance Method Details
#authenticate_k8s ⇒ Boolean
Calls the ‘get-credentials` API for GCLoud for a specific container/cluster.
28 29 30 |
# File 'lib/keel/gcloud/auth.rb', line 28 def authenticate_k8s @cli.system_call "gcloud container clusters get-credentials #{self.config.container_cluster}" end |