1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #2109 from eyardimci/master

[redshift] Support for AWS Redshift
This commit is contained in:
Efe Yardimci 2013-09-04 09:12:14 -07:00
commit 790ed63b82
66 changed files with 3508 additions and 0 deletions

View file

@ -20,6 +20,7 @@ module Fog
service(:glacier, 'aws/glacier', 'Glacier')
service(:iam, 'aws/iam', 'IAM')
service(:rds, 'aws/rds', 'RDS')
service(:redshift, 'aws/redshift', 'Redshift')
service(:ses, 'aws/ses', 'SES')
service(:simpledb, 'aws/simpledb', 'SimpleDB')
service(:sns, 'aws/sns', 'SNS')

View file

@ -0,0 +1,29 @@
module Fog
module Parsers
module Redshift
module AWS
require 'fog/aws/parsers/redshift/cluster_parser'
class Cluster < ClusterParser
def reset
super
@response = {}
end
def start_element(name, attrs = [])
super
end
def end_element(name)
super
case name
when 'Cluster'
@response = {name => @cluster}
end
end
end
end
end
end
end

View file

@ -0,0 +1,144 @@
module Fog
module Parsers
module Redshift
module AWS
class ClusterParser < Fog::Parsers::Base
# :cluster_identifier - (String)
# :node_type - (String)
# :cluster_status - (String)
# :modify_status - (String)
# :master_username - (String)
# :db_name - (String)
# :endpoint - (Hash)
# :address - (String)
# :port - (Integer)
# :cluster_create_time - (Time)
# :automated_snapshot_retention_period - (Integer)
# :cluster_security_groups - (Array)
# :cluster_security_group_name - (String)
# :status - (String)
# :vpc_security_groups - (Array)
# :vpc_security_group_id - (String)
# :status - (String)
# :cluster_parameter_groups - (Array)
# :parameter_group_name - (String)
# :parameter_apply_status - (String)
# :cluster_subnet_group_name - (String)
# :vpc_id - (String)
# :availability_zone - (String)
# :preferred_maintenance_window - (String)
# :pending_modified_values - (Hash)
# :master_user_password - (String)
# :node_type - (String)
# :number_of_nodes - (Integer)
# :cluster_type - (String)
# :cluster_version - (String)
# :automated_snapshot_retention_period - (Integer)
# :cluster_version - (String)
# :allow_version_upgrade - (Boolean)
# :number_of_nodes - (Integer)
# :publicly_accessible - (Boolean)
# :encrypted - (Boolean)
# :restore_status - (Hash)
# :status - (String)
# :current_restore_rate_in_mega_bytes_per_second - (Numeric)
# :snapshot_size_in_mega_bytes - (Integer)
# :progress_in_mega_bytes - (Integer)
# :elapsed_time_in_seconds - (Integer)
# :estimated_time_to_completion_in_seconds - (Integer)
def reset
@cluster = fresh_cluster
end
def fresh_cluster
{ 'ClusterParameterGroups' => [], 'ClusterSecurityGroups' => [], 'VpcSecurityGroups' => [],
'EndPoint' => {}, 'PendingModifiedValues'=> {}, 'RestoreStatus' => {}}
end
def start_element(name, attrs = [])
super
case name
when 'ClusterSecurityGroups'
@in_cluster_security_groups = true
@cluster_security_group = {}
when 'ClusterParameterGroups'
@cluster_parameter_group = {}
when 'VpcSecurityGroups'
@in_vpc_security_groups = true
@vpc_security_group = {}
when 'PendingModifiedValues'
@in_pending_modified_values = true
end
end
def end_element(name)
case name
when 'AvailabilityZone', 'ClusterIdentifier', 'ClusterStatus', 'ClusterSubnetGroupName', 'DBName',
'MasterUsername', 'ModifyStatus', 'PreferredMaintenanceWindow', 'VpcId'
@cluster[name] = value
when 'ClusterCreateTime'
@cluster[name] = Time.parse(value)
when 'AllowVersionUpgrade', 'Encrypted', 'PubliclyAccessible'
@cluster[name] = (value == true)
when 'Address'
@cluster['EndPoint'][name] = value
when 'Port'
@cluster['EndPoint'][name] = value.to_i
when 'NodeType', 'ClusterVersion'
if @in_pending_modified_values
@cluster['PendingModifiedValues'][name] = value
else
@cluster[name] = value
end
when 'NumberOfNodes', 'AutomatedSnapshotRetentionPeriod'
if @in_pending_modified_values
@cluster['PendingModifiedValues'][name] = value.to_i
else
@cluster[name] = value.to_i
end
when 'MasterUserPassword', 'ClusterType'
@cluster['PendingModifiedValues'][name] = value
when 'Status'
if @in_vpc_security_groups
@vpc_security_group[name] = value
elsif @in_cluster_security_groups
@cluster_security_group[name] = value
else
@cluster['RestoreStatus'][name] = value
end
when 'ParameterGroupName', 'ParameterApplyStatus'
@cluster_parameter_group[name] = value
when 'ClusterSecurityGroupName'
@cluster_security_group[name] = value
when 'VpcSecurityGroupId'
@vpc_security_group[name] = value
when 'SnapshotSizeInMegaBytes', 'ProgressInMegaBytes', 'ElapsedTimeInSeconds', 'EstimatedTimeToCompletionInSeconds'
@cluster['RestoreStatus'][name] = value.to_i
when 'CurrentRestoreRateInMegaBytesPerSecond'
@cluster['RestoreStatus'][name] = value.to_f
when 'ClusterSecurityGroups'
@in_cluster_security_groups = false
when 'VpcSecurityGroups'
@in_vpc_security_groups = false
when 'PendingModifiedValues'
@in_pending_modified_values = false
when 'ClusterParameterGroup'
@cluster['ClusterParameterGroups'] << {name => @cluster_parameter_group}
@cluster_parameter_group = {}
when 'ClusterSecurityGroup'
@cluster['ClusterSecurityGroups'] << {name => @cluster_security_group}
@cluster_security_group = {}
when 'VpcSecurityGroup'
@cluster['VpcSecurityGroups'] << {name => @vpc_security_group}
@vpc_security_group = {}
end
end
end
end
end
end
end

View file

@ -0,0 +1,50 @@
module Fog
module Parsers
module Redshift
module AWS
class ClusterSecurityGroupParser < Fog::Parsers::Base
# :cluster_security_group_name - (String)
# :description - (String)
# :ec_2_security_groups - (Array)
# :status - (String)
# :ec2_security_group_name - (String)
# :ec2_security_group_owner_id - (String)
# :ip_ranges - (Array)
# :status - (String)
# :cidrip - (String)
def reset
@cluster_security_group = fresh_cluster_security_group
end
def fresh_cluster_security_group
{'EC2SecurityGroups' => [], 'IPRanges' => []}
end
def start_element(name, attrs = [])
super
case name
when 'EC2SecurityGroups', 'IPRanges'
@list = {}
@list_name = name
end
end
def end_element(name)
super
case name
when 'ClusterSecurityGroupName', 'Description'
@cluster_security_group[name] = value
when 'EC2SecurityGroupName', 'EC2SecurityGroupOwnerId', 'CIDRIP', 'Status'
@list[name] = value
when 'EC2SecurityGroup', 'IPRange'
@cluster_security_group[@list_name] << {name => @list}
@list = {}
end
end
end
end
end
end
end

View file

@ -0,0 +1,32 @@
module Fog
module Parsers
module Redshift
module AWS
require 'fog/aws/parsers/redshift/cluster_snapshot_parser'
class ClusterSnapshot < ClusterSnapshotParser
# :parameter_group_name - (String)
# :parameter_group_status - (String)
def reset
super
@response = {}
end
def start_element(name, attrs = [])
super
end
def end_element(name)
super
case name
when 'Snapshot'
@response = @snapshot
end
end
end
end
end
end
end

View file

@ -0,0 +1,66 @@
module Fog
module Parsers
module Redshift
module AWS
class ClusterSnapshotParser < Fog::Parsers::Base
# :snapshot_identifier - (String)
# :cluster_identifier - (String)
# :snapshot_create_time - (Time)
# :status - (String)
# :port - (Integer)
# :availability_zone - (String)
# :cluster_create_time - (Time)
# :master_username - (String)
# :cluster_version - (String)
# :snapshot_type - (String)
# :node_type - (String)
# :number_of_nodes - (Integer)
# :db_name - (String)
# :vpc_id - (String)
# :encrypted - (Boolean)
# :accounts_with_restore_access - (Array)
# :account_id - (String)
# :owner_account - (String)
# :total_backup_size_in_mega_bytes - (Numeric)
# :actual_incremental_backup_size_in_mega_bytes - (Numeric)
# :backup_progress_in_mega_bytes - (Numeric)
# :current_backup_rate_in_mega_bytes_per_second - (Numeric)
# :estimated_seconds_to_completion - (Integer)
# :elapsed_time_in_seconds - (Integer)
def reset
@snapshot = fresh_snapshot
end
def fresh_snapshot
{'Snapshot' => { 'AccountsWithRestoreAccess' => [] }}
end
def start_element(name, attrs = [])
super
end
def end_element(name)
super
case name
when 'SnapshotIdentifier', 'ClusterIdentifier', 'Status', 'AvailabilityZone', 'MasterUsername', 'ClusterVersion', 'SnapshotType', 'NodeType',
'DBName', 'VpcId', 'OwnerAccount'
@snapshot['Snapshot'][name] = value
when 'Port', 'NumberOfNodes', 'ElapsedTimeInSeconds', 'EstimatedSecondsToCompletion'
@snapshot['Snapshot'][name] = value.to_i
when 'SnapshotCreateTime', 'ClusterCreateTime'
@snapshot['Snapshot'][name] = Time.parse(value)
when 'Encrypted'
@snapshot['Snapshot'][name] = (value == true)
when 'TotalBackupSizeInMegaBytes', 'ActualIncrementalBackupSizeInMegaBytes', 'BackupProgressInMegaBytes', 'CurrentBackupRateInMegaBytesPerSecond'
@snapshot['Snapshot'][name] = value.to_f
when 'AccountId'
@snapshot['Snapshot']['AccountsWithRestoreAccess'] << value
end
end
end
end
end
end
end

View file

@ -0,0 +1,51 @@
module Fog
module Parsers
module Redshift
module AWS
class ClusterSubnetGroupParser < Fog::Parsers::Base
# :cluster_subnet_group_name - (String)
# :description - (String)
# :vpc_id - (String)
# :subnet_group_status - (String)
# :subnets - (Array)
# :subnet_identifier - (String)
# :subnet_availability_zone - (Hash)
# :name - (String)
# :subnet_status - (String)
def reset
@response = { 'Subnets' => [] }
end
def fresh_subnet
{'SubnetAvailabilityZone'=>{}}
end
def start_element(name, attrs = [])
super
case name
when 'Subnets'
@subnet = fresh_subnet
end
end
def end_element(name)
super
case name
when 'ClusterSubnetGroupName', 'Desciption', 'VpcId', 'SubnetGroupStatus'
@response[name] = value
when 'SubnetIdentifier', 'SubnetStatus'
@subnet[name] = value
when 'Name'
@subnet['SubnetAvailabilityZone'][name] = value
when 'Subnet'
@response['Subnets'] << {name => @subnet}
@subnet = fresh_subnet
end
end
end
end
end
end
end

View file

