Class: Serverspec::Type::AWS::Redshift::Cluster

Inherits:
Base
  • Object
show all
Defined in:
lib/resources/redshift/cluster.rb

Overview

The Cluster class exposes the Redshift::Cluster resources

Instance Method Summary collapse

Constructor Details

#initialize(cluster_id, instance = nil) ⇒ Cluster

AWS SDK for Ruby v2 Aws::RDS::Client wrapper for initializing a Cluster resource

Parameters:

  • cluster_id (String)

    The ID of the Cluster

  • instance (Class) (defaults to: nil)

    Aws::Redshift::Client instance

Raises:

  • (RuntimeError)

    if clusters.nil?

  • (RuntimeError)

    if clusters.length == 0

  • (RuntimeError)

    if clusters.length > 1



15
16
17
18
19
20
# File 'lib/resources/redshift/cluster.rb', line 15

def initialize(cluster_id, instance = nil)
  check_init_arg 'cluster_id', 'Redshift::Cluster', cluster_id
  @cluster_id = cluster_id
  @aws = instance.nil? ? Aws::Redshift::Client.new : instance
  get_cluster cluster_id
end

Instance Method Details

#automated_snapshot_retention_periodInteger

The number of days that automatic cluster snapshots are retained

Returns:

  • (Integer)


91
92
93
# File 'lib/resources/redshift/cluster.rb', line 91

def automated_snapshot_retention_period
  @cluster.automated_snapshot_retention_period
end

#availability_zoneString

The name of the Availability Zone in which the cluster is located

Returns:

  • (String)


141
142
143
# File 'lib/resources/redshift/cluster.rb', line 141

def availability_zone
  @cluster.availability_zone
end

#available?Boolean

Indicates whether cluster_status is available

Returns:

  • (Boolean)


29
30
31
# File 'lib/resources/redshift/cluster.rb', line 29

def available?
  @cluster.cluster_status == 'available'
end

#database_nameString

The name of the initial database that was created when the cluster was created. This same name is returned for the life of the cluster. If an initial database was not specified, a database named “dev” was created by default

Returns:

  • (String)


73
74
75
# File 'lib/resources/redshift/cluster.rb', line 73

def database_name
  @cluster.db_name
end

#elastic_ip_statusHash

Describes the status of the elastic IP address

Returns:

  • (Hash)


207
208
209
# File 'lib/resources/redshift/cluster.rb', line 207

def elastic_ip_status
  @cluster.elastic_ip_status
end

#encrypted?Boolean

If true, data in the cluster is encrypted at rest

Returns:

  • (Boolean)


45
46
47
# File 'lib/resources/redshift/cluster.rb', line 45

def encrypted?
  @cluster.encrypted
end

#endpointString

The connection endpoint DNS address of the Cluster

Returns:

  • (String)


79
80
81
# File 'lib/resources/redshift/cluster.rb', line 79

def endpoint
  @cluster.endpoint.address
end

#hsm_statusHash

Reports whether the Amazon Redshift cluster has finished applying any HSM settings changes specified in a modify cluster command

Returns:

  • (Hash)


182
183
184
# File 'lib/resources/redshift/cluster.rb', line 182

def hsm_status
  @cluster.hsm_status
end

#kms_key_idString

The AWS Key Management Service key ID of the encryption key used to encrypt data in the cluster

Returns:

  • (String)


226
227
228
# File 'lib/resources/redshift/cluster.rb', line 226

def kms_key_id
  @cluster.kms_key_id
end

#listening_portInteger

The port that the database engine is listening on

Returns:

  • (Integer)


85
86
87
# File 'lib/resources/redshift/cluster.rb', line 85

def listening_port
  @cluster.endpoint.port
end

#master_usernameString

The master user name for the cluster. This name is used to connect to the database that is specified in DBName

Returns:

  • (String)


64
65
66
# File 'lib/resources/redshift/cluster.rb', line 64

def master_username
  @cluster.master_username
end

#modify_statusString

The status of a modify operation, if any, initiated for the cluster

Returns:

  • (String)


57
58
59
# File 'lib/resources/redshift/cluster.rb', line 57

def modify_status
  @cluster.modify_status
end

#node_typeString

The node type for the nodes in the cluster

Returns:

  • (String)


51
52
53
# File 'lib/resources/redshift/cluster.rb', line 51

def node_type
  @cluster.node_type
end

#nodesArray(Hash)

The nodes in a cluster

Returns:

  • (Array(Hash))


201
202
203
# File 'lib/resources/redshift/cluster.rb', line 201

def nodes
  @cluster.cluster_nodes
end

#number_of_nodesInteger

The number of compute nodes in the cluster

