mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Modify and Delete requests added
This commit is contained in:
parent
e4febcd23e
commit
2649709ca5
10 changed files with 442 additions and 8 deletions
|
@ -0,0 +1,29 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module Redshift
|
||||
module AWS
|
||||
|
||||
class ModifyClusterParameterGroup < 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
|
|
@ -28,14 +28,14 @@ module Fog
|
|||
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 :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
|
||||
|
|
51
lib/fog/aws/requests/redshift/delete_cluster.rb
Normal file
51
lib/fog/aws/requests/redshift/delete_cluster.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class Redshift
|
||||
class Real
|
||||
require 'fog/aws/parsers/redshift/cluster_parser'
|
||||
|
||||
# ==== 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::ClusterParser.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
|
|
@ -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
|
|
@ -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
|
44
lib/fog/aws/requests/redshift/delete_cluster_snapshot.rb
Normal file
44
lib/fog/aws/requests/redshift/delete_cluster_snapshot.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class Redshift
|
||||
class Real
|
||||
require 'fog/aws/parsers/redshift/cluster_snapshot_parser'
|
||||
|
||||
# ==== 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::ClusterSnapshotParser.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
|
38
lib/fog/aws/requests/redshift/delete_cluster_subnet_group.rb
Normal file
38
lib/fog/aws/requests/redshift/delete_cluster_subnet_group.rb
Normal 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
|
111
lib/fog/aws/requests/redshift/modify_cluster.rb
Normal file
111
lib/fog/aws/requests/redshift/modify_cluster.rb
Normal file
|
@ -0,0 +1,111 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class Redshift
|
||||
class Real
|
||||
require 'fog/aws/parsers/redshift/cluster_parser'
|
||||
|
||||
# ==== 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::ClusterParser.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
|
|
@ -0,0 +1,44 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class Redshift
|
||||
class Real
|
||||
require 'fog/aws/parsers/redshift/modify_cluster_parameter_group'
|
||||
|
||||
# ==== 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::ModifyClusterParameterGroup.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
|
50
lib/fog/aws/requests/redshift/modify_cluster_subnet_group.rb
Normal file
50
lib/fog/aws/requests/redshift/modify_cluster_subnet_group.rb
Normal 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 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'] = '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
|
Loading…
Reference in a new issue