@ -0,0 +1,30 @@
module Fog
module Parsers
module Redshift
module AWS
class CreateClusterParameterGroup < Fog::Parsers::Base
# :parameter_group_name - (String)
# :parameter_group_family - (String)
# :description - (String)
def reset
@response = {'ClusterParameterGroup'=>{}}
end
def start_element(name, attrs = [])
super
end
def end_element(name)
super
case name
when 'ParameterGroupName', 'ParameterGroupFamily', 'Description'
@response['ClusterParameterGroup'][name] = value
end
end
end
end
end
end
end

View file

@ -0,0 +1,31 @@
module Fog
module Parsers
module Redshift
module AWS
require 'fog/aws/parsers/redshift/cluster_security_group_parser'
class CreateClusterSecurityGroup < ClusterSecurityGroupParser
# :cluster_security_group
def reset
super
@response = {}
end
def start_element(name, attrs = [])
super
end
def end_element(name)
super
case name
when 'ClusterSecurityGroup'
@response['ClusterSecurityGroup'] = @cluster_security_group
end
end
end
end
end
end
end

View file

@ -0,0 +1,41 @@
module Fog
module Parsers
module Redshift
module AWS
class DescribeClusterParameterGroups < Fog::Parsers::Base
# :marker - (String)
# :parameter_groups - (Array)
# :parameter_group_name - (String)
# :parameter_group_family - (String)
# :description - (String)
def reset
@response = { 'ParameterGroups' => [] }
end
def start_element(name, attrs = [])
super
case name
when 'ParameterGroups'
@parameter_group = {}
end
end
def end_element(name)
super
case name
when 'Marker'
@response[name] = value
when 'ParameterGroupName', 'ParameterGroupFamily', 'Description'
@parameter_group[name] = value
when 'ClusterParameterGroup'
@response['ParameterGroups'] << {name => @parameter_group}
@parameter_group = {}
end
end
end
end
end
end
end

View file

@ -0,0 +1,48 @@
module Fog
module Parsers
module Redshift
module AWS
class DescribeClusterParameters < Fog::Parsers::Base
# :marker - (String)
# :parameters - (Array)
# :parameter_name - (String)
# :parameter_value - (String)
# :description - (String)
# :source - (String)
# :data_type - (String)
# :allowed_values - (String)
# :is_modifiable - (Boolean)
# :minimum_engine_version - (String)
def reset
@response = { 'Parameters' => [] }
end
def start_element(name, attrs = [])
super
case name
when 'Parameters'
@parameter = {}
end
end
def end_element(name)
super
case name
when 'Marker'
@response[name] = value
when 'ParameterName', 'ParameterValue', 'Description', 'Source', 'DataType', 'AllowedValues', 'MinimumEngineVersion'
@parameter[name] = value
when 'IsModifiable'
@parameter[name] = (value == true)
when 'Parameter'
@response['Parameters'] << {name => @parameter}
@parameter = {}
end
end
end
end
end
end
end

View file

@ -0,0 +1,38 @@
module Fog
module Parsers
module Redshift
module AWS
require 'fog/aws/parsers/redshift/cluster_security_group_parser'
class DescribeClusterSecurityGroups < ClusterSecurityGroupParser
# :marker - (String)
# :cluster_security_groups - (Array)
def reset
@response = { 'ClusterSecurityGroups' => [] }
end
def start_element(name, attrs = [])
super
case name
when 'ClusterSecurityGroups'
@cluster_security_group = fresh_cluster_security_group
end
end
def end_element(name)
super
case name
when 'Marker'
@response[name] = value
when 'ClusterSecurityGroup'
@response['ClusterSecurityGroups'] << { name => @cluster_security_group }
@cluster_security_group = fresh_cluster_security_group
end
end
end
end
end
end
end

View file

@ -0,0 +1,38 @@
module Fog
module Parsers
module Redshift
module AWS
require 'fog/aws/parsers/redshift/cluster_snapshot_parser'
class DescribeClusterSnapshots < ClusterSnapshotParser
# :marker - (String)
# :snapshots - (Array)
def reset
@response = { 'Snapshots' => [] }
end
def start_element(name, attrs = [])
super
case name
when 'Snapshots'
@snapshot = fresh_snapshot
end
end
def end_element(name)
super
case name
when 'Marker'
@response[name] = value
when 'Snapshot'
@response['Snapshots'] << @snapshot
@snapshot = fresh_snapshot
end
end
end
end
end
end
end

View file

@ -0,0 +1,58 @@
module Fog
module Parsers
module Redshift
module AWS
class DescribeClusterSubnetGroups < Fog::Parsers::Base
# :marker - (String)
# :cluster_subnet_groups - (Array<Hash>)
# :cluster_subnet_group_name - (String)
# :description - (String)
# :vpc_id - (String)
# :subnet_group_status - (String)
# :subnets - (Array<Hash>)
# :subnet_identifier - (String)
# :subnet_availability_zone - (Hash)
# :name - (String)
# :subnet_status - (String)
def reset
@response = { 'ClusterSubnetGroups' => [] }
end
def start_element(name, attrs = [])
super
case name
when 'ClusterSubnetGroups'
@cluster_subnet_group = {'Subnets' => []}
end
end
def end_element(name)
super
case name
when 'Marker'
@response[name] = value
when 'ClusterSubnetGroup'
@response['ClusterSubnetGroups'] << {name => @cluster_subnet_group}
@cluster_subnet_group = {'Subnets' => []}
when 'ClusterSubnetGroupName', 'Description', 'VpcId', 'SubnetGroupStatus'
@cluster_subnet_group[name] = value
when 'Subnet'
@cluster_subnet_group['Subnets'] << {name => @subnet} if @subnet
@subnet = {}
when 'SubnetAvailabilityZone'
@subnet['SubnetAvailabilityZone'] = {}
when 'Name'
@subnet['SubnetAvailabilityZone']['Name'] = value
when 'SubnetIdentifier', 'SubnetStatus'
@subnet[name] = value
end
end
end
end
end
end
end

View file

@ -0,0 +1,53 @@
module Fog
module Parsers
module Redshift
module AWS
class DescribeClusterVersions < Fog::Parsers::Base
# :marker - (String)
# :cluster_versions - (Array<Hash>)
# :cluster_version - (String)
# :cluster_parameter_group_family - (String)
# :description - (String)
def reset
@response = { 'ClusterVersions' => [] }
@cluster_version_depth = 0
end
def start_element(name, attrs = [])
super
case name
when 'ClusterVersions'
@cluster_version = {}
when 'ClusterVersion'
# Sadly, there are two nodes of different type named cluster_version
# that are nested, so we keep track of which one we're in
@cluster_version_depth += 1
end
end
def end_element(name)
super
case name
when 'Marker'
@response[name] = value
when 'ClusterVersion'
@cluster_version_depth -= 1
if @cluster_version_depth == 0
@response['ClusterVersions'] << {name => @cluster_version}
@cluster_version = {}
else
@cluster_version[name] = value
end
when 'ClusterParameterGroupFamily', 'Description'
@cluster_version[name] = value
end
end
end
end
end
end
end

View file

@ -0,0 +1,30 @@
module Fog
module Parsers
module Redshift
module AWS
require 'fog/aws/parsers/redshift/cluster_parser'
class DescribeClusters < ClusterParser
def reset
super
@response = {"ClusterSet" => []}
end
def start_element(name, attrs = [])
super
end
def end_element(name)
super
case name
when 'Cluster'
@response["ClusterSet"] << {name => @cluster}
@cluster = fresh_cluster
end
end
end
end
end
end
end

View file

@ -0,0 +1,49 @@
module Fog
module Parsers
module Redshift
module AWS
class DescribeDefaultClusterParameters < Fog::Parsers::Base
# :marker - (String)
# :parameter_group_family - (String)
# :parameters - (Array)
# :parameter_name - (String)
# :parameter_value - (String)
# :description - (String)
# :source - (String)
# :data_type - (String)
# :allowed_values - (String)
# :is_modifiable - (Boolean)
# :minimum_engine_version - (String)
def reset
@response = { 'Parameters' => [] }
end
def start_element(name, attrs = [])
super
case name
when 'Parameters'
@parameter = {}
end
end
def end_element(name)
super
case name
when 'Marker', 'ParameterGroupFamily'
@response[name] = value
when 'ParameterName', 'ParameterValue', 'Description', 'Source', 'DataType', 'AllowedValues', 'MinimumEngineVersion'
@parameter[name] = value
when 'IsModifiable'
@parameter[name] = (value == true)
when 'Parameter'
@response['Parameters'] << {name => @parameter}
@parameter = {}
end
end
end
end
end
end
end

View file

@ -0,0 +1,44 @@
module Fog
module Parsers
module Redshift
module AWS
class DescribeEvents < Fog::Parsers::Base
# :marker - (String)
# :events - (Array)
# :source_identifier - (String)
# :source_type - (String)
# :message - (String)
# :date - (Time)
def reset
@response = { 'Events' => [] }
end
def start_element(name, attrs = [])
super
case name
when 'Events'
@event = {}
end
end
def end_element(name)
super
case name
when 'Marker'
@response[name] = value
when 'SourceIdentifier', 'SourceType', 'Message'
@event[name] = value
when 'Date'
@event[name] = Time.parse(value)
when 'Event'
@response['Events'] << {name => @event}
@event = {}
end
end
end
end
end
end
end

View file

@ -0,0 +1,54 @@
module Fog
module Parsers
module Redshift
module AWS
class DescribeOrderableClusterOptions < Fog::Parsers::Base
# :marker - (String)
# :orderable_cluster_options - (Array)
# :cluster_version - (String)
# :cluster_type - (String)
# :node_type - (String)
# :availability_zones - (Array)
# :name - (String)
def reset
@response = { 'OrderableClusterOptions' => [] }
end
def fresh_orderable_cluster_option
{'AvailabilityZones' => []}
end
def start_element(name, attrs = [])
super
case name
when 'OrderableClusterOptions'
@orderable_cluster_option = fresh_orderable_cluster_option
when 'AvailabilityZones'
@availability_zone = {}
end
end
def end_element(name)
super
case name
when 'Marker'
@response[name] = value
when 'ClusterVersion', 'ClusterType', 'NodeType'
@orderable_cluster_option[name] = value
when 'Name'
@availability_zone[name] = value
when 'AvailabilityZone'
@orderable_cluster_option['AvailabilityZones'] << {name => @availability_zone}
@availability_zone = {}
when 'OrderableClusterOption'
@response['OrderableClusterOptions'] << {name => @orderable_cluster_option}
@orderable_cluster_option = fresh_orderable_cluster_option
end
end
end
end
end
end
end

View file

@ -0,0 +1,64 @@
module Fog
module Parsers
module Redshift
module AWS
class DescribeReservedNodeOfferings < Fog::Parsers::Base
# :marker - (String)
# :reserved_node_offerings - (Array)
# :reserved_node_offering_id - (String)
# :node_type - (String)
# :duration - (Integer)
# :fixed_price - (Numeric)
# :usage_price - (Numeric)
# :currency_code - (String)
# :offering_type - (String)
# :recurring_charges - (Array)
# :recurring_charge_amount - (Numeric)
# :recurring_charge_frequency - (String)
def reset
@response = { 'ReservedNodeOfferings' => [] }
end
def fresh_reserved_node_offering
{'RecurringCharges' => []}
end
def start_element(name, attrs = [])
super
case name
when 'ReservedNodeOfferings'
@reserved_node_offering = fresh_reserved_node_offering
when 'RecurringCharges'
@recurring_charge = {}
end
end
def end_element(name)
super
case name
when 'Marker'
@response[name] = value
when 'Duration'
@reserved_node_offering[name] = value.to_i
when 'FixedPrice', 'UsagePrice'
@reserved_node_offering[name] = value.to_f
when 'CurrencyCode', 'OfferingType', 'NodeType', 'ReservedNodeOfferingId'
@reserved_node_offering[name] = value
when 'RecurringChargeAmount'
@recurring_charge[name] = value.to_f
when 'RecurringChargeFrequency'
@recurring_charge[name] = value
when 'RecurringCharge'
@reserved_node_offering['RecurringCharges'] << {name => @recurring_charge}
@recurring_charge = {}
when 'ReservedNodeOffering'
@response['ReservedNodeOfferings'] << {name => @reserved_node_offering}
@reserved_node_offering = fresh_reserved_node_offering
end
end
end
end
end
end
end

