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

Adding the remaining describe requests

This commit is contained in:
Efe Yardimci 2013-08-30 04:17:19 -04:00
parent 7b18fef0f0
commit f2269ad3c3
13 changed files with 667 additions and 6 deletions

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'] << @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'] << @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'] << @availability_zone
@availability_zone = {}
when 'OrderableClusterOption'
@response['OrderableClusterOptions'] << @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'] << @recurring_charge
@recurring_charge = {}
when 'ReservedNodeOffering'
@response['ReservedNodeOfferings'] << @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'] << @recurring_charge
@recurring_charge = {}
when 'ReservedNode'
@response['ReservedNodes'] << @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

@ -17,12 +17,12 @@ module Fog
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 :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

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