Class: Fog::Google::SQL::SslCerts
- Inherits:
-
Collection
- Object
- Collection
- Fog::Google::SQL::SslCerts
- Defined in:
- lib/fog/google/models/sql/ssl_certs.rb
Instance Method Summary collapse
-
#all(instance_id) ⇒ Array<Fog::Google::SQL::SslCert>
Lists all of the current SSL certificates for the instance.
-
#get(instance_id, sha1_fingerprint) ⇒ Fog::Google::SQL::SslCert
Retrieves a particular SSL certificate (does not include the private key).
Instance Method Details
#all(instance_id) ⇒ Array<Fog::Google::SQL::SslCert>
Lists all of the current SSL certificates for the instance
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fog/google/models/sql/ssl_certs.rb', line 15 def all(instance_id) data = [] begin data = service.list_ssl_certs(instance_id).body['items'] || [] rescue Fog::Errors::Error => e # Google SQL returns a 403 if we try to access a non-existing resource # The default behaviour in Fog is to return an empty Array raise e unless e. == 'The client is not authorized to make this request.' end load(data) end |
#get(instance_id, sha1_fingerprint) ⇒ Fog::Google::SQL::SslCert
Retrieves a particular SSL certificate (does not include the private key)
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fog/google/models/sql/ssl_certs.rb', line 34 def get(instance_id, sha1_fingerprint) if ssl_cert = service.get_ssl_cert(instance_id, sha1_fingerprint).body new(ssl_cert) end rescue Fog::Errors::NotFound nil rescue Fog::Errors::Error => e # Google SQL returns a 403 if we try to access a non-existing resource # The default behaviour in Fog is to return a nil return nil if e. == 'The client is not authorized to make this request.' raise e end |