View file

@ -0,0 +1,71 @@
module Fog
module Parsers
module Redshift
module AWS
class DescribeReservedNodes < Fog::Parsers::Base
# :marker - (String)
# :reserved_nodes - (Array)
# :reserved_node_id - (String)
# :reserved_node_offering_id - (String)
# :node_type - (String)
# :start_time - (Time)
# :duration - (Integer)
# :fixed_price - (Numeric)
# :usage_price - (Numeric)
# :currency_code - (String)
# :node_count - (Integer)
# :state - (String)
# :offering_type - (String)
# :recurring_charges - (Array)
# :recurring_charge_amount - (Numeric)
# :recurring_charge_frequency - (String)
def reset
@response = { 'ReservedNodes' => [] }
end
def fresh_reserved_nodes
{'RecurringCharges' => []}
end
def start_element(name, attrs = [])
super
case name
when 'ReservedNodes'
@reserved_node = fresh_reserved_nodes
when 'RecurringCharges'
@recurring_charge = {}
end
end
def end_element(name)
super
case name
when 'Marker'
@response[name] = value
when 'Duration', 'NodeCount'
@reserved_node[name] = value.to_i
when 'StartTime'
@reserved_node[name] = Time.parse(value)
when 'FixedPrice', 'UsagePrice'
@reserved_node[name] = value.to_f
when 'CurrencyCode', 'OfferingType', 'NodeType', 'ReservedNodeOfferingId', 'ReservedNodeId', 'State'
@reserved_node[name] = value
when 'RecurringChargeAmount'
@recurring_charge[name] = value.to_f
when 'RecurringChargeFrequency'
@recurring_charge[name] = value
when 'RecurringCharge'
@reserved_node['RecurringCharges'] << {name => @recurring_charge}
@recurring_charge = {}
when 'ReservedNode'
@response['ReservedNodes'] << {name => @reserved_node}
@reserved_node = fresh_reserved_node
end
end
end
end
end
end
end

View file

@ -0,0 +1,60 @@
module Fog
module Parsers
module Redshift
module AWS
class DescribeResize < Fog::Parsers::Base
# :target_node_type - (String)
# :target_number_of_nodes - (Integer)
# :target_cluster_type - (String)
# :status - (String)
# :import_tables_completed - (Array)
# :import_tables_in_progress - (Array)
# :import_tables_not_started - (Array)
def reset
@response = { 'ImportTablesCompleted' => [], 'ImportTablesInProgress' => [], 'ImportTablesNotStarted' => []}
end
def start_element(name, attrs = [])
super
case name
when 'ImportTablesCompleted'
@in_import_tables_completed = true
when 'ImportTablesInProgress'
@in_import_tables_in_progress = true
when 'ImportTablesNotStarted'
@in_import_tables_not_started = true
end
end
def end_element(name)
super
case name
when 'TargetNodeType', 'TargetClusterType', 'Status'
@response[name] = value
when 'TargetNumberOfNodes'
@response[name] = value.to_i
when 'ImportTablesCompleted'
@in_import_tables_completed = false
when 'ImportTablesInProgress'
@in_import_tables_in_progress = false
when 'ImportTablesNotStarted'
@in_import_tables_not_started = false
when 'member'
if @in_import_tables_completed
@response['ImportTablesCompleted'] << value
end
if @in_import_tables_not_started
@response['ImportTablesNotStarted'] << value
end
if @in_import_tables_in_progress
@response['ImportTablesInProgress'] << value
end
end
end
end
end
end
end
end

View file

@ -0,0 +1,58 @@
module Fog
module Parsers
module Redshift
module AWS
class PurchaseReservedNodeOffering < Fog::Parsers::Base
# :reserved_node_id - (String)
# :reserved_node_offering_id - (String)
# :node_type - (String)
# :start_time - (Time)
# :duration - (Integer)
# :fixed_price - (Numeric)
# :usage_price - (Numeric)
# :currency_code - (String)
# :node_count - (Integer)
# :state - (String)
# :offering_type - (String)
# :recurring_charges - (Array)
# :recurring_charge_amount - (Numeric)
# :recurring_charge_frequency - (String)
def reset
@response = { 'RecurringCharges' => [] }
end
def start_element(name, attrs = [])
super
case name
when 'RecurringCharges'
@recurring_charge = {}
end
end
def end_element(name)
super
case name
when 'ReservedNodeId', 'ReservedNodeOfferingId', 'NodeType', 'CurrencyCode', 'State', 'OfferingType'
@response[name] = value
when 'Duration', 'NodeCount'
@response[name] = value.to_i
when 'FixedPrice', 'UsagePrice'
@response[name] = value.to_f
when 'StartTime'
@response[name] = Time.parse(value)
when 'RecurringChargeAmount'
@recurring_charge[name] = value.to_f
when 'RecurringChargeFrequency'
@recurring_charge[name] = value
when 'RecurringCharge'
@response['RecurringCharges'] << {name => @recurring_charge}
@recurring_charge = {}
end
end
end
end
end
end
end

View file

@ -0,0 +1,31 @@
module Fog
module Parsers
module Redshift
module AWS
require 'fog/aws/parsers/redshift/cluster_security_group_parser'
class RevokeClusterSecurityGroupIngress < ClusterSecurityGroupParser
# :cluster_security_group
def reset
super
@response = {}
end
def start_element(name, attrs = [])
super
end
def end_element(name)
super
case name
when 'ClusterSecurityGroup'
@response['ClusterSecurityGroup'] = @cluster_security_group
end
end
end
end
end
end
end

View file

@ -0,0 +1,29 @@
module Fog
module Parsers
module Redshift
module AWS
class UpdateClusterParameterGroupParser < Fog::Parsers::Base
# :parameter_group_name - (String)
# :parameter_group_status - (String)
def reset
@response = {}
end
def start_element(name, attrs = [])
super
end
def end_element(name)
super
case name
when 'ParameterGroupName', 'ParameterGroupStatus'
@response[name] = value
end
end
end
end
end
end
end

126
lib/fog/aws/redshift.rb Normal file
View file

@ -0,0 +1,126 @@
require 'fog/aws'
module Fog
module AWS
class Redshift < Fog::Service
extend Fog::AWS::CredentialFetcher::ServiceMethods
requires :aws_access_key_id, :aws_secret_access_key
recognizes :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at
request_path 'fog/aws/requests/redshift'
request :describe_clusters
request :describe_cluster_parameter_groups
request :describe_cluster_parameters
request :describe_cluster_security_groups
request :describe_cluster_snapshots
request :describe_cluster_subnet_groups
request :describe_cluster_versions
request :describe_default_cluster_parameters
request :describe_events
request :describe_orderable_cluster_options
request :describe_reserved_node_offerings
request :describe_reserved_nodes
request :describe_resize
request :create_cluster
request :create_cluster_parameter_group
request :create_cluster_security_group
request :create_cluster_snapshot
request :create_cluster_subnet_group
request :modify_cluster
request :modify_cluster_parameter_group
request :modify_cluster_subnet_group
request :delete_cluster
request :delete_cluster_parameter_group
request :delete_cluster_security_group
request :delete_cluster_snapshot
request :delete_cluster_subnet_group
request :authorize_cluster_security_group_ingress
request :authorize_snapshot_access
request :copy_cluster_snapshot
request :purchase_reserved_node_offering
request :reboot_cluster
request :reset_cluster_parameter_group
request :restore_from_cluster_snapshot
request :revoke_cluster_security_group_ingress
request :revoke_snapshot_access
class Mock
def initialize(options={})
Fog::Mock.not_implemented
end
end
class Real
include Fog::AWS::CredentialFetcher::ConnectionMethods
# Initialize connection to Redshift
#
# ==== Notes
# options parameter must include values for :aws_access_key_id and
# :aws_secret_access_key in order to create a connection
#
# ==== Examples
# ses = SES.new(
# :aws_access_key_id => your_aws_access_key_id,
# :aws_secret_access_key => your_aws_secret_access_key
# )
#
# ==== Parameters
# * options<~Hash> - config arguments for connection. Defaults to {}.
# * region<~String> - optional region to use. For instance, 'us-east-1' and etc.
#
# ==== Returns
# * Redshift object with connection to AWS.
def initialize(options={})
@use_iam_profile = options[:use_iam_profile]
@region = options[:region] || 'us-east-1'
setup_credentials(options)
@connection_options = options[:connection_options] || {}
@host = options[:host] || "redshift.#{@region}.amazonaws.com"
@version = '2012-12-01'
@path = options[:path] || '/'
@persistent = options[:persistent] || false
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
end
private
def setup_credentials(options)
@aws_access_key_id = options[:aws_access_key_id]
@aws_secret_access_key = options[:aws_secret_access_key]
@aws_session_token = options[:aws_session_token]
@aws_credentials_expire_at = options[:aws_credentials_expire_at]
@signer = Fog::AWS::SignatureV4.new( @aws_access_key_id, @aws_secret_access_key,@region,'redshift')
end
def request(params, &block)
refresh_credentials_if_expired
parser = params.delete(:parser)
date = Fog::Time.now
params[:headers]['Date'] = date.to_date_header
params[:headers]['x-amz-date'] = date.to_iso8601_basic
params[:headers]['Host'] = @host
params[:headers]['x-amz-redshift-version'] = @version
params[:headers]['x-amz-security-token'] = @aws_session_token if @aws_session_token
params[:headers]['Authorization'] = @signer.sign params, date
response = @connection.request(params.merge(:parser => parser), &block)
response
end
end
end
end
end

View file

@ -0,0 +1,56 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/revoke_cluster_security_group_ingress'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_security_group_name - required - (String)
# The name of the security Group from which to revoke the ingress rule.
# * :cidrip - (String)
# The IP range for which to revoke access. This range must be a valid Classless
# Inter-Domain Routing (CIDR) block of IP addresses. If CIDRIP is specified,
# EC2SecurityGroupName and EC2SecurityGroupOwnerId cannot be provided.
# * :ec2_security_group_name - (String)
# The name of the EC2 Security Group whose access is to be revoked. If
# EC2SecurityGroupName is specified, EC2SecurityGroupOwnerId must also be
# provided and CIDRIP cannot be provided.
# * :ec2_security_group_owner_id - (String)
# The AWS account number of the owner of the security group specified in the
# EC2SecurityGroupName parameter. The AWS access key ID is not an acceptable
# value. If EC2SecurityGroupOwnerId is specified, EC2SecurityGroupName must
# also be provided. and CIDRIP cannot be provided. Example: 111122223333
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_AuthorizeClusterSecurityGroupIngress.html
def authorize_cluster_security_group_ingress(options = {})
cluster_security_group_name = options[:cluster_security_group_name]
cidrip = options[:cidrip]
ec2_security_group_name = options[:ec2_security_group_name]
ec2_security_group_owner_id = options[:ec2_security_group_owner_id]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::RevokeClusterSecurityGroupIngress.new
}
params[:query]['Action'] = 'AuthorizeClusterSecurityGroupIngress'
params[:query]['ClusterSecurityGroupName'] = cluster_security_group_name if cluster_security_group_name
params[:query]['CIDRIP'] = cidrip if cidrip
params[:query]['EC2SecurityGroupName'] = ec2_security_group_name if ec2_security_group_name
params[:query]['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id if ec2_security_group_owner_id
request(params)
end
end
end
end
end

View file

@ -0,0 +1,43 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster_snapshot'
# ==== Parameters
#
# @param [Hash] options
# * :snapshot_identifier - required - (String)
# The identifier of the snapshot the account is authorized to restore.
# * :snapshot_cluster_identifier - (String)
# * :account_with_restore_access - required - (String)
# The identifier of the AWS customer account authorized to restore the specified snapshot. #
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_CopyClusterSnapshot.html
def authorize_snapshot_access(options = {})
snapshot_identifier = options[:snapshot_identifier]
snapshot_cluster_identifier = options[:snapshot_cluster_identifier]
account_with_restore_access = options[:account_with_restore_access]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::ClusterSnapshot.new
}
params[:query]['Action'] = 'AuthorizeSnapshotAccess'
params[:query]['SnapshotIdentifier'] = snapshot_identifier if snapshot_identifier
params[:query]['SnapshotClusterIdentifier'] = snapshot_cluster_identifier if snapshot_cluster_identifier
params[:query]['AccountWithRestoreAccess'] = account_with_restore_access if account_with_restore_access
request(params)
end
end
end
end
end

