Class: CemAcpt::Platform::Gcp::ServiceAccount
- Inherits:
-
Object
- Object
- CemAcpt::Platform::Gcp::ServiceAccount
- Includes:
- Helper
- Defined in:
- lib/cem_acpt/platform/gcp/compute.rb
Overview
This class represents a GCP VM service account
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#scopes ⇒ Object
readonly
Returns the value of attribute scopes.
Instance Method Summary collapse
- #cmd_flag ⇒ Object
-
#initialize(name: nil, scopes: ['devstorage.read_only', 'logging.write', 'monitoring.write', 'servicecontrol', 'service.management.readonly', 'trace.append' ]) ⇒ ServiceAccount
constructor
A new instance of ServiceAccount.
Methods included from Helper
#add_cmd, #cmd, #cmd_flag_vars?
Constructor Details
#initialize(name: nil, scopes: ['devstorage.read_only', 'logging.write', 'monitoring.write', 'servicecontrol', 'service.management.readonly', 'trace.append' ]) ⇒ ServiceAccount
Returns a new instance of ServiceAccount.
49 50 51 52 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 49 def initialize(name: nil, scopes: ['devstorage.read_only', 'logging.write', 'monitoring.write', 'servicecontrol', 'service.management.readonly', 'trace.append' ]) @name = name @scopes = scopes.map { |s| "https://www.googleapis.com/auth/#{s}" } end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
47 48 49 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 47 def name @name end |
#scopes ⇒ Object (readonly)
Returns the value of attribute scopes.
47 48 49 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 47 def scopes @scopes end |
Instance Method Details
#cmd_flag ⇒ Object
54 55 56 |
# File 'lib/cem_acpt/platform/gcp/compute.rb', line 54 def cmd_flag "--service-account=#{name} --scopes=#{scopes.join(',')}" if cmd_flag_vars?(name, scopes) end |