-
-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restore db instance fom db snapshot #217
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,18 @@ module DNS | |
class AWS < Fog::Service | ||
extend Fog::AWS::CredentialFetcher::ServiceMethods | ||
|
||
require 'fog/aws/requests/dns/change_resource_record_sets' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should be redundant to the |
||
require 'fog/aws/requests/dns/create_health_check' | ||
require 'fog/aws/requests/dns/create_hosted_zone' | ||
require 'fog/aws/requests/dns/delete_health_check' | ||
require 'fog/aws/requests/dns/delete_hosted_zone' | ||
require 'fog/aws/requests/dns/get_change' | ||
require 'fog/aws/requests/dns/get_health_check' | ||
require 'fog/aws/requests/dns/get_hosted_zone' | ||
require 'fog/aws/requests/dns/list_health_checks' | ||
require 'fog/aws/requests/dns/list_hosted_zones' | ||
require 'fog/aws/requests/dns/list_resource_record_sets' | ||
|
||
requires :aws_access_key_id, :aws_secret_access_key | ||
recognizes :host, :path, :port, :scheme, :version, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :instrumentor, :instrumentor_name | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ class Server < Fog::Model | |
attribute :tde_credential_arn, :aliases => 'TdeCredentialArn' | ||
attribute :vpc_security_groups, :aliases => 'VpcSecurityGroups', :type => :array | ||
|
||
attr_accessor :password, :parameter_group_name, :security_group_names, :port | ||
attr_accessor :password, :parameter_group_name, :security_group_names, :port, :source_snapshot_id | ||
|
||
def create_read_replica(replica_id, options={}) | ||
options[:security_group_names] ||= options['DBSecurityGroups'] | ||
|
@@ -104,16 +104,22 @@ def modify(immediately, options) | |
end | ||
|
||
def save | ||
requires :engine | ||
requires :allocated_storage | ||
requires :master_username | ||
requires :password | ||
|
||
self.flavor_id ||= 'db.m1.small' | ||
|
||
data = service.create_db_instance(id, attributes_to_params) | ||
merge_attributes(data.body['CreateDBInstanceResult']['DBInstance']) | ||
true | ||
if source_snapshot_id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is pretty different, maybe we should just have a separate restore function (instead of having save pull double duty). I suspect that might make it clearer and less error prone for users. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Calling it restore is a probably a bit of a gaff on amazon's part, as it creates an entirely new server. There is no true "restore existing" functionality, you are just expected to create replacements. The behavior of this see: http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceFromDBSnapshot.html There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yeah, that makes sense. Thanks for clarifying. |
||
requires :id | ||
data = service.restore_db_instance_from_db_snapshot(source_snapshot_id, id, attributes_to_params) | ||
merge_attributes(data.body['RestoreDBInstanceFromDBSnapshotResult']['DBInstance']) | ||
else | ||
requires :engine | ||
requires :allocated_storage | ||
requires :master_username | ||
requires :password | ||
|
||
self.flavor_id ||= 'db.m1.small' | ||
|
||
data = service.create_db_instance(id, attributes_to_params) | ||
merge_attributes(data.body['CreateDBInstanceResult']['DBInstance']) | ||
true | ||
end | ||
end | ||
|
||
# Converts attributes to a parameter hash suitable for requests | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preference is to keep this out of the fog/fog-aws gemspec (since different versions are needed depending on which ruby you are using). We can have a guarded/warning if you try to do something that needs it without having it loaded yet.