Class: IBM::Cloud::SDK::VPC::Keys
- Inherits:
-
BaseCollection
- Object
- BaseVPC
- BaseCollection
- IBM::Cloud::SDK::VPC::Keys
- Defined in:
- lib/ibm/cloud/sdk/vpc/keys.rb
Overview
A collection of SSH keys.
Instance Attribute Summary
Attributes inherited from BaseVPC
#connection, #endpoint, #logger
Instance Method Summary collapse
- #all(resource_id = nil) ⇒ Object
-
#create(name, public_key, resource_group: nil, type: nil) ⇒ Object
:reek:FeatureEnvy.
- #fetch(resource_id: nil) ⇒ Object
-
#initialize(parent) ⇒ Keys
constructor
A new instance of Keys.
- #key(id) ⇒ Object
Methods inherited from BaseCollection
#count, #data, #has_count?, #params
Methods inherited from BaseVPC
#adhoc, #delete, #get, #patch, #post, #put, #url
Constructor Details
Instance Method Details
#all(resource_id = nil) ⇒ Object
20 21 22 |
# File 'lib/ibm/cloud/sdk/vpc/keys.rb', line 20 def all(resource_id = nil) fetch(resource_id: resource_id).subkey(@array_key) end |
#create(name, public_key, resource_group: nil, type: nil) ⇒ Object
:reek:FeatureEnvy
25 26 27 28 29 30 |
# File 'lib/ibm/cloud/sdk/vpc/keys.rb', line 25 def create(name, public_key, resource_group: nil, type: nil) payload = { name: name, public_key: public_key } payload[:resource_group] = resource_group if resource_group payload[:type] = type if type post(payload) end |
#fetch(resource_id: nil) ⇒ Object
14 15 16 17 18 |
# File 'lib/ibm/cloud/sdk/vpc/keys.rb', line 14 def fetch(resource_id: nil) params = {} params['resource_group.id'] = resource_id if resource_id get(params: params) end |