mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|rds] Updates reference to service
This commit is contained in:
parent
a550c54407
commit
ca9fc51c82
11 changed files with 44 additions and 44 deletions
|
@ -3,7 +3,7 @@ require 'fog/core/model'
|
|||
module Fog
|
||||
module AWS
|
||||
class RDS
|
||||
|
||||
|
||||
class Parameter < Fog::Model
|
||||
|
||||
attribute :name, :aliases => ['ParameterName']
|
||||
|
@ -14,7 +14,7 @@ module Fog
|
|||
attribute :modifiable, :aliases => 'IsModifiable'
|
||||
attribute :apply_type, :aliases => 'ApplyType'
|
||||
attribute :value, :aliases => 'ParameterValue'
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,34 +3,34 @@ require 'fog/core/model'
|
|||
module Fog
|
||||
module AWS
|
||||
class RDS
|
||||
|
||||
|
||||
class ParameterGroup < Fog::Model
|
||||
|
||||
identity :id, :aliases => ['DBParameterGroupName', :name]
|
||||
attribute :family, :aliases => 'DBParameterGroupFamily'
|
||||
attribute :description, :aliases => 'Description'
|
||||
|
||||
|
||||
def save
|
||||
requires :family
|
||||
requires :description
|
||||
requires :id
|
||||
connection.create_db_parameter_group(id, family, description)
|
||||
service.create_db_parameter_group(id, family, description)
|
||||
end
|
||||
|
||||
|
||||
def modify(changes)
|
||||
connection.modify_db_parameter_group id, changes.collect {|c| {'ParameterName' => c[:name], 'ParameterValue' => c[:value], 'ApplyMethod' => c[:apply_method]}}
|
||||
service.modify_db_parameter_group id, changes.collect {|c| {'ParameterName' => c[:name], 'ParameterValue' => c[:value], 'ApplyMethod' => c[:apply_method]}}
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
requires :id
|
||||
connection.delete_db_parameter_group(id)
|
||||
service.delete_db_parameter_group(id)
|
||||
true
|
||||
end
|
||||
|
||||
|
||||
def parameters(filters={})
|
||||
connection.parameters({:group => self}.merge(filters))
|
||||
service.parameters({:group => self}.merge(filters))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,12 +10,12 @@ module Fog
|
|||
model Fog::AWS::RDS::ParameterGroup
|
||||
|
||||
def all
|
||||
data = connection.describe_db_parameter_groups.body['DescribeDBParameterGroupsResult']['DBParameterGroups']
|
||||
data = service.describe_db_parameter_groups.body['DescribeDBParameterGroupsResult']['DBParameterGroups']
|
||||
load(data) # data is an array of attribute hashes
|
||||
end
|
||||
|
||||
def get(identity)
|
||||
data = connection.describe_db_parameter_groups(identity).body['DescribeDBParameterGroupsResult']['DBParameterGroups'].first
|
||||
data = service.describe_db_parameter_groups(identity).body['DescribeDBParameterGroupsResult']['DBParameterGroups'].first
|
||||
new(data) # data is an attribute hash
|
||||
rescue Fog::AWS::RDS::NotFound
|
||||
nil
|
||||
|
@ -24,4 +24,4 @@ module Fog
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
marker = nil
|
||||
finished = false
|
||||
while !finished
|
||||
data = connection.describe_db_parameters(group.id, filters.merge(:marker => marker)).body
|
||||
data = service.describe_db_parameters(group.id, filters.merge(:marker => marker)).body
|
||||
result.concat(data['DescribeDBParametersResult']['Parameters'])
|
||||
marker = data['DescribeDBParametersResult']['Marker']
|
||||
finished = marker.nil?
|
||||
|
@ -34,4 +34,4 @@ module Fog
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ module Fog
|
|||
|
||||
def destroy
|
||||
requires :id
|
||||
connection.delete_db_security_group(id)
|
||||
service.delete_db_security_group(id)
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ module Fog
|
|||
requires :id
|
||||
requires :description
|
||||
|
||||
data = connection.create_db_security_group(id, description).body['CreateDBSecurityGroupResult']['DBSecurityGroup']
|
||||
data = service.create_db_security_group(id, description).body['CreateDBSecurityGroupResult']['DBSecurityGroup']
|
||||
merge_attributes(data)
|
||||
true
|
||||
end
|
||||
|
@ -55,7 +55,7 @@ module Fog
|
|||
end
|
||||
|
||||
def authorize_ingress(opts)
|
||||
data = connection.authorize_db_security_group_ingress(id, opts).body['AuthorizeDBSecurityGroupIngressResult']['DBSecurityGroup']
|
||||
data = service.authorize_db_security_group_ingress(id, opts).body['AuthorizeDBSecurityGroupIngressResult']['DBSecurityGroup']
|
||||
merge_attributes(data)
|
||||
end
|
||||
|
||||
|
@ -72,7 +72,7 @@ module Fog
|
|||
end
|
||||
|
||||
def revoke_ingress(opts)
|
||||
data = connection.revoke_db_security_group_ingress(id, opts).body['RevokeDBSecurityGroupIngressResult']['DBSecurityGroup']
|
||||
data = service.revoke_db_security_group_ingress(id, opts).body['RevokeDBSecurityGroupIngressResult']['DBSecurityGroup']
|
||||
merge_attributes(data)
|
||||
end
|
||||
|
||||
|
|
|
@ -20,14 +20,14 @@ module Fog
|
|||
|
||||
def all(filters = filters)
|
||||
self.filters = filters
|
||||
data = connection.describe_db_security_groups(filters).body['DescribeDBSecurityGroupsResult']['DBSecurityGroups']
|
||||
data = service.describe_db_security_groups(filters).body['DescribeDBSecurityGroupsResult']['DBSecurityGroups']
|
||||
load(data) # data is an array of attribute hashes
|
||||
end
|
||||
|
||||
# Example:
|
||||
# get('my_db_security_group') # => model for my_db_security_group
|
||||
def get(identity)
|
||||
data = connection.describe_db_security_groups(identity).body['DescribeDBSecurityGroupsResult']['DBSecurityGroups'].first
|
||||
data = service.describe_db_security_groups(identity).body['DescribeDBSecurityGroupsResult']['DBSecurityGroups'].first
|
||||
new(data) # data is an attribute hash
|
||||
rescue Fog::AWS::RDS::NotFound
|
||||
nil
|
||||
|
|
|
@ -36,8 +36,8 @@ module Fog
|
|||
def create_read_replica(replica_id, options={})
|
||||
options[:security_group_names] ||= options['DBSecurityGroups']
|
||||
params = self.class.new(options).attributes_to_params
|
||||
connection.create_db_instance_read_replica(replica_id, id, params)
|
||||
connection.servers.get(replica_id)
|
||||
service.create_db_instance_read_replica(replica_id, id, params)
|
||||
service.servers.get(replica_id)
|
||||
end
|
||||
|
||||
def ready?
|
||||
|
@ -46,42 +46,42 @@ module Fog
|
|||
|
||||
def destroy(snapshot_identifier=nil)
|
||||
requires :id
|
||||
connection.delete_db_instance(id, snapshot_identifier, snapshot_identifier.nil?)
|
||||
service.delete_db_instance(id, snapshot_identifier, snapshot_identifier.nil?)
|
||||
true
|
||||
end
|
||||
|
||||
def reboot
|
||||
connection.reboot_db_instance(id)
|
||||
service.reboot_db_instance(id)
|
||||
true
|
||||
end
|
||||
|
||||
def snapshots
|
||||
requires :id
|
||||
connection.snapshots(:server => self)
|
||||
service.snapshots(:server => self)
|
||||
end
|
||||
|
||||
def tags
|
||||
requires :id
|
||||
connection.list_tags_for_resource(id).
|
||||
service.list_tags_for_resource(id).
|
||||
body['ListTagsForResourceResult']['TagList']
|
||||
end
|
||||
|
||||
def add_tags(new_tags)
|
||||
requires :id
|
||||
connection.add_tags_to_resource(id, new_tags)
|
||||
service.add_tags_to_resource(id, new_tags)
|
||||
tags
|
||||
end
|
||||
|
||||
def remove_tags(tag_keys)
|
||||
requires :id
|
||||
connection.remove_tags_from_resource(id, tag_keys)
|
||||
service.remove_tags_from_resource(id, tag_keys)
|
||||
tags
|
||||
end
|
||||
|
||||
def modify(immediately, options)
|
||||
options[:security_group_names] ||= options['DBSecurityGroups']
|
||||
params = self.class.new(options).attributes_to_params
|
||||
data = connection.modify_db_instance(id, immediately, params)
|
||||
data = service.modify_db_instance(id, immediately, params)
|
||||
merge_attributes(data.body['ModifyDBInstanceResult']['DBInstance'])
|
||||
true
|
||||
end
|
||||
|
@ -94,7 +94,7 @@ module Fog
|
|||
|
||||
self.flavor_id ||= 'db.m1.small'
|
||||
|
||||
data = connection.create_db_instance(id, attributes_to_params)
|
||||
data = service.create_db_instance(id, attributes_to_params)
|
||||
merge_attributes(data.body['CreateDBInstanceResult']['DBInstance'])
|
||||
true
|
||||
end
|
||||
|
|
|
@ -10,12 +10,12 @@ module Fog
|
|||
model Fog::AWS::RDS::Server
|
||||
|
||||
def all
|
||||
data = connection.describe_db_instances.body['DescribeDBInstancesResult']['DBInstances']
|
||||
data = service.describe_db_instances.body['DescribeDBInstancesResult']['DBInstances']
|
||||
load(data) # data is an array of attribute hashes
|
||||
end
|
||||
|
||||
def get(identity)
|
||||
data = connection.describe_db_instances(identity).body['DescribeDBInstancesResult']['DBInstances'].first
|
||||
data = service.describe_db_instances(identity).body['DescribeDBInstancesResult']['DBInstances'].first
|
||||
new(data) # data is an attribute hash
|
||||
rescue Fog::AWS::RDS::NotFound
|
||||
nil
|
||||
|
@ -24,4 +24,4 @@ module Fog
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@ module Fog
|
|||
def destroy
|
||||
requires :id
|
||||
|
||||
connection.delete_db_snapshot(id)
|
||||
service.delete_db_snapshot(id)
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -34,14 +34,14 @@ module Fog
|
|||
requires :instance_id
|
||||
requires :id
|
||||
|
||||
data = connection.create_db_snapshot(instance_id, id).body['CreateDBSnapshotResult']['DBSnapshot']
|
||||
data = service.create_db_snapshot(instance_id, id).body['CreateDBSnapshotResult']['DBSnapshot']
|
||||
merge_attributes(data)
|
||||
true
|
||||
end
|
||||
|
||||
def server
|
||||
requires :instance_id
|
||||
connection.servers.get(instance_id)
|
||||
service.servers.get(instance_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -23,12 +23,12 @@ module Fog
|
|||
|
||||
def all(filters = filters)
|
||||
self.filters = filters
|
||||
data = connection.describe_db_snapshots(filters).body['DescribeDBSnapshotsResult']['DBSnapshots']
|
||||
data = service.describe_db_snapshots(filters).body['DescribeDBSnapshotsResult']['DBSnapshots']
|
||||
load(data) # data is an array of attribute hashes
|
||||
end
|
||||
|
||||
def get(identity)
|
||||
data = connection.describe_db_snapshots(:snapshot_id => identity).body['DescribeDBSnapshotsResult']['DBSnapshots'].first
|
||||
data = service.describe_db_snapshots(:snapshot_id => identity).body['DescribeDBSnapshotsResult']['DBSnapshots'].first
|
||||
new(data) # data is an attribute hash
|
||||
rescue Fog::AWS::RDS::NotFound
|
||||
nil
|
||||
|
@ -45,4 +45,4 @@ module Fog
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,12 +10,12 @@ module Fog
|
|||
model Fog::AWS::RDS::SubnetGroup
|
||||
|
||||
def all
|
||||
data = connection.describe_db_subnet_groups.body['DescribeDBSubnetGroupsResult']['DBSubnetGroups']
|
||||
data = service.describe_db_subnet_groups.body['DescribeDBSubnetGroupsResult']['DBSubnetGroups']
|
||||
load(data) # data is an array of attribute hashes
|
||||
end
|
||||
|
||||
def get(identity)
|
||||
data = connection.describe_db_subnet_groups(identity).body['DescribeDBSubnetGroupsResult']['DBSubnetGroups'].first
|
||||
data = service.describe_db_subnet_groups(identity).body['DescribeDBSubnetGroupsResult']['DBSubnetGroups'].first
|
||||
new(data) # data is an attribute hash
|
||||
rescue Fog::AWS::RDS::NotFound
|
||||
nil
|
||||
|
|
Loading…
Reference in a new issue