Class: Fog::Google::SQL::Instances
- Inherits:
-
Collection
- Object
- Collection
- Fog::Google::SQL::Instances
- Defined in:
- lib/fog/google/models/sql/instances.rb
Instance Method Summary collapse
-
#all ⇒ Array<Fog::Google::SQL::Instance>
Lists all instance.
-
#get(instance_id) ⇒ Fog::Google::SQL::Instance
Retrieves an instance.
Instance Method Details
#all ⇒ Array<Fog::Google::SQL::Instance>
Lists all instance
14 15 16 17 |
# File 'lib/fog/google/models/sql/instances.rb', line 14 def all data = service.list_instances.to_h[:items] || [] load(data) end |
#get(instance_id) ⇒ Fog::Google::SQL::Instance
Retrieves an instance
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/google/models/sql/instances.rb', line 24 def get(instance_id) instance = service.get_instance(instance_id).to_h # XXX if we pass `nil` to get() it returns empty DB object with # kind set to "sql#instancesList" # see https://github.com/google/google-api-ruby-client/issues/699 if instance[:kind].eql?("sql#instance") new(instance) end rescue ::Google::Apis::ClientError => e raise e unless e.status_code == 404 || e.status_code == 403 nil end |