View file

@ -0,0 +1,48 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster_snapshot'
# ==== Parameters
#
# @param [Hash] options
# * :source_snapshot_identifier - required - (String)
# The identifier for the source snapshot. Constraints: Must be the identifier for
# a valid automated snapshot whose state is "available".
# * :source_snapshot_cluster_identifier - (String)
# * :target_snapshot_identifier - required - (String)
# The identifier given to the new manual snapshot. Constraints: Cannot be null,
# empty, or blank. Must contain from 1 to 255 alphanumeric characters or hyphens.
# First character must be a letter. Cannot end with a hyphen or contain two
# consecutive hyphens. Must be unique for the AWS account that is making the request.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_CopyClusterSnapshot.html
def copy_cluster_snapshot(options = {})
source_snapshot_identifier = options[:source_snapshot_identifier]
source_snapshot_cluster_identifier = options[:source_snapshot_cluster_identifier]
target_snapshot_identifier = options[:target_snapshot_identifier]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::ClusterSnapshot.new
}
params[:query]['Action'] = 'CopyClusterSnapshot'
params[:query]['SourceSnapshotIdentifier'] = source_snapshot_identifier if source_snapshot_identifier
params[:query]['SourceSnapshotClusterIdentifier'] = source_snapshot_cluster_identifier if source_snapshot_cluster_identifier
params[:query]['TargetSnapshotIdentifier'] = target_snapshot_identifier if target_snapshot_identifier
request(params)
end
end
end
end
end

View file

@ -0,0 +1,151 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster'
# ==== Parameters
#
# @param [Hash] options
# * :db_name - (String)
# The name of the first database to be created when the cluster is created. To create
# additional databases after the cluster is created, connect to the cluster with a SQL
# client and use SQL commands to create a database. Default: dev Constraints: Must
# contain 1 to 64 alphanumeric characters. Must contain only lowercase letters.
# * :cluster_identifier - required - (String)
# A unique identifier for the cluster. You use this identifier to refer to the cluster
# for any subsequent cluster operations such as deleting or modifying. Must be unique
# for all clusters within an AWS account. Example: myexamplecluster
# * :cluster_type - (String)
# Type of the cluster. When cluster type is specified as single-node, the NumberOfNodes
# parameter is not required. multi-node, the NumberOfNodes parameter is required. Valid
# Values: multi-node | single-node Default: multi-node
# * :node_type - required - (String)
# The node type to be provisioned. Valid Values: dw.hs1.xlarge | dw.hs1.8xlarge.
# * :master_username - required - (String)
# The user name associated with the master user account for the cluster that is being
# created. Constraints: Must be 1 - 128 alphanumeric characters. First character must
# be a letter. Cannot be a reserved word.
# * :master_user_password - required - (String)
# The password associated with the master user account for the cluster that is being
# created. Constraints: Must be between 8 and 64 characters in length. Must contain at
# least one uppercase letter. Must contain at least one lowercase letter. Must contain
# one number.
# * :cluster_security_groups - (Array<String>)
# A list of security groups to be associated with this cluster. Default: The default
# cluster security group for Amazon Redshift.
# * :vpc_security_group_ids - (Array<String>)
# A list of Virtual Private Cloud (VPC) security groups to be associated with the
# cluster. Default: The default VPC security group is associated with the cluster.
# * :cluster_subnet_group_name - (String)
# The name of a cluster subnet group to be associated with this cluster. If this
# parameter is not provided the resulting cluster will be deployed outside virtual
# private cloud (VPC).
# * :availability_zone - (String)
# The EC2 Availability Zone (AZ) in which you want Amazon Redshift to provision the
# cluster. Default: A random, system-chosen Availability Zone in the region that is
# specified by the endpoint. Example: us-east-1d Constraint: The specified
# Availability Zone must be in the same region as the current endpoint.
# * :preferred_maintenance_window - (String)
# The weekly time range (in UTC) during which automated cluster maintenance can occur.
# Format: ddd:hh24:mi-ddd:hh24:mi Default: A 30-minute window selected at random from
# an 8-hour block of time per region, occurring on a random day of the week.
# Constraints: Minimum 30-minute window.
# * :cluster_parameter_group_name - (String)
# The name of the parameter group to be associated with this cluster. Default: The
# default Amazon Redshift cluster parameter group. Constraints: Must be 1 to 255
# alphanumeric characters or hyphens. First character must be a letter. Cannot end
# with a hyphen or contain two consecutive hyphens.
# * :automated_snapshot_retention_period - (Integer)
# Number of days that automated snapshots are retained. If the value is 0, automated
# snapshots are disabled. Default: 1 Constraints: Must be a value from 0 to 35.
# * :port - (Integer)
# The port number on which the cluster accepts incoming connections. Default: 5439
# Valid Values: 1150-65535
# * :cluster_version - (String)
# The version of the Amazon Redshift engine software that you want to deploy on the
# cluster. The version selected runs on all the nodes in the cluster. Constraints:
# Only version 1.0 is currently available. Example: 1.0
# * :allow_version_upgrade - (Boolean)
# If `true` , upgrades can be applied during the maintenance window to the Amazon
# Redshift engine that is running on the cluster. Default: `true`
# * :number_of_nodes - (Integer)
# The number of compute nodes in the cluster. This parameter is required when the
# ClusterType parameter is specified as multi-node. If you don't specify this parameter,
# you get a single-node cluster. When requesting a multi-node cluster, you must specify
# the number of nodes that you want in the cluster. Default: 1 Constraints: Value must
# be at least 1 and no more than 100.
# * :publicly_accessible - (Boolean)
# If `true` , the cluster can be accessed from a public network.
# * :encrypted - (Boolean)
# If `true` , the data in cluster is encrypted at rest. Default: `false`
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_CreateCluster.html
def create_cluster(options = {})
db_name = options[:db_name]
cluster_identifier = options[:cluster_identifier]
cluster_type = options[:cluster_type]
node_type = options[:node_type]
master_username = options[:master_username]
master_user_password = options[:master_user_password]
cluster_subnet_group_name = options[:cluster_subnet_group_name]
availability_zone = options[:availability_zone]
preferred_maintenance_window = options[:preferred_maintenance_window]
cluster_parameter_group_name = options[:cluster_parameter_group_name]
automated_snapshot_retention_period = options[:automated_snapshot_retention_period]
port = options[:port]
cluster_version = options[:cluster_version]
allow_version_upgrade = options[:allow_version_upgrade]
number_of_nodes = options[:number_of_nodes]
publicly_accessible = options[:publicly_accessible]
encrypted = options[:encrypted]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::Cluster.new
}
if cluster_security_groups = options.delete(:ClusterSecurityGroups)
params[:query].merge!(Fog::AWS.indexed_param('ClusterSecurityGroups.member.%d', [*cluster_security_groups]))
end
if vpc_security_group_ids = options.delete(:VpcSecurityGroupIds)
params[:query].merge!(Fog::AWS.indexed_param('VpcSecurityGroupIds.member.%d', [*vpc_security_group_ids]))
end
params[:query]['Action'] = 'CreateCluster'
params[:query]['DBName'] = db_name if db_name
params[:query]['ClusterIdentifier'] = cluster_identifier if cluster_identifier
params[:query]['ClusterType'] = cluster_type if cluster_type
params[:query]['NodeType'] = node_type if node_type
params[:query]['MasterUsername'] = master_username if master_username
params[:query]['MasterUserPassword'] = master_user_password if master_user_password
params[:query]['ClusterSecurityGroups'] = cluster_security_groups if cluster_security_groups
params[:query]['VpcSecurityGroupIds'] = vpc_security_group_ids if vpc_security_group_ids
params[:query]['ClusterSubnetGroupName'] = cluster_subnet_group_name if cluster_subnet_group_name
params[:query]['AvailabilityZone'] = availability_zone if availability_zone
params[:query]['PreferredMaintenanceWindow'] = preferred_maintenance_window if preferred_maintenance_window
params[:query]['ClusterParameterGroupName'] = cluster_parameter_group_name if cluster_parameter_group_name
params[:query]['AutomatedSnapshotRetentionPeriod'] = automated_snapshot_retention_period if automated_snapshot_retention_period
params[:query]['Port'] = port if port
params[:query]['ClusterVersion'] = cluster_version if cluster_version
params[:query]['AllowVersionUpgrade'] = allow_version_upgrade if allow_version_upgrade
params[:query]['NumberOfNodes'] = number_of_nodes if number_of_nodes
params[:query]['PubliclyAccessible'] = publicly_accessible if publicly_accessible
params[:query]['Encrypted'] = encrypted if encrypted
request(params)
end
end
end
end
end

View file

@ -0,0 +1,54 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/create_cluster_parameter_group'
# ==== Parameters
#
# @param [Hash] options
# * :parameter_group_name - required - (String)
# The name of the cluster parameter group. Constraints: Must be 1 to 255 alphanumeric
# characters or hyphens First character must be a letter. Cannot end with a hyphen or
# contain two consecutive hyphens. Must be unique within your AWS account. This value
# is stored as a lower-case string.
# * :parameter_group_family - required - (String)
# The Amazon Redshift engine version to which the cluster parameter group applies. The
# cluster engine version determines the set of parameters. To get a list of valid parameter
# group family names, you can call DescribeClusterParameterGroups. By default, Amazon
# Redshift returns a list of all the parameter groups that are owned by your AWS account,
# including the default parameter groups for each Amazon Redshift engine version. The
# parameter group family names associated with the default parameter groups provide you
# the valid values. For example, a valid family name is "redshift-1.0".
# * :description - required - (String)
# A description of the parameter group.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_CreateClusterParameterGroup.html
def create_cluster_parameter_group(options = {})
parameter_group_name = options[:parameter_group_name]
parameter_group_family = options[:parameter_group_family]
description = options[:description]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::CreateClusterParameterGroup.new
}
params[:query]['Action'] = 'CreateClusterParameterGroup'
params[:query]['ParameterGroupName'] = parameter_group_name if parameter_group_name
params[:query]['ParameterGroupFamily'] = parameter_group_family if parameter_group_family
params[:query]['Description'] = description if description
request(params)
end
end
end
end
end

View file

