Class: Fog::Google::SQL::SslCert
- Inherits:
-
Model
- Object
- Model
- Fog::Google::SQL::SslCert
- Defined in:
- lib/fog/google/models/sql/ssl_cert.rb
Overview
A SSL certificate resource
Instance Method Summary collapse
-
#destroy(async: true) ⇒ Fog::Google::SQL::Operation
Deletes a SSL certificate.
-
#reload ⇒ Fog::Google::SQL::SslCert
Reloads a SSL certificate.
-
#save(async: false) ⇒ Object
Creates a SSL certificate.
Instance Method Details
#destroy(async: true) ⇒ Fog::Google::SQL::Operation
Deletes a SSL certificate. The change will not take effect until the instance is restarted.
32 33 34 35 36 37 38 39 |
# File 'lib/fog/google/models/sql/ssl_cert.rb', line 32 def destroy(async: true) requires :instance, :identity data = service.delete_ssl_cert(instance, identity) operation = Fog::Google::SQL::Operations.new(:service => service).get(data.name) operation.wait_for { ready? } unless async operation end |
#reload ⇒ Fog::Google::SQL::SslCert
Reloads a SSL certificate
45 46 47 48 49 50 51 |
# File 'lib/fog/google/models/sql/ssl_cert.rb', line 45 def reload requires :instance, :identity data = collection.get(instance, identity) merge_attributes(data.attributes) self end |
#save(async: false) ⇒ Object
Creates a SSL certificate. The new certificate will not be usable until the instance is restarted.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/fog/google/models/sql/ssl_cert.rb', line 57 def save(async: false) requires :instance, :common_name raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted? data = service.insert_ssl_cert(instance, common_name) # data.operation.name is used here since InsertSslCert returns a # special object, not an operation, as usual. See documentation: # https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/sslCerts/insert#response-body operation = Fog::Google::SQL::Operations.new(:service => service).get(data.operation.name) operation.wait_for { ready? } unless async merge_attributes(data.client_cert.cert_info.to_h) self.server_ca_cert = Fog::Google::SQL::SslCert.new(data.server_ca_cert.to_h) self.cert_private_key = data.client_cert.cert_private_key self end |