Returns:

  • (Integer)


168
169
170
# File 'lib/resources/redshift/cluster.rb', line 168

def number_of_nodes
  @cluster.number_of_nodes
end

#parameter_groupsArray(String)

The list of cluster parameter groups

Returns:

  • (Array(String))


117
118
119
120
121
122
123
# File 'lib/resources/redshift/cluster.rb', line 117

def parameter_groups
  cpgs = []
  @cluster.cluster_parameter_groups.each do |cpg|
    cpgs << cpg.parameter_group_name
  end
  cpgs
end

#pending_modified_valuesHash

If present, changes to the cluster are pending. Specific pending changes are identified by subelements

Returns:

  • (Hash)


155
156
157
# File 'lib/resources/redshift/cluster.rb', line 155

def pending_modified_values
  @cluster.pending_modified_values
end

#preferred_maintenance_windowString

The weekly time range (in UTC) during which system maintenance can occur

Returns:

  • (String)


148
149
150
# File 'lib/resources/redshift/cluster.rb', line 148

def preferred_maintenance_window
  @cluster.preferred_maintenance_window
end

#public_keyString

The public key for the cluster

Returns:

  • (String)


195
196
197
# File 'lib/resources/redshift/cluster.rb', line 195

def public_key
  @cluster.cluster_public_key
end

#publicly_accessible?Boolean

If true, the cluster can be accessed from a public network

Returns:

  • (Boolean)


40
41
42
# File 'lib/resources/redshift/cluster.rb', line 40

def publicly_accessible?
  @cluster.publicly_accessible
end

#restore_statusHash

Describes the status of a cluster restore action. Returns null if the cluster was not created by restoring a snapshot

Returns:

  • (Hash)


175
176
177
# File 'lib/resources/redshift/cluster.rb', line 175

def restore_status
  @cluster.restore_status
end

#revision_numberString

The specific revision number of the database in the cluster

Returns:

  • (String)


213
214
215
# File 'lib/resources/redshift/cluster.rb', line 213

def revision_number
  @cluster.cluster_revision_number
end

#security_groupsArray(String)

A list of active cluster security groups

Returns:

  • (Array(String))


97
98
99
100
101
102
103
# File 'lib/resources/redshift/cluster.rb', line 97

def security_groups
  sgs = []
  @cluster.cluster_security_groups.each do |sg|
    sgs << sg.cluster_security_group_name if sg.status == 'active'
  end
  sgs
end

#snapshot_copy_statusHash

Returns the destination region and retention period that are configured for cross-region snapshot copy

Returns:

  • (Hash)


189
190
191
# File 'lib/resources/redshift/cluster.rb', line 189

def snapshot_copy_status
  @cluster.cluster_snapshot_copy_status
end

#subnet_groupString

The name of the subnet group that is associated with the cluster. This parameter is valid only when the cluster is in a VPC

Returns:

  • (String)


128
129
130
# File 'lib/resources/redshift/cluster.rb', line 128

def subnet_group
  @cluster.cluster_subnet_group_name
end

#tagsArray(Hash)

The list of tags for the cluster

Returns:

  • (Array(Hash))


219
220
221
# File 'lib/resources/redshift/cluster.rb', line 219

def tags
  @cluster.tags
end

#to_sString

Returns the string representation of Redshift::Cluster

Returns:

  • (String)


24
25
26
# File 'lib/resources/redshift/cluster.rb', line 24

def to_s
  "Redshift Cluster: #{@cluster_id}"
end

#versionString

The version ID of the Amazon Redshift engine that is running on the cluster

Returns:

  • (String)


162
163
164
# File 'lib/resources/redshift/cluster.rb', line 162

def version
  @cluster.cluster_version
end

#version_upgradeable?Boolean

If true, major version upgrades will be applied automatically to the cluster during the maintenance window

Returns:

  • (Boolean)


35
36
37
# File 'lib/resources/redshift/cluster.rb', line 35

def version_upgradeable?
  @cluster.allow_version_upgrade
end

#vpc_idString

The identifier of the VPC the cluster is in, if the cluster is in a VPC

Returns:

  • (String)


135
136
137
# File 'lib/resources/redshift/cluster.rb', line 135

def vpc_id
  @cluster.vpc_id
end

#vpc_security_groupsArray(String)

A list of active VPC security groups

Returns:

  • (Array(String))


107
108
109
110
111
112
113
# File 'lib/resources/redshift/cluster.rb', line 107

def vpc_security_groups
  vsgs = []
  @cluster.vpc_security_groups.each do |vsg|
    vsgs << vsg.vpc_security_group_id if vsg.status == 'active'
  end
  vsgs
end