@ -0,0 +1,42 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/create_cluster_security_group'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_security_group_name - (String)
# The name of a cluster security group for which you are requesting details. You
# can specify either the Marker parameter or a ClusterSecurityGroupName parameter,
# but not both. Example: securitygroup1
# * :description - required - (String)
# A description for the security group.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_CreateClusterSecurityGroup.html
def create_cluster_security_group(options = {})
cluster_security_group_name = options[:cluster_security_group_name]
description = options[:description]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::CreateClusterSecurityGroup.new
}
params[:query]['Action'] = 'CreateClusterSecurityGroup'
params[:query]['ClusterSecurityGroupName'] = cluster_security_group_name if cluster_security_group_name
params[:query]['Description'] = description if description
request(params)
end
end
end
end
end

View file

@ -0,0 +1,44 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster_snapshot'
# ==== Parameters
#
# @param [Hash] options
# * :snapshot_identifier - required - (String)
# A unique identifier for the snapshot that you are requesting. This identifier
# must be unique for all snapshots within the AWS account. Constraints: Cannot be
# null, empty, or blank Must contain from 1 to 255 alphanumeric characters or
# hyphens First character must be a letter Cannot end with a hyphen or contain two
# consecutive hyphens Example: my-snapshot-id
# * :cluster_identifier - required - (String)
# The cluster identifier for which you want a snapshot.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_CreateClusterSnapshot.html
def create_cluster_snapshot(options = {})
snapshot_identifier = options[:snapshot_identifier]
cluster_identifier = options[:cluster_identifier]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::ClusterSnapshot.new
}
params[:query]['Action'] = 'CreateClusterSnapshot'
params[:query]['SnapshotIdentifier'] = snapshot_identifier if snapshot_identifier
params[:query]['ClusterIdentifier'] = cluster_identifier if cluster_identifier
request(params)
end
end
end
end
end

View file

@ -0,0 +1,50 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster_subnet_group_parser'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_subnet_group_name - required - (String)
# The name for the subnet group. Amazon Redshift stores the value as a lowercase string.
# Constraints: Must contain no more than 255 alphanumeric characters or hyphens. Must not
# be "Default". Must be unique for all subnet groups that are created by your AWS account.
# Example: examplesubnetgroup
# * :description - required - (String)
# A description of the parameter group.
# * :subnet_ids - required - (Array<)
# An array of VPC subnet IDs. A maximum of 20 subnets can be modified in a single request.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_CreateClusterSubnetGroup.html
def create_cluster_subnet_group(options = {})
cluster_subnet_group_name = options[:cluster_subnet_group_name]
description = options[:description]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::ClusterSubnetGroupParser.new
}
if subnet_ids = options.delete(:subnet_ids)
params[:query].merge!(Fog::AWS.indexed_param('SubnetIds.member.%d', [*subnet_ids]))
end
params[:query]['Action'] = 'CreateClusterSubnetGroup'
params[:query]['ClusterSubnetGroupName'] = cluster_subnet_group_name if cluster_subnet_group_name
params[:query]['Description'] = description if description
request(params)
end
end
end
end
end

View file

@ -0,0 +1,51 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_identifier - required - (String)
# A unique identifier for the cluster. You use this identifier to refer to the cluster
# for any subsequent cluster operations such as deleting or modifying. Must be unique
# for all clusters within an AWS account. Example: myexamplecluster
# * :skip_final_cluster_snapshot - (Boolean)
# Determines whether a final snapshot of the cluster is created before Amazon Redshift
# deletes the cluster. If `true` , a final cluster snapshot is not created. If `false`,
# a final cluster snapshot is created before the cluster is deleted. The
# FinalClusterSnapshotIdentifier parameter must be specified if SkipFinalClusterSnapshot
# is `false` . Default: `false`
# * :final_cluster_snapshot_identifier - (String)
# The identifier of the final snapshot that is to be created immediately before deleting
# the cluster. If this parameter is provided, SkipFinalClusterSnapshot must be `false`.
# Constraints: Must be 1 to 255 alphanumeric characters. First character must be a letter
# Cannot end with a hyphen or contain two consecutive hyphens.
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DeleteCluster.html
def delete_cluster(options = {})
cluster_identifier = options[:cluster_identifier]
final_cluster_snapshot_identifier = options[:final_cluster_snapshot_identifier]
skip_final_cluster_snapshot = options[:skip_final_cluster_snapshot]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::Cluster.new
}
params[:query]['Action'] = 'DeleteCluster'
params[:query]['ClusterIdentifier'] = cluster_identifier if cluster_identifier
params[:query]['FinalClusterSnapshotIdentifier'] = final_cluster_snapshot_identifier if final_cluster_snapshot_identifier
params[:query]['SkipFinalClusterSnapshot'] = skip_final_cluster_snapshot if skip_final_cluster_snapshot
request(params)
end
end
end
end
end

View file

@ -0,0 +1,34 @@
module Fog
module AWS
class Redshift
class Real
# ==== Parameters
#
# @param [Hash] options
# * :parameter_group_name - required - (String)
# The name of the parameter group to be deleted. Constraints: Must be the name of an
# existing cluster parameter group. Cannot delete a default cluster parameter group.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DeleteClusterParameterGroup.html
def delete_cluster_parameter_group(options = {})
parameter_group_name = options[:parameter_group_name]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {}
}
params[:query]['Action'] = 'DeleteClusterParameterGroup'
params[:query]['ParameterGroupName'] = parameter_group_name if parameter_group_name
request(params)
end
end
end
end
end

View file

@ -0,0 +1,33 @@
module Fog
module AWS
class Redshift
class Real
# ==== Parameters
#
# @param [Hash] options
# * :cluster_security_group_name - required - (String)
# The name of the cluster security group to be deleted.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DeleteClusterSecurityGroup.html
def delete_cluster_security_group(options = {})
cluster_security_group_name = options[:cluster_security_group_name]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {}
}
params[:query]['Action'] = 'DeleteClusterSecurityGroup'
params[:query]['ClusterSecurityGroupName'] = cluster_security_group_name if cluster_security_group_name
request(params)
end
end
end
end
end

View file

@ -0,0 +1,44 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster_snapshot'
# ==== Parameters
#
# @param [Hash] options
# * :snapshot_identifier - required - (String)
# A unique identifier for the snapshot that you are requesting. This identifier
# must be unique for all snapshots within the AWS account. Constraints: Cannot be
# null, empty, or blank Must contain from 1 to 255 alphanumeric characters or
# hyphens First character must be a letter Cannot end with a hyphen or contain two
# consecutive hyphens Example: my-snapshot-id
# * :snapshot_cluster_identifier - required - (String)
# The cluster identifier for which you want a snapshot.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_CreateClusterSnapshot.html
def delete_cluster_snapshot(options = {})
snapshot_identifier = options[:snapshot_identifier]
snapshot_cluster_identifier = options[:snapshot_cluster_identifier]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::ClusterSnapshot.new
}
params[:query]['Action'] = 'DeleteClusterSnapshot'
params[:query]['SnapshotIdentifier'] = snapshot_identifier if snapshot_identifier
params[:query]['SnapshotClusterIdentifier'] = snapshot_cluster_identifier if snapshot_cluster_identifier
request(params)
end
end
end
end
end

View file

@ -0,0 +1,38 @@
module Fog
module AWS
class Redshift
class Real
# ==== Parameters
#
# @param [Hash] options
# * :cluster_subnet_group_name - required - (String)
# The name for the subnet group. Amazon Redshift stores the value as a lowercase string.
# Constraints: Must contain no more than 255 alphanumeric characters or hyphens. Must not
# be "Default". Must be unique for all subnet groups that are created by your AWS account.
# Example: examplesubnetgroup
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DeleteClusterSubnetGroup.html
def delete_cluster_subnet_group(options = {})
cluster_subnet_group_name = options[:cluster_subnet_group_name]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :delete,
:query => {}
}
params[:query]['Action'] = 'DeleteClusterSubnetGroup'
params[:query]['ClusterSubnetGroupName'] = cluster_subnet_group_name if cluster_subnet_group_name
request(params)
end
end
end
end
end

View file

@ -0,0 +1,48 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_cluster_parameter_groups'
# ==== Parameters
#
# @param [Hash] options
# * :parameter_group_name (String)
# The name of a cluster parameter group for which to return details.
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeClusterParameterGroups.html
def describe_cluster_parameter_groups(options = {})
parameter_group_name = options[:parameter_group_name]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeClusterParameterGroups.new
}
params[:query]['Action'] = 'DescribeClusterParameterGroups'
params[:query]['ParameterGroupName'] = parameter_group_name if parameter_group_name
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,55 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_cluster_parameters'
# ==== Parameters
#
# @param [Hash] options
# * :parameter_group_name - required - (String)
# The name of a cluster parameter group for which to return details.
# * :source - (String)
# The parameter types to return. Specify user to show parameters that are
# different form the default. Similarly, specify engine-default to show parameters
# that are the same as the default parameter group. Default: All parameter types
# returned. Valid Values: user | engine-default
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeClusterParameters.html
def describe_cluster_parameters(options = {})
parameter_group_name = options[:parameter_group_name]
source = options[:source]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeClusterParameters.new
}
params[:query]['Action'] = 'DescribeClusterParameters'
params[:query]['ParameterGroupName'] = parameter_group_name if parameter_group_name
params[:query]['Source'] = source if source
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,50 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_cluster_security_groups'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_security_group_name - (String)
# The name of a cluster security group for which you are requesting details. You
# can specify either the Marker parameter or a ClusterSecurityGroupName parameter,
# but not both. Example: securitygroup1
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeClusterSecurityGroups.html
def describe_cluster_security_groups(options = {})
cluster_security_group_name = options[:cluster_security_group_name]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeClusterSecurityGroups.new
}
params[:query]['Action'] = 'DescribeClusterSecurityGroups'
params[:query]['ClusterSecurityGroupName'] = cluster_security_group_name if cluster_security_group_name
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,73 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_cluster_snapshots'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_identifier - (String)
# The identifier of the cluster for which information about snapshots is requested.
# * :snapshot_identifier - (String)
# The snapshot identifier of the snapshot about which to return information.
# * :snapshot_type - (String)
# The type of snapshots for which you are requesting information. By default,
# snapshots of all types are returned. Valid Values: automated | manual
# * :start_time - (String)
# A value that requests only snapshots created at or after the specified time.
# The time value is specified in ISO 8601 format. For more information about
# ISO 8601, go to the ISO8601 Wikipedia page. Example: 2012-07-16T18:00:00Z
# * :end_time - (String)
# A time value that requests only snapshots created at or before the specified
# time. The time value is specified in ISO 8601 format. For more information
# about ISO 8601, go to the ISO8601 Wikipedia page. Example: 2012-07-16T18:00:00Z
# * :owner_account - (String)
# The AWS customer account used to create or copy the snapshot. Use this field to
# filter the results to snapshots owned by a particular account. To describe snapshots
# you own, either specify your AWS customer account, or do not specify the parameter.
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeClusterSnapshots.html
def describe_cluster_snapshots(options = {})
cluster_identifier = options[:cluster_identifier]
snapshot_identifier = options[:snapshot_identifier]
start_time = options[:start_time]
end_time = options[:end_time]
owner_account = options[:owner_account]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeClusterSnapshots.new
}
params[:query]['Action'] = 'DescribeClusterSnapshots'
params[:query]['ClusterIdentifier'] = cluster_identifier if cluster_identifier
params[:query]['SnapshotIdentifier'] = snapshot_identifier if snapshot_identifier
params[:query]['start_time'] = start_time if start_time
params[:query]['end_time'] = end_time if end_time
params[:query]['OwnerAccount'] = owner_account if owner_account
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,47 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_cluster_subnet_groups'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_subnet_group_name - (String)
# The name of the cluster subnet group for which information is requested.
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeClusterSubnetGroups.html
def describe_cluster_subnet_groups(cluster_subnet_group_name=nil, marker=nil,max_records=nil)
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeClusterSubnetGroups.new
}
params[:query]['Action'] = 'DescribeClusterSubnetGroups'
params[:query]['ClusterSubnetGroupName'] = cluster_subnet_group_name if cluster_subnet_group_name
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,54 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_cluster_versions'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_parameter_group_family - (String)
# The name of a specific cluster parameter group family to return details for.
# Constraints: Must be 1 to 255 alphanumeric characters. First character must be
# a letter, and cannot end with a hyphen or contain two consecutive hyphens.
# * :cluster_version - (String)
# The specific cluster version to return. Example: 1.0
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeClusterVersions.html
def describe_cluster_versions(options = {})
cluster_version = options[:cluster_version]
cluster_parameter_group_family = options[:cluster_parameter_group_family]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeClusterVersions.new
}
params[:query]['Action'] = 'DescribeClusterVersions'
params[:query]['ClusterVersion'] = cluster_version if cluster_version
params[:query]['ClusterParameterGroupFamily'] = cluster_parameter_group_family if cluster_parameter_group_family
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,49 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_clusters'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_identifier - (String)
# The unique identifier of a cluster whose properties you are requesting.
# This parameter isn't case sensitive. The default is that all clusters
# defined for an account are returned.
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeClusters.html
def describe_clusters(options = {})
cluster_identifier = options[:cluster_identifier]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeClusters.new
}
params[:query]['Action'] = 'DescribeClusters'
params[:query]['ClusterIdentifier'] = cluster_identifier if cluster_identifier
params[:query]['MaxRecords'] = max_records if max_records
params[:query]['Marker'] = marker if marker
request(params)
end
end
end
end
end

View file

@ -0,0 +1,49 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_default_cluster_parameters'
# ==== Parameters
#
# @param [Hash] options
# * :parameter_group_family - required - (String)
# The name of a cluster parameter group family for which to return details.
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeDefaultClusterParameters.html
def describe_default_cluster_parameters(options = {})
parameter_group_family = options[:parameter_group_family]
source = options[:source]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeDefaultClusterParameters.new
}
params[:query]['Action'] = 'DescribeDefaultClusterParameters'
params[:query]['ParameterGroupFamily'] = parameter_group_family if parameter_group_family
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,80 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_events'
# ==== Parameters
#
# @param [Hash] options
# * :source_identifier - (String)
# The identifier of the event source for which events will be returned. If this
# parameter is not specified, then all sources are included in the response.
# Constraints: If SourceIdentifier is supplied, SourceType must also be provided.
# Specify a cluster identifier when SourceType is cluster. Specify a cluster security
# group name when SourceType is cluster-security-group. Specify a cluster parameter
# group name when SourceType is cluster-parameter-group. Specify a cluster snapshot
# identifier when SourceType is cluster-snapshot.
# * :source_type - (String)
# The event source to retrieve events for. If no value is specified, all events are
# returned. Constraints: If SourceType is supplied, SourceIdentifier must also be
# provided. Specify cluster when SourceIdentifier is a cluster identifier. Specify
# cluster-security-group when SourceIdentifier is a cluster security group name. Specify
# cluster-parameter-group when SourceIdentifier is a cluster parameter group name. Specify
# cluster-snapshot when SourceIdentifier is a cluster snapshot identifier. Valid values
# include: cluster, cluster-parameter-group, cluster-security-group, cluster-snapshot
# * :start_time - (String<)
# The beginning of the time interval to retrieve events for, specified in ISO 8601
# format. Example: 2009-07-08T18:00Z
# * :end_time - (String<)
# The end of the time interval for which to retrieve events, specified in ISO 8601
# format. Example: 2009-07-08T18:00Z
# * :duration - (Integer)
# The number of minutes prior to the time of the request for which to retrieve events.
# For example, if the request is sent at 18:00 and you specify a duration of 60, then
# only events which have occurred after 17:00 will be returned. Default: 60
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeEvents.html
def describe_events(options = {})
source_identifier = options[:source_identifier]
source_type = options[:source_type]
start_time = options[:start_time]
end_time = options[:end_time]
duration = options[:duration]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeEvents.new
}
params[:query]['Action'] = 'DescribeEvents'
params[:query]['SourceIdentifier'] = source_identifier if source_identifier
params[:query]['SourceType'] = source_type if source_type
params[:query]['StartTime'] = start_time if start_time
params[:query]['EndTime'] = end_time if end_time
params[:query]['Duration'] = duration if duration
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,55 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_orderable_cluster_options'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_version - (String)
# The version filter value. Specify this parameter to show only the available
# offerings matching the specified version. Default: All versions. Constraints:
# Must be one of the version returned from DescribeClusterVersions.
# * :node_type - (String)
# The node type filter value. Specify this parameter to show only the available
# offerings matching the specified node type.
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeOrderableClusterOptions.html
def describe_orderable_cluster_options(options = {})
cluster_version = options[:cluster_version]
node_type = options[:node_type]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeOrderableClusterOptions.new
}
params[:query]['Action'] = 'DescribeOrderableClusterOptions'
params[:query]['ClusterVersion'] = cluster_version if cluster_version
params[:query]['NodeType'] = node_type if node_type
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,48 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_reserved_node_offerings'
# ==== Parameters
#
# @param [Hash] options
# * :reserved_node_offering_id - (String)
# The unique identifier for the offering.
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeReservedNodeOfferings.html
def describe_reserved_node_offerings(options = {})
reserved_node_offering_id = options[:reserved_node_offering_id]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeReservedNodeOfferings.new
}
params[:query]['Action'] = 'DescribeReservedNodeOfferings'
params[:query]['ReservedNodeOfferingId'] = reserved_node_offering_id if reserved_node_offering_id
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,48 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_reserved_nodes'
# ==== Parameters
#
# @param [Hash] options
# * :reserved_node_id - (String)
# The unique identifier for the node reservation.
# * :max_records - (Integer)
# The maximum number of records to include in the response. If more than the
# MaxRecords value is available, a marker is included in the response so that the
# following results can be retrieved. Constrained between [20,100]. Default is 100.
# * :marker - (String)
# The marker returned from a previous request. If this parameter is specified, the
# response includes records beyond the marker only, up to MaxRecords.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeReservedNodes.html
def describe_reserved_nodes(options = {})
reserved_node_id = options[:reserved_node_id]
marker = options[:marker]
max_records = options[:max_records]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeReservedNodes.new
}
params[:query]['Action'] = 'DescribeReservedNodes'
params[:query]['ReservedNodeId'] = reserved_node_id if reserved_node_id
params[:query]['Marker'] = marker if marker
params[:query]['MaxRecords'] = max_records if max_records
request(params)
end
end
end
end
end

View file

@ -0,0 +1,39 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/describe_resize'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_identifier - required - (String)
# The unique identifier of a cluster whose resize progress you are requesting.
# This parameter isn't case-sensitive. By default, resize operations for all
# clusters defined for an AWS account are returned.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DescribeResize.html
def describe_resize(options = {})
cluster_identifier = options[:cluster_identifier]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :get,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::DescribeResize.new
}
params[:query]['Action'] = 'DescribeResize'
params[:query]['ClusterIdentifier'] = cluster_identifier if cluster_identifier
request(params)
end
end
end
end
end

View file

@ -0,0 +1,111 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_identifier - required - (String)
# A unique identifier for the cluster. You use this identifier to refer to the cluster
# for any subsequent cluster operations such as deleting or modifying. Must be unique
# for all clusters within an AWS account. Example: myexamplecluster
# * :allow_version_upgrade - (Boolean)
# If `true` , upgrades can be applied during the maintenance window to the Amazon
# Redshift engine that is running on the cluster. Default: `true`
# * :automated_snapshot_retention_period - (Integer)
# Number of days that automated snapshots are retained. If the value is 0, automated
# snapshots are disabled. Default: 1 Constraints: Must be a value from 0 to 35.
# * :cluster_parameter_group_name - (String)
# The name of the parameter group to be associated with this cluster. Default: The
# default Amazon Redshift cluster parameter group. Constraints: Must be 1 to 255
# alphanumeric characters or hyphens. First character must be a letter. Cannot end
# with a hyphen or contain two consecutive hyphens.
# * :cluster_security_groups - (Array<String>)
# A list of security groups to be associated with this cluster. Default: The default
# cluster security group for Amazon Redshift.
# * :cluster_type - (String)
# Type of the cluster. When cluster type is specified as single-node, the NumberOfNodes
# parameter is not required. multi-node, the NumberOfNodes parameter is required. Valid
# Values: multi-node | single-node Default: multi-node
# * :cluster_version - (String)
# The version of the Amazon Redshift engine software that you want to deploy on the
# cluster. The version selected runs on all the nodes in the cluster. Constraints:
# Only version 1.0 is currently available. Example: 1.0
# * :master_user_password - required - (String)
# The password associated with the master user account for the cluster that is being
# created. Constraints: Must be between 8 and 64 characters in length. Must contain at
# least one uppercase letter. Must contain at least one lowercase letter. Must contain
# one number.
# * :node_type - required - (String)
# The node type to be provisioned. Valid Values: dw.hs1.xlarge | dw.hs1.8xlarge.
# * :number_of_nodes - (Integer)
# The number of compute nodes in the cluster. This parameter is required when the
# ClusterType parameter is specified as multi-node. If you don't specify this parameter,
# you get a single-node cluster. When requesting a multi-node cluster, you must specify
# the number of nodes that you want in the cluster. Default: 1 Constraints: Value must
# be at least 1 and no more than 100.
# * :preferred_maintenance_window - (String)
# The weekly time range (in UTC) during which automated cluster maintenance can occur.
# Format: ddd:hh24:mi-ddd:hh24:mi Default: A 30-minute window selected at random from
# an 8-hour block of time per region, occurring on a random day of the week.
# Constraints: Minimum 30-minute window.
# * :vpc_security_group_ids - (Array<String>)
# A list of Virtual Private Cloud (VPC) security groups to be associated with the
# cluster. Default: The default VPC security group is associated with the cluster.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_CreateCluster.html
def modify_cluster(options = {})
cluster_identifier = options[:cluster_identifier]
cluster_type = options[:cluster_type]
node_type = options[:node_type]
master_user_password = options[:master_user_password]
preferred_maintenance_window = options[:preferred_maintenance_window]
cluster_parameter_group_name = options[:cluster_parameter_group_name]
automated_snapshot_retention_period = options[:automated_snapshot_retention_period]
cluster_version = options[:cluster_version]
allow_version_upgrade = options[:allow_version_upgrade]
number_of_nodes = options[:number_of_nodes]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::Cluster.new
}
if cluster_security_groups = options.delete(:ClusterSecurityGroups)
params[:query].merge!(Fog::AWS.indexed_param('ClusterSecurityGroups.member.%d', [*cluster_security_groups]))
end
if vpc_security_group_ids = options.delete(:VpcSecurityGroupIds)
params[:query].merge!(Fog::AWS.indexed_param('VpcSecurityGroupIds.member.%d', [*vpc_security_group_ids]))
end
params[:query]['Action'] = 'ModifyCluster'
params[:query]['ClusterIdentifier'] = cluster_identifier if cluster_identifier
params[:query]['ClusterParameterGroupName'] = cluster_parameter_group_name if cluster_parameter_group_name
params[:query]['ClusterType'] = cluster_type if cluster_type
params[:query]['NodeType'] = node_type if node_type
params[:query]['MasterUserPassword'] = master_user_password if master_user_password
params[:query]['PreferredMaintenanceWindow'] = preferred_maintenance_window if preferred_maintenance_window
params[:query]['AutomatedSnapshotRetentionPeriod'] = automated_snapshot_retention_period if automated_snapshot_retention_period
params[:query]['ClusterVersion'] = cluster_version if cluster_version
params[:query]['AllowVersionUpgrade'] = allow_version_upgrade if allow_version_upgrade
params[:query]['NumberOfNodes'] = number_of_nodes if number_of_nodes
params[:query]['ClusterSecurityGroups'] = cluster_security_groups if cluster_security_groups
params[:query]['VpcSecurityGroupIds'] = vpc_security_group_ids if vpc_security_group_ids
request(params)
end
end
end
end
end

View file

@ -0,0 +1,44 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/update_cluster_parameter_group_parser'
# ==== Parameters
#
# @param [Hash] options
# * :parameter_group_name - required - (String)
# The name of the parameter group to be deleted. Constraints: Must be the name of an
# existing cluster parameter group. Cannot delete a default cluster parameter group.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_ModifyClusterParameterGroup.html
def modify_cluster_parameter_group(options = {})
parameter_group_name = options[:parameter_group_name]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::UpdateClusterParameterGroupParser.new
}
params[:query]['Action'] = 'ModifyClusterParameterGroup'
params[:query]['ParameterGroupName'] = parameter_group_name if parameter_group_name
if options['Parameters']
options['Parameters'].keys.each_with_index do |name, index|
params[:query].merge!({
"Parameters.member.#{index+1}.#{name}" => options['Parameters'][name]
})
end
end
request(params)
end
end
end
end
end

View file

@ -0,0 +1,50 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster_subnet_group_parser'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_subnet_group_name - required - (String)
# The name for the subnet group. Amazon Redshift stores the value as a lowercase string.
# Constraints: Must contain no more than 255 alphanumeric characters or hyphens. Must not
# be "Default". Must be unique for all subnet groups that are created by your AWS account.
# Example: examplesubnetgroup
# * :description - required - (String)
# A description of the parameter group.
# * :subnet_ids - required - (Array<)
# An array of VPC subnet IDs. A maximum of 20 subnets can be modified in a single request.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_ModifyClusterSubnetGroup.html
def modify_cluster_subnet_group(options = {})
cluster_subnet_group_name = options[:cluster_subnet_group_name]
description = options[:description]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::ClusterSubnetGroupParser.new
}
if subnet_ids = options.delete(:subnet_ids)
params[:query].merge!(Fog::AWS.indexed_param('SubnetIds.member.%d', [*subnet_ids]))
end
params[:query]['Action'] = 'ModifyClusterSubnetGroup'
params[:query]['ClusterSubnetGroupName'] = cluster_subnet_group_name if cluster_subnet_group_name
params[:query]['Description'] = description if description
request(params)
end
end
end
end
end

View file

@ -0,0 +1,41 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/purchase_reserved_node_offering'
# ==== Parameters
#
# @param [Hash] options
# * :reserved_node_offering_id - required - (String)
# The unique identifier of the reserved node offering you want to purchase.
# * :node_count - (Integer)
# The number of reserved nodes you want to purchase. Default: 1
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_PurchaseReservedNodeOffering.html
def purchase_reserved_node_offering(options = {})
reserved_node_offering_id = options[:reserved_node_offering_id]
node_count = options[:node_count]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::PurchaseReservedNodeOffering.new
}
params[:query]['Action'] = 'PurchaseReservedNodeOffering'
params[:query]['ReservedNodeOfferingId'] = reserved_node_offering_id if reserved_node_offering_id
params[:query]['NodeCount'] = node_count if node_count
request(params)
end
end
end
end
end

View file

@ -0,0 +1,37 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_identifier - required - (String)
# A unique identifier for the cluster. You use this identifier to refer to the cluster
# for any subsequent cluster operations such as deleting or modifying. Must be unique
# for all clusters within an AWS account. Example: myexamplecluster
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_DeleteCluster.html
def reboot_cluster(options = {})
cluster_identifier = options[:cluster_identifier]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::Cluster.new
}
params[:query]['Action'] = 'RebootCluster'
params[:query]['ClusterIdentifier'] = cluster_identifier if cluster_identifier
request(params)
end
end
end
end
end

View file

@ -0,0 +1,57 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/update_cluster_parameter_group_parser'
# ==== Parameters
#
# @param [Hash] options
# * :parameter_group_name - required - (String) The name of the cluster parameter group to be reset.
# * :reset_all_parameters - (Boolean) If true , all parameters in the specified parameter group will be reset to their default values. Default: true
# * :parameters - (Array<) An array of names of parameters to be reset. If ResetAllParameters option is not used, then at least one parameter name must be supplied. Constraints: A maximum of 20 parameters can be reset in a single request.
# * :parameter_name - (String) The name of the parameter.
# * :parameter_value - (String) The value of the parameter.
# * :description - (String) A description of the parameter.
# * :source - (String) The source of the parameter value, such as "engine-default" or "user".
# * :data_type - (String) The data type of the parameter.
# * :allowed_values - (String) The valid range of values for the parameter.
# * :is_modifiable - (Boolean) If true , the parameter can be modified. Some parameters have security or operational implications that prevent them from being changed.
# * :minimum_engine_version - (String) The earliest engine version to which the parameter can apply.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_ResetClusterParameterGroup.html
def reset_cluster_parameter_group(options = {})
parameter_group_name = options[:parameter_group_name]
reset_all_parameters = options[:reset_all_parameters]
path = "/"
params = {
:idempotent => true,
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::UpdateClusterParameterGroupParser.new
}
if options['Parameters']
options['Parameters'].keys.each_with_index do |name, index|
params[:query].merge!({
"Parameters.member.#{index+1}.#{name}" => options['Parameters'][name]
})
end
end
params[:query]['Action'] = 'ResetClusterSubnetGroup'
params[:query]['ParameterGroupName'] = parameter_group_name if parameter_group_name
params[:query]['ResetAllParameters'] = reset_all_parameters if reset_all_parameters
request(params)
end
end
end
end
end

View file

@ -0,0 +1,77 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_identifier - required - (String)
# The identifier of the cluster that will be created from restoring the snapshot.
# Constraints: Must contain from 1 to 63 alphanumeric characters or hyphens.
# Alphabetic characters must be lowercase. First character must be a letter. Cannot
# end with a hyphen or contain two consecutive hyphens. Must be unique for all
# clusters within an AWS account.
# * :snapshot_identifier - required - (String)
# The name of the snapshot from which to create the new cluster. This parameter
# isn't case sensitive. Example: my-snapshot-id
# * :snapshot_cluster_identifier - (String)
# * :port - (Integer)
# The port number on which the cluster accepts connections. Default: The same port
# as the original cluster. Constraints: Must be between 1115 and 65535.
# * :availability_zone - (String)
# The Amazon EC2 Availability Zone in which to restore the cluster. Default: A
# random, system-chosen Availability Zone. Example: us-east-1a
# * :allow_version_upgrade - (Boolean)
# If true , upgrades can be applied during the maintenance window to the Amazon
# Redshift engine that is running on the cluster. Default: true
# * :cluster_subnet_group_name - (String)
# The name of the subnet group where you want to cluster restored. A snapshot of
# cluster in VPC can be restored only in VPC. Therefore, you must provide subnet
# group name where you want the cluster restored.
# * :publicly_accessible - (Boolean)
# If true , the cluster can be accessed from a public network.
# * :owner_account - (String)
# The AWS customer account used to create or copy the snapshot. Required if you are
# restoring a snapshot you do not own, optional if you own the snapshot.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_RestoreFromClusterSnapshot.html
def restore_from_cluster_snapshot(options = {})
cluster_identifier = options[:cluster_identifier]
snapshot_identifier = options[:snapshot_identifier]
snapshot_cluster_identifier = options[:snapshot_cluster_identifier]
port = options[:port]
availability_zone = options[:availability_zone]
allow_version_upgrade = options[:allow_version_upgrade]
cluster_subnet_group_name = options[:cluster_subnet_group_name]
publicly_accessible = options[:publicly_accessible]
owner_account = options[:owner_account]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::Cluster.new
}
params[:query]['Action'] = 'RestoreFromClusterSnapshot'
params[:query]['ClusterIdentifier'] = cluster_identifier if cluster_identifier
params[:query]['SnapshotIdentifier'] = snapshot_identifier if snapshot_identifier
params[:query]['SnapshotClusterIdentifier'] = snapshot_cluster_identifier if snapshot_cluster_identifier
params[:query]['Port'] = port if port
params[:query]['AvailabilityZone'] = availability_zone if availability_zone
params[:query]['AllowVersionUpgrade'] = allow_version_upgrade if allow_version_upgrade
params[:query]['ClusterSubnetGroupName'] = cluster_subnet_group_name if cluster_subnet_group_name
params[:query]['PubliclyAccessible'] = publicly_accessible if publicly_accessible
params[:query]['OwnerAccount'] = owner_account if owner_account
request(params)
end
end
end
end
end

View file

@ -0,0 +1,56 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/revoke_cluster_security_group_ingress'
# ==== Parameters
#
# @param [Hash] options
# * :cluster_security_group_name - required - (String)
# The name of the security Group from which to revoke the ingress rule.
# * :cidrip - (String)
# The IP range for which to revoke access. This range must be a valid Classless
# Inter-Domain Routing (CIDR) block of IP addresses. If CIDRIP is specified,
# EC2SecurityGroupName and EC2SecurityGroupOwnerId cannot be provided.
# * :ec2_security_group_name - (String)
# The name of the EC2 Security Group whose access is to be revoked. If
# EC2SecurityGroupName is specified, EC2SecurityGroupOwnerId must also be
# provided and CIDRIP cannot be provided.
# * :ec2_security_group_owner_id - (String)
# The AWS account number of the owner of the security group specified in the
# EC2SecurityGroupName parameter. The AWS access key ID is not an acceptable
# value. If EC2SecurityGroupOwnerId is specified, EC2SecurityGroupName must
# also be provided. and CIDRIP cannot be provided. Example: 111122223333
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_RevokeClusterSecurityGroupIngress.html
def revoke_cluster_security_group_ingress(options = {})
cluster_security_group_name = options[:cluster_security_group_name]
cidrip = options[:cidrip]
ec2_security_group_name = options[:ec2_security_group_name]
ec2_security_group_owner_id = options[:ec2_security_group_owner_id]
path = "/"
params = {
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::RevokeClusterSecurityGroupIngress.new
}
params[:query]['Action'] = 'RevokeClusterSecurityGroupIngress'
params[:query]['ClusterSecurityGroupName'] = cluster_security_group_name if cluster_security_group_name
params[:query]['CIDRIP'] = cidrip if cidrip
params[:query]['EC2SecurityGroupName'] = ec2_security_group_name if ec2_security_group_name
params[:query]['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id if ec2_security_group_owner_id
request(params)
end
end
end
end
end

View file

@ -0,0 +1,44 @@
module Fog
module AWS
class Redshift
class Real
require 'fog/aws/parsers/redshift/cluster_snapshot'
# ==== Parameters
#
# @param [Hash] options
# * :snapshot_identifier - required - (String)
# The identifier of the snapshot that the account can no longer access.
# * :snapshot_cluster_identifier - (String)
# * :account_with_restore_access - required - (String)
# The identifier of the AWS customer account that can no longer restore the specified snapshot.
#
# ==== See Also
# http://docs.aws.amazon.com/redshift/latest/APIReference/API_RevokeSnapshotAccess.html
def revoke_snapshot_access(options = {})
snapshot_identifier = options[:snapshot_identifier]
snapshot_cluster_identifier = options[:snapshot_cluster_identifier]
account_with_restore_access = options[:account_with_restore_access]
path = "/"
params = {
:expects => 200,
:headers => {},
:path => path,
:method => :put,
:query => {},
:parser => Fog::Parsers::Redshift::AWS::ClusterSnapshot.new
}
params[:query]['Action'] = 'RevokeSnapshotAccess'
params[:query]['SnapshotIdentifier'] = snapshot_identifier if snapshot_identifier
params[:query]['SnapshotClusterIdentifier'] = snapshot_cluster_identifier if snapshot_cluster_identifier
params[:query]['AccountWithRestoreAccess'] = account_with_restore_access if account_with_restore_access
request(params)
end
end
end
end
end

View file

@ -31,6 +31,8 @@ class AWS < Fog::Bin
Fog::AWS::Glacier
when :iam
Fog::AWS::IAM
when :redshift
Fog::AWS::Redshift
when :sdb, :simpledb
Fog::AWS::SimpleDB
when :ses
@ -87,6 +89,8 @@ class AWS < Fog::Bin
Fog::AWS::Glacier.new
when :iam
Fog::AWS::IAM.new
when :redshift
Fog::AWS::Redshift.new
when :rds
Fog::AWS::RDS.new
when :eu_storage

View file

@ -0,0 +1,77 @@
Shindo.tests('Fog::Redshift[:aws] | cluster parameter group requests', ['aws']) do
pending if Fog.mocking?
suffix = rand(65536).to_s(16)
parameter_group = "test-cluster-parameter-group-#{suffix}"
@cluster_parameter_format = {
'Parameter' => {
"ParameterValue" => String,
"DataType" => String,
"Source" => String,
"IsModifiable" => Fog::Boolean,
"Description" => String,
"ParameterName" => String
}
}
@cluster_parameters_format = {
"Parameters"=> [@cluster_parameter_format]
}
@cluster_parameter_group_format = {
'ClusterParameterGroup' => {
"ParameterGroupFamily" => String,
"Description" => String,
"ParameterGroupName" => String
}
}
@cluster_parameter_groups_format = {
"ParameterGroups"=> [@cluster_parameter_group_format]
}
@modify_cluster_parameter_group_format = {
"ParameterGroupStatus" => String,
"ParameterGroupName" => String
}
tests('success') do
tests("create_cluster_parameter_group").formats(@cluster_parameter_group_format) do
body = Fog::AWS[:redshift].create_cluster_parameter_group(:parameter_group_name=> parameter_group,
:parameter_group_family=>"redshift-1.0",
:description=>'testing').body
body
end
tests("describe_cluster_parameter_groups").formats(@cluster_parameter_groups_format) do
body = Fog::AWS[:redshift].describe_cluster_parameter_groups.body
body
end
tests("describe_cluster_parameters").formats(@cluster_parameters_format) do
body = Fog::AWS[:redshift].describe_cluster_parameters(:parameter_group_name=>parameter_group).body
body
end
tests("modify_cluster_parameter_groups").formats(@modify_cluster_parameter_group_format) do
body = Fog::AWS[:redshift].modify_cluster_parameter_group(:parameter_group_name=>parameter_group,
:parameters=>{
:parameter_name=>'extra_float_digits',
:parameter_value=>2}).body
body
end
tests("delete_cluster_parameter_group") do
present = !Fog::AWS[:redshift].describe_cluster_parameter_groups(:parameter_group_name=>parameter_group).body['ParameterGroups'].empty?
tests("verify presence before deletion").returns(true) { present }
Fog::AWS[:redshift].delete_cluster_parameter_group(:parameter_group_name=>parameter_group)
not_present = Fog::AWS[:redshift].describe_cluster_parameter_groups(:parameter_group_name=>parameter_group).body['ParameterGroups'].empty?
tests("verify deletion").returns(true) { not_present }
end
end
end

View file

@ -0,0 +1,44 @@
Shindo.tests('Fog::Redshift[:aws] | cluster security group requests', ['aws']) do
pending if Fog.mocking?
suffix = rand(65536).to_s(16)
identifier = "test-cluster-security-group-#{suffix}"
@cluster_security_group_format = {
"ClusterSecurityGroup" => {
"EC2SecurityGroups" => Fog::Nullable::Array,
"IPRanges" => Fog::Nullable::Array,
"Description" => String,
"ClusterSecurityGroupName" => String
}
}
@describe_cluster_security_groups_format = {
"ClusterSecurityGroups" => [@cluster_security_group_format]
}
tests('success') do
tests("create_cluster_security_group").formats(@cluster_security_group_format) do
body = Fog::AWS[:redshift].create_cluster_security_group(:cluster_security_group_name => identifier, :description => 'testing').body
body
end
tests("describe_cluster_security_groups").formats(@describe_cluster_security_groups_format) do
body = Fog::AWS[:redshift].describe_cluster_security_groups.body
body
end
tests("delete_cluster_security_group") do
present = !Fog::AWS[:redshift].describe_cluster_security_groups(:cluster_security_group_name => identifier).body['ClusterSecurityGroups'].empty?
tests("verify presence before deletion").returns(true) { present }
Fog::AWS[:redshift].delete_cluster_security_group(:cluster_security_group_name => identifier)
not_present = Fog::AWS[:redshift].describe_cluster_security_groups(:cluster_security_group_name => identifier).body['ClusterSecurityGroups'].empty?
tests("verify deletion").returns(true) { not_present }
end
end
end

View file

@ -0,0 +1,75 @@
Shindo.tests('Fog::Redshift[:aws] | cluster snapshot requests', ['aws']) do
pending if Fog.mocking?
suffix = rand(65536).to_s(16)
identifier = "test-snapshot-#{suffix}"
cluster = "test-cluster-#{suffix}"
start_time = Fog::Time.now.to_iso8601_basic
@cluster_snapshot_format = {
'Snapshot' => {
"AccountsWithRestoreAccess" => Fog::Nullable::Array,
"Port" => Integer,
"SnapshotIdentifier" => String,
"OwnerAccount" => String,
"Status" => String,
"SnapshotType" => String,
"ClusterVersion" => String,
"EstimatedSecondsToCompletion" => Integer,
"SnapshotCreateTime" => Time,
"Encrypted" => Fog::Boolean,
"NumberOfNodes" => Integer,
"DBName" => String,
"CurrentBackupRateInMegaBytesPerSecond" => Float,
"ClusterCreateTime" => Time,
"AvailabilityZone" => String,
"ActualIncrementalBackupSizeInMegaBytes" => Float,
"TotalBackupSizeInMegaBytes" => Float,
"ElapsedTimeInSeconds" => Integer,
"BackupProgressInMegaBytes" => Float,
"NodeType" => String,
"ClusterIdentifier" => String,
"MasterUsername" => String
}
}
@describe_cluster_snapshots_format = {
"Snapshots" => [@cluster_snapshot_format]
}
tests('success') do
tests("create_cluster_snapshot").formats(@cluster_snapshot_format) do
Fog::AWS[:redshift].create_cluster(:cluster_identifier => cluster,
:master_user_password => 'Pass1234',
:master_username => 'testuser',
:node_type => 'dw.hs1.xlarge',
:cluster_type => 'single-node')
Fog.wait_for do
"available" == Fog::AWS[:redshift].describe_clusters(:cluster_identifier=>cluster).body['ClusterSet'].first['Cluster']['ClusterStatus']
end
body = Fog::AWS[:redshift].create_cluster_snapshot(:snapshot_identifier => identifier,
:cluster_identifier => cluster).body
body
end
tests('describe_cluster_snaphots').formats(@describe_cluster_snapshots_format) do
sleep 30 unless Fog.mocking?
body = Fog::AWS[:redshift].describe_cluster_snapshots(:start_time=>start_time).body
body
end
tests('delete_cluster_snapshot').formats(@cluster_snapshot_format) do
Fog.wait_for do
"available" == Fog::AWS[:redshift].describe_cluster_snapshots(:snapshot_identifier=>identifier).body['Snapshots'].first['Snapshot']['Status']
end
sleep 30 unless Fog.mocking?
body = Fog::AWS[:redshift].delete_cluster_snapshot(:snapshot_identifier=>identifier).body
body
end
Fog::AWS[:redshift].delete_cluster(:cluster_identifier => cluster,
:skip_final_cluster_snapshot => true)
end
end

View file

@ -0,0 +1,82 @@
Shindo.tests('Fog::Redshift[:aws] | cluster requests', ['aws']) do
pending if Fog.mocking?
identifier = "test-cluster-#{rand(65536).to_s(16)}"
@cluster_format = {
'Cluster' => {
"ClusterParameterGroups" => [{
"ClusterParameterGroup" => {
"ParameterApplyStatus" => String,
"ParameterGroupName" => String
}
}],
"ClusterSecurityGroups" => [{
'ClusterSecurityGroup' => {
"Status" => String,
"ClusterSecurityGroupName" => String
}
}],
"VpcSecurityGroups" => Fog::Nullable::Array,
"EndPoint" => Fog::Nullable::Hash,
"PendingModifiedValues" => Fog::Nullable::Hash,
"RestoreStatus" => Fog::Nullable::Hash,
"ClusterVersion" => String,
"ClusterStatus" => String,
"Encrypted" => Fog::Boolean,
"NumberOfNodes" => Integer,
"PubliclyAccessible" => Fog::Boolean,
"AutomatedSnapshotRetentionPeriod" => Integer,
"DBName" => String,
"PreferredMaintenanceWindow" => String,
"NodeType" => String,
"ClusterIdentifier" => String,
"AllowVersionUpgrade" => Fog::Boolean,
"MasterUsername" => String
}
}
@describe_clusters_format = {
"ClusterSet" => [{
'Cluster' => @cluster_format['Cluster'].merge({"ClusterCreateTime"=>Time, "AvailabilityZone"=>String, "EndPoint"=>{"Port"=>Integer, "Address"=>String}})
}]
}
tests('success') do
tests('create_cluster').formats(@cluster_format) do
body = Fog::AWS[:redshift].create_cluster(:cluster_identifier => identifier,
:master_user_password => 'Password1234',
:master_username => 'testuser',
:node_type => 'dw.hs1.xlarge',
:cluster_type => 'single-node').body
Fog.wait_for do
"available" == Fog::AWS[:redshift].describe_clusters(:cluster_identifier=>identifier).body['ClusterSet'].first['Cluster']['ClusterStatus']
end
body
end
tests('describe_clusters').formats(@describe_clusters_format["ClusterSet"]) do
sleep 30 unless Fog.mocking?
body = Fog::AWS[:redshift].describe_clusters(:cluster_identifier=>identifier).body["ClusterSet"]
body
end
tests('reboot_cluster') do
sleep 30 unless Fog.mocking?
body = Fog::AWS[:redshift].reboot_cluster(:cluster_identifier=>identifier).body
tests("verify reboot").returns("rebooting") { body['Cluster']['ClusterStatus']}
body
end
tests('delete_cluster') do
Fog.wait_for do
"available" == Fog::AWS[:redshift].describe_clusters(:cluster_identifier=>identifier).body['ClusterSet'].first['Cluster']['ClusterStatus']
end
sleep 30 unless Fog.mocking?
body = Fog::AWS[:redshift].delete_cluster(:cluster_identifier=>identifier, :skip_final_cluster_snapshot=>true).body
tests("verify delete").returns("deleting") { body['Cluster']['ClusterStatus']}
body
end
end
end