1# Copyright (c) 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved 2# 3# Permission is hereby granted, free of charge, to any person obtaining a 4# copy of this software and associated documentation files (the 5# "Software"), to deal in the Software without restriction, including 6# without limitation the rights to use, copy, modify, merge, publish, dis- 7# tribute, sublicense, and/or sell copies of the Software, and to permit 8# persons to whom the Software is furnished to do so, subject to the fol- 9# lowing conditions: 10# 11# The above copyright notice and this permission notice shall be included 12# in all copies or substantial portions of the Software. 13# 14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20# IN THE SOFTWARE. 21# 22 23import boto 24from boto.compat import json 25from boto.connection import AWSQueryConnection 26from boto.regioninfo import RegionInfo 27from boto.exception import JSONResponseError 28from boto.redshift import exceptions 29 30 31class RedshiftConnection(AWSQueryConnection): 32 """ 33 Amazon Redshift **Overview** 34 This is an interface reference for Amazon Redshift. It contains 35 documentation for one of the programming or command line 36 interfaces you can use to manage Amazon Redshift clusters. Note 37 that Amazon Redshift is asynchronous, which means that some 38 interfaces may require techniques, such as polling or asynchronous 39 callback handlers, to determine when a command has been applied. 40 In this reference, the parameter descriptions indicate whether a 41 change is applied immediately, on the next instance reboot, or 42 during the next maintenance window. For a summary of the Amazon 43 Redshift cluster management interfaces, go to `Using the Amazon 44 Redshift Management Interfaces `_. 45 46 Amazon Redshift manages all the work of setting up, operating, and 47 scaling a data warehouse: provisioning capacity, monitoring and 48 backing up the cluster, and applying patches and upgrades to the 49 Amazon Redshift engine. You can focus on using your data to 50 acquire new insights for your business and customers. 51 52 If you are a first-time user of Amazon Redshift, we recommend that 53 you begin by reading the The `Amazon Redshift Getting Started 54 Guide`_ 55 56 If you are a database developer, the `Amazon Redshift Database 57 Developer Guide`_ explains how to design, build, query, and 58 maintain the databases that make up your data warehouse. 59 """ 60 APIVersion = "2012-12-01" 61 DefaultRegionName = "us-east-1" 62 DefaultRegionEndpoint = "redshift.us-east-1.amazonaws.com" 63 ResponseError = JSONResponseError 64 65 _faults = { 66 "SnapshotCopyAlreadyDisabled": exceptions.SnapshotCopyAlreadyDisabled, 67 "ClusterNotFound": exceptions.ClusterNotFound, 68 "UnknownSnapshotCopyRegion": exceptions.UnknownSnapshotCopyRegion, 69 "InvalidClusterSubnetState": exceptions.InvalidClusterSubnetState, 70 "InvalidSubnet": exceptions.InvalidSubnet, 71 "ReservedNodeQuotaExceeded": exceptions.ReservedNodeQuotaExceeded, 72 "InvalidClusterState": exceptions.InvalidClusterState, 73 "HsmClientCertificateQuotaExceeded": exceptions.HsmClientCertificateQuotaExceeded, 74 "SubscriptionCategoryNotFound": exceptions.SubscriptionCategoryNotFound, 75 "HsmClientCertificateNotFound": exceptions.HsmClientCertificateNotFound, 76 "SubscriptionEventIdNotFound": exceptions.SubscriptionEventIdNotFound, 77 "ClusterSecurityGroupAlreadyExists": exceptions.ClusterSecurityGroupAlreadyExists, 78 "HsmConfigurationAlreadyExists": exceptions.HsmConfigurationAlreadyExists, 79 "NumberOfNodesQuotaExceeded": exceptions.NumberOfNodesQuotaExceeded, 80 "ReservedNodeOfferingNotFound": exceptions.ReservedNodeOfferingNotFound, 81 "BucketNotFound": exceptions.BucketNotFound, 82 "InsufficientClusterCapacity": exceptions.InsufficientClusterCapacity, 83 "InvalidRestore": exceptions.InvalidRestore, 84 "UnauthorizedOperation": exceptions.UnauthorizedOperation, 85 "ClusterQuotaExceeded": exceptions.ClusterQuotaExceeded, 86 "InvalidVPCNetworkState": exceptions.InvalidVPCNetworkState, 87 "ClusterSnapshotNotFound": exceptions.ClusterSnapshotNotFound, 88 "AuthorizationQuotaExceeded": exceptions.AuthorizationQuotaExceeded, 89 "InvalidHsmClientCertificateState": exceptions.InvalidHsmClientCertificateState, 90 "SNSTopicArnNotFound": exceptions.SNSTopicArnNotFound, 91 "ResizeNotFound": exceptions.ResizeNotFound, 92 "ClusterSubnetGroupNotFound": exceptions.ClusterSubnetGroupNotFound, 93 "SNSNoAuthorization": exceptions.SNSNoAuthorization, 94 "ClusterSnapshotQuotaExceeded": exceptions.ClusterSnapshotQuotaExceeded, 95 "AccessToSnapshotDenied": exceptions.AccessToSnapshotDenied, 96 "InvalidClusterSecurityGroupState": exceptions.InvalidClusterSecurityGroupState, 97 "NumberOfNodesPerClusterLimitExceeded": exceptions.NumberOfNodesPerClusterLimitExceeded, 98 "ClusterSubnetQuotaExceeded": exceptions.ClusterSubnetQuotaExceeded, 99 "SNSInvalidTopic": exceptions.SNSInvalidTopic, 100 "ClusterSecurityGroupNotFound": exceptions.ClusterSecurityGroupNotFound, 101 "InvalidElasticIp": exceptions.InvalidElasticIp, 102 "InvalidClusterParameterGroupState": exceptions.InvalidClusterParameterGroupState, 103 "InvalidHsmConfigurationState": exceptions.InvalidHsmConfigurationState, 104 "ClusterAlreadyExists": exceptions.ClusterAlreadyExists, 105 "HsmConfigurationQuotaExceeded": exceptions.HsmConfigurationQuotaExceeded, 106 "ClusterSnapshotAlreadyExists": exceptions.ClusterSnapshotAlreadyExists, 107 "SubscriptionSeverityNotFound": exceptions.SubscriptionSeverityNotFound, 108 "SourceNotFound": exceptions.SourceNotFound, 109 "ReservedNodeAlreadyExists": exceptions.ReservedNodeAlreadyExists, 110 "ClusterSubnetGroupQuotaExceeded": exceptions.ClusterSubnetGroupQuotaExceeded, 111 "ClusterParameterGroupNotFound": exceptions.ClusterParameterGroupNotFound, 112 "InvalidS3BucketName": exceptions.InvalidS3BucketName, 113 "InvalidS3KeyPrefix": exceptions.InvalidS3KeyPrefix, 114 "SubscriptionAlreadyExist": exceptions.SubscriptionAlreadyExist, 115 "HsmConfigurationNotFound": exceptions.HsmConfigurationNotFound, 116 "InvalidSubscriptionState": exceptions.InvalidSubscriptionState, 117 "AuthorizationNotFound": exceptions.AuthorizationNotFound, 118 "ClusterSecurityGroupQuotaExceeded": exceptions.ClusterSecurityGroupQuotaExceeded, 119 "SubnetAlreadyInUse": exceptions.SubnetAlreadyInUse, 120 "EventSubscriptionQuotaExceeded": exceptions.EventSubscriptionQuotaExceeded, 121 "AuthorizationAlreadyExists": exceptions.AuthorizationAlreadyExists, 122 "InvalidClusterSnapshotState": exceptions.InvalidClusterSnapshotState, 123 "ClusterParameterGroupQuotaExceeded": exceptions.ClusterParameterGroupQuotaExceeded, 124 "SnapshotCopyDisabled": exceptions.SnapshotCopyDisabled, 125 "ClusterSubnetGroupAlreadyExists": exceptions.ClusterSubnetGroupAlreadyExists, 126 "ReservedNodeNotFound": exceptions.ReservedNodeNotFound, 127 "HsmClientCertificateAlreadyExists": exceptions.HsmClientCertificateAlreadyExists, 128 "InvalidClusterSubnetGroupState": exceptions.InvalidClusterSubnetGroupState, 129 "SubscriptionNotFound": exceptions.SubscriptionNotFound, 130 "InsufficientS3BucketPolicy": exceptions.InsufficientS3BucketPolicy, 131 "ClusterParameterGroupAlreadyExists": exceptions.ClusterParameterGroupAlreadyExists, 132 "UnsupportedOption": exceptions.UnsupportedOption, 133 "CopyToRegionDisabled": exceptions.CopyToRegionDisabled, 134 "SnapshotCopyAlreadyEnabled": exceptions.SnapshotCopyAlreadyEnabled, 135 "IncompatibleOrderableOptions": exceptions.IncompatibleOrderableOptions, 136 } 137 138 139 def __init__(self, **kwargs): 140 region = kwargs.pop('region', None) 141 if not region: 142 region = RegionInfo(self, self.DefaultRegionName, 143 self.DefaultRegionEndpoint) 144 145 if 'host' not in kwargs or kwargs['host'] is None: 146 kwargs['host'] = region.endpoint 147 148 super(RedshiftConnection, self).__init__(**kwargs) 149 self.region = region 150 151 def _required_auth_capability(self): 152 return ['hmac-v4'] 153 154 def authorize_cluster_security_group_ingress(self, 155 cluster_security_group_name, 156 cidrip=None, 157 ec2_security_group_name=None, 158 ec2_security_group_owner_id=None): 159 """ 160 Adds an inbound (ingress) rule to an Amazon Redshift security 161 group. Depending on whether the application accessing your 162 cluster is running on the Internet or an EC2 instance, you can 163 authorize inbound access to either a Classless Interdomain 164 Routing (CIDR) IP address range or an EC2 security group. You 165 can add as many as 20 ingress rules to an Amazon Redshift 166 security group. 167 168 For an overview of CIDR blocks, see the Wikipedia article on 169 `Classless Inter-Domain Routing`_. 170 171 You must also associate the security group with a cluster so 172 that clients running on these IP addresses or the EC2 instance 173 are authorized to connect to the cluster. For information 174 about managing security groups, go to `Working with Security 175 Groups`_ in the Amazon Redshift Management Guide . 176 177 :type cluster_security_group_name: string 178 :param cluster_security_group_name: The name of the security group to 179 which the ingress rule is added. 180 181 :type cidrip: string 182 :param cidrip: The IP range to be added the Amazon Redshift security 183 group. 184 185 :type ec2_security_group_name: string 186 :param ec2_security_group_name: The EC2 security group to be added the 187 Amazon Redshift security group. 188 189 :type ec2_security_group_owner_id: string 190 :param ec2_security_group_owner_id: The AWS account number of the owner 191 of the security group specified by the EC2SecurityGroupName 192 parameter. The AWS Access Key ID is not an acceptable value. 193 Example: `111122223333` 194 195 """ 196 params = { 197 'ClusterSecurityGroupName': cluster_security_group_name, 198 } 199 if cidrip is not None: 200 params['CIDRIP'] = cidrip 201 if ec2_security_group_name is not None: 202 params['EC2SecurityGroupName'] = ec2_security_group_name 203 if ec2_security_group_owner_id is not None: 204 params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id 205 return self._make_request( 206 action='AuthorizeClusterSecurityGroupIngress', 207 verb='POST', 208 path='/', params=params) 209 210 def authorize_snapshot_access(self, snapshot_identifier, 211 account_with_restore_access, 212 snapshot_cluster_identifier=None): 213 """ 214 Authorizes the specified AWS customer account to restore the 215 specified snapshot. 216 217 For more information about working with snapshots, go to 218 `Amazon Redshift Snapshots`_ in the Amazon Redshift Management 219 Guide . 220 221 :type snapshot_identifier: string 222 :param snapshot_identifier: The identifier of the snapshot the account 223 is authorized to restore. 224 225 :type snapshot_cluster_identifier: string 226 :param snapshot_cluster_identifier: The identifier of the cluster the 227 snapshot was created from. This parameter is required if your IAM 228 user has a policy containing a snapshot resource element that 229 specifies anything other than * for the cluster name. 230 231 :type account_with_restore_access: string 232 :param account_with_restore_access: The identifier of the AWS customer 233 account authorized to restore the specified snapshot. 234 235 """ 236 params = { 237 'SnapshotIdentifier': snapshot_identifier, 238 'AccountWithRestoreAccess': account_with_restore_access, 239 } 240 if snapshot_cluster_identifier is not None: 241 params['SnapshotClusterIdentifier'] = snapshot_cluster_identifier 242 return self._make_request( 243 action='AuthorizeSnapshotAccess', 244 verb='POST', 245 path='/', params=params) 246 247 def copy_cluster_snapshot(self, source_snapshot_identifier, 248 target_snapshot_identifier, 249 source_snapshot_cluster_identifier=None): 250 """ 251 Copies the specified automated cluster snapshot to a new 252 manual cluster snapshot. The source must be an automated 253 snapshot and it must be in the available state. 254 255 When you delete a cluster, Amazon Redshift deletes any 256 automated snapshots of the cluster. Also, when the retention 257 period of the snapshot expires, Amazon Redshift automatically 258 deletes it. If you want to keep an automated snapshot for a 259 longer period, you can make a manual copy of the snapshot. 260 Manual snapshots are retained until you delete them. 261 262 For more information about working with snapshots, go to 263 `Amazon Redshift Snapshots`_ in the Amazon Redshift Management 264 Guide . 265 266 :type source_snapshot_identifier: string 267 :param source_snapshot_identifier: 268 The identifier for the source snapshot. 269 270 Constraints: 271 272 273 + Must be the identifier for a valid automated snapshot whose state is 274 `available`. 275 276 :type source_snapshot_cluster_identifier: string 277 :param source_snapshot_cluster_identifier: 278 The identifier of the cluster the source snapshot was created from. 279 This parameter is required if your IAM user has a policy containing 280 a snapshot resource element that specifies anything other than * 281 for the cluster name. 282 283 Constraints: 284 285 286 + Must be the identifier for a valid cluster. 287 288 :type target_snapshot_identifier: string 289 :param target_snapshot_identifier: 290 The identifier given to the new manual snapshot. 291 292 Constraints: 293 294 295 + Cannot be null, empty, or blank. 296 + Must contain from 1 to 255 alphanumeric characters or hyphens. 297 + First character must be a letter. 298 + Cannot end with a hyphen or contain two consecutive hyphens. 299 + Must be unique for the AWS account that is making the request. 300 301 """ 302 params = { 303 'SourceSnapshotIdentifier': source_snapshot_identifier, 304 'TargetSnapshotIdentifier': target_snapshot_identifier, 305 } 306 if source_snapshot_cluster_identifier is not None: 307 params['SourceSnapshotClusterIdentifier'] = source_snapshot_cluster_identifier 308 return self._make_request( 309 action='CopyClusterSnapshot', 310 verb='POST', 311 path='/', params=params) 312 313 def create_cluster(self, cluster_identifier, node_type, master_username, 314 master_user_password, db_name=None, cluster_type=None, 315 cluster_security_groups=None, 316 vpc_security_group_ids=None, 317 cluster_subnet_group_name=None, 318 availability_zone=None, 319 preferred_maintenance_window=None, 320 cluster_parameter_group_name=None, 321 automated_snapshot_retention_period=None, port=None, 322 cluster_version=None, allow_version_upgrade=None, 323 number_of_nodes=None, publicly_accessible=None, 324 encrypted=None, 325 hsm_client_certificate_identifier=None, 326 hsm_configuration_identifier=None, elastic_ip=None): 327 """ 328 Creates a new cluster. To create the cluster in virtual 329 private cloud (VPC), you must provide cluster subnet group 330 name. If you don't provide a cluster subnet group name or the 331 cluster security group parameter, Amazon Redshift creates a 332 non-VPC cluster, it associates the default cluster security 333 group with the cluster. For more information about managing 334 clusters, go to `Amazon Redshift Clusters`_ in the Amazon 335 Redshift Management Guide . 336 337 :type db_name: string 338 :param db_name: 339 The name of the first database to be created when the cluster is 340 created. 341 342 To create additional databases after the cluster is created, connect to 343 the cluster with a SQL client and use SQL commands to create a 344 database. For more information, go to `Create a Database`_ in the 345 Amazon Redshift Database Developer Guide. 346 347 Default: `dev` 348 349 Constraints: 350 351 352 + Must contain 1 to 64 alphanumeric characters. 353 + Must contain only lowercase letters. 354 + Cannot be a word that is reserved by the service. A list of reserved 355 words can be found in `Reserved Words`_ in the Amazon Redshift 356 Database Developer Guide. 357 358 :type cluster_identifier: string 359 :param cluster_identifier: A unique identifier for the cluster. You use 360 this identifier to refer to the cluster for any subsequent cluster 361 operations such as deleting or modifying. The identifier also 362 appears in the Amazon Redshift console. 363 Constraints: 364 365 366 + Must contain from 1 to 63 alphanumeric characters or hyphens. 367 + Alphabetic characters must be lowercase. 368 + First character must be a letter. 369 + Cannot end with a hyphen or contain two consecutive hyphens. 370 + Must be unique for all clusters within an AWS account. 371 372 373 Example: `myexamplecluster` 374 375 :type cluster_type: string 376 :param cluster_type: The type of the cluster. When cluster type is 377 specified as 378 379 + `single-node`, the **NumberOfNodes** parameter is not required. 380 + `multi-node`, the **NumberOfNodes** parameter is required. 381 382 383 Valid Values: `multi-node` | `single-node` 384 385 Default: `multi-node` 386 387 :type node_type: string 388 :param node_type: The node type to be provisioned for the cluster. For 389 information about node types, go to ` Working with Clusters`_ in 390 the Amazon Redshift Management Guide . 391 Valid Values: `dw1.xlarge` | `dw1.8xlarge` | `dw2.large` | 392 `dw2.8xlarge`. 393 394 :type master_username: string 395 :param master_username: 396 The user name associated with the master user account for the cluster 397 that is being created. 398 399 Constraints: 400 401 402 + Must be 1 - 128 alphanumeric characters. 403 + First character must be a letter. 404 + Cannot be a reserved word. A list of reserved words can be found in 405 `Reserved Words`_ in the Amazon Redshift Database Developer Guide. 406 407 :type master_user_password: string 408 :param master_user_password: 409 The password associated with the master user account for the cluster 410 that is being created. 411 412 Constraints: 413 414 415 + Must be between 8 and 64 characters in length. 416 + Must contain at least one uppercase letter. 417 + Must contain at least one lowercase letter. 418 + Must contain one number. 419 + Can be any printable ASCII character (ASCII code 33 to 126) except ' 420 (single quote), " (double quote), \, /, @, or space. 421 422 :type cluster_security_groups: list 423 :param cluster_security_groups: A list of security groups to be 424 associated with this cluster. 425 Default: The default cluster security group for Amazon Redshift. 426 427 :type vpc_security_group_ids: list 428 :param vpc_security_group_ids: A list of Virtual Private Cloud (VPC) 429 security groups to be associated with the cluster. 430 Default: The default VPC security group is associated with the cluster. 431 432 :type cluster_subnet_group_name: string 433 :param cluster_subnet_group_name: The name of a cluster subnet group to 434 be associated with this cluster. 435 If this parameter is not provided the resulting cluster will be 436 deployed outside virtual private cloud (VPC). 437 438 :type availability_zone: string 439 :param availability_zone: The EC2 Availability Zone (AZ) in which you 440 want Amazon Redshift to provision the cluster. For example, if you 441 have several EC2 instances running in a specific Availability Zone, 442 then you might want the cluster to be provisioned in the same zone 443 in order to decrease network latency. 444 Default: A random, system-chosen Availability Zone in the region that 445 is specified by the endpoint. 446 447 Example: `us-east-1d` 448 449 Constraint: The specified Availability Zone must be in the same region 450 as the current endpoint. 451 452 :type preferred_maintenance_window: string 453 :param preferred_maintenance_window: The weekly time range (in UTC) 454 during which automated cluster maintenance can occur. 455 Format: `ddd:hh24:mi-ddd:hh24:mi` 456 457 Default: A 30-minute window selected at random from an 8-hour block of 458 time per region, occurring on a random day of the week. The 459 following list shows the time blocks for each region from which the 460 default maintenance windows are assigned. 461 462 463 + **US-East (Northern Virginia) Region:** 03:00-11:00 UTC 464 + **US-West (Oregon) Region** 06:00-14:00 UTC 465 + **EU (Ireland) Region** 22:00-06:00 UTC 466 + **Asia Pacific (Singapore) Region** 14:00-22:00 UTC 467 + **Asia Pacific (Sydney) Region** 12:00-20:00 UTC 468 + **Asia Pacific (Tokyo) Region** 17:00-03:00 UTC 469 470 471 Valid Days: Mon | Tue | Wed | Thu | Fri | Sat | Sun 472 473 Constraints: Minimum 30-minute window. 474 475 :type cluster_parameter_group_name: string 476 :param cluster_parameter_group_name: 477 The name of the parameter group to be associated with this cluster. 478 479 Default: The default Amazon Redshift cluster parameter group. For 480 information about the default parameter group, go to `Working with 481 Amazon Redshift Parameter Groups`_ 482 483 Constraints: 484 485 486 + Must be 1 to 255 alphanumeric characters or hyphens. 487 + First character must be a letter. 488 + Cannot end with a hyphen or contain two consecutive hyphens. 489 490 :type automated_snapshot_retention_period: integer 491 :param automated_snapshot_retention_period: The number of days that 492 automated snapshots are retained. If the value is 0, automated 493 snapshots are disabled. Even if automated snapshots are disabled, 494 you can still create manual snapshots when you want with 495 CreateClusterSnapshot. 496 Default: `1` 497 498 Constraints: Must be a value from 0 to 35. 499 500 :type port: integer 501 :param port: The port number on which the cluster accepts incoming 502 connections. 503 The cluster is accessible only via the JDBC and ODBC connection 504 strings. Part of the connection string requires the port on which 505 the cluster will listen for incoming connections. 506 507 Default: `5439` 508 509 Valid Values: `1150-65535` 510 511 :type cluster_version: string 512 :param cluster_version: The version of the Amazon Redshift engine 513 software that you want to deploy on the cluster. 514 The version selected runs on all the nodes in the cluster. 515 516 Constraints: Only version 1.0 is currently available. 517 518 Example: `1.0` 519 520 :type allow_version_upgrade: boolean 521 :param allow_version_upgrade: If `True`, upgrades can be applied during 522 the maintenance window to the Amazon Redshift engine that is 523 running on the cluster. 524 When a new version of the Amazon Redshift engine is released, you can 525 request that the service automatically apply upgrades during the 526 maintenance window to the Amazon Redshift engine that is running on 527 your cluster. 528 529 Default: `True` 530 531 :type number_of_nodes: integer 532 :param number_of_nodes: The number of compute nodes in the cluster. 533 This parameter is required when the **ClusterType** parameter is 534 specified as `multi-node`. 535 For information about determining how many nodes you need, go to ` 536 Working with Clusters`_ in the Amazon Redshift Management Guide . 537 538 If you don't specify this parameter, you get a single-node cluster. 539 When requesting a multi-node cluster, you must specify the number 540 of nodes that you want in the cluster. 541 542 Default: `1` 543 544 Constraints: Value must be at least 1 and no more than 100. 545 546 :type publicly_accessible: boolean 547 :param publicly_accessible: If `True`, the cluster can be accessed from 548 a public network. 549 550 :type encrypted: boolean 551 :param encrypted: If `True`, the data in the cluster is encrypted at 552 rest. 553 Default: false 554 555 :type hsm_client_certificate_identifier: string 556 :param hsm_client_certificate_identifier: Specifies the name of the HSM 557 client certificate the Amazon Redshift cluster uses to retrieve the 558 data encryption keys stored in an HSM. 559 560 :type hsm_configuration_identifier: string 561 :param hsm_configuration_identifier: Specifies the name of the HSM 562 configuration that contains the information the Amazon Redshift 563 cluster can use to retrieve and store keys in an HSM. 564 565 :type elastic_ip: string 566 :param elastic_ip: The Elastic IP (EIP) address for the cluster. 567 Constraints: The cluster must be provisioned in EC2-VPC and publicly- 568 accessible through an Internet gateway. For more information about 569 provisioning clusters in EC2-VPC, go to `Supported Platforms to 570 Launch Your Cluster`_ in the Amazon Redshift Management Guide. 571 572 """ 573 params = { 574 'ClusterIdentifier': cluster_identifier, 575 'NodeType': node_type, 576 'MasterUsername': master_username, 577 'MasterUserPassword': master_user_password, 578 } 579 if db_name is not None: 580 params['DBName'] = db_name 581 if cluster_type is not None: 582 params['ClusterType'] = cluster_type 583 if cluster_security_groups is not None: 584 self.build_list_params(params, 585 cluster_security_groups, 586 'ClusterSecurityGroups.member') 587 if vpc_security_group_ids is not None: 588 self.build_list_params(params, 589 vpc_security_group_ids, 590 'VpcSecurityGroupIds.member') 591 if cluster_subnet_group_name is not None: 592 params['ClusterSubnetGroupName'] = cluster_subnet_group_name 593 if availability_zone is not None: 594 params['AvailabilityZone'] = availability_zone 595 if preferred_maintenance_window is not None: 596 params['PreferredMaintenanceWindow'] = preferred_maintenance_window 597 if cluster_parameter_group_name is not None: 598 params['ClusterParameterGroupName'] = cluster_parameter_group_name 599 if automated_snapshot_retention_period is not None: 600 params['AutomatedSnapshotRetentionPeriod'] = automated_snapshot_retention_period 601 if port is not None: 602 params['Port'] = port 603 if cluster_version is not None: 604 params['ClusterVersion'] = cluster_version 605 if allow_version_upgrade is not None: 606 params['AllowVersionUpgrade'] = str( 607 allow_version_upgrade).lower() 608 if number_of_nodes is not None: 609 params['NumberOfNodes'] = number_of_nodes 610 if publicly_accessible is not None: 611 params['PubliclyAccessible'] = str( 612 publicly_accessible).lower() 613 if encrypted is not None: 614 params['Encrypted'] = str( 615 encrypted).lower() 616 if hsm_client_certificate_identifier is not None: 617 params['HsmClientCertificateIdentifier'] = hsm_client_certificate_identifier 618 if hsm_configuration_identifier is not None: 619 params['HsmConfigurationIdentifier'] = hsm_configuration_identifier 620 if elastic_ip is not None: 621 params['ElasticIp'] = elastic_ip 622 return self._make_request( 623 action='CreateCluster', 624 verb='POST', 625 path='/', params=params) 626 627 def create_cluster_parameter_group(self, parameter_group_name, 628 parameter_group_family, description): 629 """ 630 Creates an Amazon Redshift parameter group. 631 632 Creating parameter groups is independent of creating clusters. 633 You can associate a cluster with a parameter group when you 634 create the cluster. You can also associate an existing cluster 635 with a parameter group after the cluster is created by using 636 ModifyCluster. 637 638 Parameters in the parameter group define specific behavior 639 that applies to the databases you create on the cluster. For 640 more information about managing parameter groups, go to 641 `Amazon Redshift Parameter Groups`_ in the Amazon Redshift 642 Management Guide . 643 644 :type parameter_group_name: string 645 :param parameter_group_name: 646 The name of the cluster parameter group. 647 648 Constraints: 649 650 651 + Must be 1 to 255 alphanumeric characters or hyphens 652 + First character must be a letter. 653 + Cannot end with a hyphen or contain two consecutive hyphens. 654 + Must be unique within your AWS account. 655 656 This value is stored as a lower-case string. 657 658 :type parameter_group_family: string 659 :param parameter_group_family: The Amazon Redshift engine version to 660 which the cluster parameter group applies. The cluster engine 661 version determines the set of parameters. 662 To get a list of valid parameter group family names, you can call 663 DescribeClusterParameterGroups. By default, Amazon Redshift returns 664 a list of all the parameter groups that are owned by your AWS 665 account, including the default parameter groups for each Amazon 666 Redshift engine version. The parameter group family names 667 associated with the default parameter groups provide you the valid 668 values. For example, a valid family name is "redshift-1.0". 669 670 :type description: string 671 :param description: A description of the parameter group. 672 673 """ 674 params = { 675 'ParameterGroupName': parameter_group_name, 676 'ParameterGroupFamily': parameter_group_family, 677 'Description': description, 678 } 679 return self._make_request( 680 action='CreateClusterParameterGroup', 681 verb='POST', 682 path='/', params=params) 683 684 def create_cluster_security_group(self, cluster_security_group_name, 685 description): 686 """ 687 Creates a new Amazon Redshift security group. You use security 688 groups to control access to non-VPC clusters. 689 690 For information about managing security groups, go to `Amazon 691 Redshift Cluster Security Groups`_ in the Amazon Redshift 692 Management Guide . 693 694 :type cluster_security_group_name: string 695 :param cluster_security_group_name: The name for the security group. 696 Amazon Redshift stores the value as a lowercase string. 697 Constraints: 698 699 700 + Must contain no more than 255 alphanumeric characters or hyphens. 701 + Must not be "Default". 702 + Must be unique for all security groups that are created by your AWS 703 account. 704 705 706 Example: `examplesecuritygroup` 707 708 :type description: string 709 :param description: A description for the security group. 710 711 """ 712 params = { 713 'ClusterSecurityGroupName': cluster_security_group_name, 714 'Description': description, 715 } 716 return self._make_request( 717 action='CreateClusterSecurityGroup', 718 verb='POST', 719 path='/', params=params) 720 721 def create_cluster_snapshot(self, snapshot_identifier, 722 cluster_identifier): 723 """ 724 Creates a manual snapshot of the specified cluster. The 725 cluster must be in the `available` state. 726 727 For more information about working with snapshots, go to 728 `Amazon Redshift Snapshots`_ in the Amazon Redshift Management 729 Guide . 730 731 :type snapshot_identifier: string 732 :param snapshot_identifier: A unique identifier for the snapshot that 733 you are requesting. This identifier must be unique for all 734 snapshots within the AWS account. 735 Constraints: 736 737 738 + Cannot be null, empty, or blank 739 + Must contain from 1 to 255 alphanumeric characters or hyphens 740 + First character must be a letter 741 + Cannot end with a hyphen or contain two consecutive hyphens 742 743 744 Example: `my-snapshot-id` 745 746 :type cluster_identifier: string 747 :param cluster_identifier: The cluster identifier for which you want a 748 snapshot. 749 750 """ 751 params = { 752 'SnapshotIdentifier': snapshot_identifier, 753 'ClusterIdentifier': cluster_identifier, 754 } 755 return self._make_request( 756 action='CreateClusterSnapshot', 757 verb='POST', 758 path='/', params=params) 759 760 def create_cluster_subnet_group(self, cluster_subnet_group_name, 761 description, subnet_ids): 762 """ 763 Creates a new Amazon Redshift subnet group. You must provide a 764 list of one or more subnets in your existing Amazon Virtual 765 Private Cloud (Amazon VPC) when creating Amazon Redshift 766 subnet group. 767 768 For information about subnet groups, go to `Amazon Redshift 769 Cluster Subnet Groups`_ in the Amazon Redshift Management 770 Guide . 771 772 :type cluster_subnet_group_name: string 773 :param cluster_subnet_group_name: The name for the subnet group. Amazon 774 Redshift stores the value as a lowercase string. 775 Constraints: 776 777 778 + Must contain no more than 255 alphanumeric characters or hyphens. 779 + Must not be "Default". 780 + Must be unique for all subnet groups that are created by your AWS 781 account. 782 783 784 Example: `examplesubnetgroup` 785 786 :type description: string 787 :param description: A description for the subnet group. 788 789 :type subnet_ids: list 790 :param subnet_ids: An array of VPC subnet IDs. A maximum of 20 subnets 791 can be modified in a single request. 792 793 """ 794 params = { 795 'ClusterSubnetGroupName': cluster_subnet_group_name, 796 'Description': description, 797 } 798 self.build_list_params(params, 799 subnet_ids, 800 'SubnetIds.member') 801 return self._make_request( 802 action='CreateClusterSubnetGroup', 803 verb='POST', 804 path='/', params=params) 805 806 def create_event_subscription(self, subscription_name, sns_topic_arn, 807 source_type=None, source_ids=None, 808 event_categories=None, severity=None, 809 enabled=None): 810 """ 811 Creates an Amazon Redshift event notification subscription. 812 This action requires an ARN (Amazon Resource Name) of an 813 Amazon SNS topic created by either the Amazon Redshift 814 console, the Amazon SNS console, or the Amazon SNS API. To 815 obtain an ARN with Amazon SNS, you must create a topic in 816 Amazon SNS and subscribe to the topic. The ARN is displayed in 817 the SNS console. 818 819 You can specify the source type, and lists of Amazon Redshift 820 source IDs, event categories, and event severities. 821 Notifications will be sent for all events you want that match 822 those criteria. For example, you can specify source type = 823 cluster, source ID = my-cluster-1 and mycluster2, event 824 categories = Availability, Backup, and severity = ERROR. The 825 subscription will only send notifications for those ERROR 826 events in the Availability and Backup categories for the 827 specified clusters. 828 829 If you specify both the source type and source IDs, such as 830 source type = cluster and source identifier = my-cluster-1, 831 notifications will be sent for all the cluster events for my- 832 cluster-1. If you specify a source type but do not specify a 833 source identifier, you will receive notice of the events for 834 the objects of that type in your AWS account. If you do not 835 specify either the SourceType nor the SourceIdentifier, you 836 will be notified of events generated from all Amazon Redshift 837 sources belonging to your AWS account. You must specify a 838 source type if you specify a source ID. 839 840 :type subscription_name: string 841 :param subscription_name: 842 The name of the event subscription to be created. 843 844 Constraints: 845 846 847 + Cannot be null, empty, or blank. 848 + Must contain from 1 to 255 alphanumeric characters or hyphens. 849 + First character must be a letter. 850 + Cannot end with a hyphen or contain two consecutive hyphens. 851 852 :type sns_topic_arn: string 853 :param sns_topic_arn: The Amazon Resource Name (ARN) of the Amazon SNS 854 topic used to transmit the event notifications. The ARN is created 855 by Amazon SNS when you create a topic and subscribe to it. 856 857 :type source_type: string 858 :param source_type: The type of source that will be generating the 859 events. For example, if you want to be notified of events generated 860 by a cluster, you would set this parameter to cluster. If this 861 value is not specified, events are returned for all Amazon Redshift 862 objects in your AWS account. You must specify a source type in 863 order to specify source IDs. 864 Valid values: cluster, cluster-parameter-group, cluster-security-group, 865 and cluster-snapshot. 866 867 :type source_ids: list 868 :param source_ids: A list of one or more identifiers of Amazon Redshift 869 source objects. All of the objects must be of the same type as was 870 specified in the source type parameter. The event subscription will 871 return only events generated by the specified objects. If not 872 specified, then events are returned for all objects within the 873 source type specified. 874 Example: my-cluster-1, my-cluster-2 875 876 Example: my-snapshot-20131010 877 878 :type event_categories: list 879 :param event_categories: Specifies the Amazon Redshift event categories 880 to be published by the event notification subscription. 881 Values: Configuration, Management, Monitoring, Security 882 883 :type severity: string 884 :param severity: Specifies the Amazon Redshift event severity to be 885 published by the event notification subscription. 886 Values: ERROR, INFO 887 888 :type enabled: boolean 889 :param enabled: A Boolean value; set to `True` to activate the 890 subscription, set to `False` to create the subscription but not 891 active it. 892 893 """ 894 params = { 895 'SubscriptionName': subscription_name, 896 'SnsTopicArn': sns_topic_arn, 897 } 898 if source_type is not None: 899 params['SourceType'] = source_type 900 if source_ids is not None: 901 self.build_list_params(params, 902 source_ids, 903 'SourceIds.member') 904 if event_categories is not None: 905 self.build_list_params(params, 906 event_categories, 907 'EventCategories.member') 908 if severity is not None: 909 params['Severity'] = severity 910 if enabled is not None: 911 params['Enabled'] = str( 912 enabled).lower() 913 return self._make_request( 914 action='CreateEventSubscription', 915 verb='POST', 916 path='/', params=params) 917 918 def create_hsm_client_certificate(self, 919 hsm_client_certificate_identifier): 920 """ 921 Creates an HSM client certificate that an Amazon Redshift 922 cluster will use to connect to the client's HSM in order to 923 store and retrieve the keys used to encrypt the cluster 924 databases. 925 926 The command returns a public key, which you must store in the 927 HSM. In addition to creating the HSM certificate, you must 928 create an Amazon Redshift HSM configuration that provides a 929 cluster the information needed to store and use encryption 930 keys in the HSM. For more information, go to `Hardware 931 Security Modules`_ in the Amazon Redshift Management Guide. 932 933 :type hsm_client_certificate_identifier: string 934 :param hsm_client_certificate_identifier: The identifier to be assigned 935 to the new HSM client certificate that the cluster will use to 936 connect to the HSM to use the database encryption keys. 937 938 """ 939 params = { 940 'HsmClientCertificateIdentifier': hsm_client_certificate_identifier, 941 } 942 return self._make_request( 943 action='CreateHsmClientCertificate', 944 verb='POST', 945 path='/', params=params) 946 947 def create_hsm_configuration(self, hsm_configuration_identifier, 948 description, hsm_ip_address, 949 hsm_partition_name, hsm_partition_password, 950 hsm_server_public_certificate): 951 """ 952 Creates an HSM configuration that contains the information 953 required by an Amazon Redshift cluster to store and use 954 database encryption keys in a Hardware Security Module (HSM). 955 After creating the HSM configuration, you can specify it as a 956 parameter when creating a cluster. The cluster will then store 957 its encryption keys in the HSM. 958 959 In addition to creating an HSM configuration, you must also 960 create an HSM client certificate. For more information, go to 961 `Hardware Security Modules`_ in the Amazon Redshift Management 962 Guide. 963 964 :type hsm_configuration_identifier: string 965 :param hsm_configuration_identifier: The identifier to be assigned to 966 the new Amazon Redshift HSM configuration. 967 968 :type description: string 969 :param description: A text description of the HSM configuration to be 970 created. 971 972 :type hsm_ip_address: string 973 :param hsm_ip_address: The IP address that the Amazon Redshift cluster 974 must use to access the HSM. 975 976 :type hsm_partition_name: string 977 :param hsm_partition_name: The name of the partition in the HSM where 978 the Amazon Redshift clusters will store their database encryption 979 keys. 980 981 :type hsm_partition_password: string 982 :param hsm_partition_password: The password required to access the HSM 983 partition. 984 985 :type hsm_server_public_certificate: string 986 :param hsm_server_public_certificate: The HSMs public certificate file. 987 When using Cloud HSM, the file name is server.pem. 988 989 """ 990 params = { 991 'HsmConfigurationIdentifier': hsm_configuration_identifier, 992 'Description': description, 993 'HsmIpAddress': hsm_ip_address, 994 'HsmPartitionName': hsm_partition_name, 995 'HsmPartitionPassword': hsm_partition_password, 996 'HsmServerPublicCertificate': hsm_server_public_certificate, 997 } 998 return self._make_request( 999 action='CreateHsmConfiguration', 1000 verb='POST', 1001 path='/', params=params) 1002 1003 def delete_cluster(self, cluster_identifier, 1004 skip_final_cluster_snapshot=None, 1005 final_cluster_snapshot_identifier=None): 1006 """ 1007 Deletes a previously provisioned cluster. A successful 1008 response from the web service indicates that the request was 1009 received correctly. If a final cluster snapshot is requested 1010 the status of the cluster will be "final-snapshot" while the 1011 snapshot is being taken, then it's "deleting" once Amazon 1012 Redshift begins deleting the cluster. Use DescribeClusters to 1013 monitor the status of the deletion. The delete operation 1014 cannot be canceled or reverted once submitted. For more 1015 information about managing clusters, go to `Amazon Redshift 1016 Clusters`_ in the Amazon Redshift Management Guide . 1017 1018 :type cluster_identifier: string 1019 :param cluster_identifier: 1020 The identifier of the cluster to be deleted. 1021 1022 Constraints: 1023 1024 1025 + Must contain lowercase characters. 1026 + Must contain from 1 to 63 alphanumeric characters or hyphens. 1027 + First character must be a letter. 1028 + Cannot end with a hyphen or contain two consecutive hyphens. 1029 1030 :type skip_final_cluster_snapshot: boolean 1031 :param skip_final_cluster_snapshot: Determines whether a final snapshot 1032 of the cluster is created before Amazon Redshift deletes the 1033 cluster. If `True`, a final cluster snapshot is not created. If 1034 `False`, a final cluster snapshot is created before the cluster is 1035 deleted. 1036 Default: `False` 1037 1038 :type final_cluster_snapshot_identifier: string 1039 :param final_cluster_snapshot_identifier: 1040 The identifier of the final snapshot that is to be created immediately 1041 before deleting the cluster. If this parameter is provided, 1042 SkipFinalClusterSnapshot must be `False`. 1043 1044 Constraints: 1045 1046 1047 + Must be 1 to 255 alphanumeric characters. 1048 + First character must be a letter. 1049 + Cannot end with a hyphen or contain two consecutive hyphens. 1050 1051 """ 1052 params = {'ClusterIdentifier': cluster_identifier, } 1053 if skip_final_cluster_snapshot is not None: 1054 params['SkipFinalClusterSnapshot'] = str( 1055 skip_final_cluster_snapshot).lower() 1056 if final_cluster_snapshot_identifier is not None: 1057 params['FinalClusterSnapshotIdentifier'] = final_cluster_snapshot_identifier 1058 return self._make_request( 1059 action='DeleteCluster', 1060 verb='POST', 1061 path='/', params=params) 1062 1063 def delete_cluster_parameter_group(self, parameter_group_name): 1064 """ 1065 Deletes a specified Amazon Redshift parameter group. 1066 1067 :type parameter_group_name: string 1068 :param parameter_group_name: 1069 The name of the parameter group to be deleted. 1070 1071 Constraints: 1072 1073 1074 + Must be the name of an existing cluster parameter group. 1075 + Cannot delete a default cluster parameter group. 1076 1077 """ 1078 params = {'ParameterGroupName': parameter_group_name, } 1079 return self._make_request( 1080 action='DeleteClusterParameterGroup', 1081 verb='POST', 1082 path='/', params=params) 1083 1084 def delete_cluster_security_group(self, cluster_security_group_name): 1085 """ 1086 Deletes an Amazon Redshift security group. 1087 1088 For information about managing security groups, go to `Amazon 1089 Redshift Cluster Security Groups`_ in the Amazon Redshift 1090 Management Guide . 1091 1092 :type cluster_security_group_name: string 1093 :param cluster_security_group_name: The name of the cluster security 1094 group to be deleted. 1095 1096 """ 1097 params = { 1098 'ClusterSecurityGroupName': cluster_security_group_name, 1099 } 1100 return self._make_request( 1101 action='DeleteClusterSecurityGroup', 1102 verb='POST', 1103 path='/', params=params) 1104 1105 def delete_cluster_snapshot(self, snapshot_identifier, 1106 snapshot_cluster_identifier=None): 1107 """ 1108 Deletes the specified manual snapshot. The snapshot must be in 1109 the `available` state, with no other users authorized to 1110 access the snapshot. 1111 1112 Unlike automated snapshots, manual snapshots are retained even 1113 after you delete your cluster. Amazon Redshift does not delete 1114 your manual snapshots. You must delete manual snapshot 1115 explicitly to avoid getting charged. If other accounts are 1116 authorized to access the snapshot, you must revoke all of the 1117 authorizations before you can delete the snapshot. 1118 1119 :type snapshot_identifier: string 1120 :param snapshot_identifier: The unique identifier of the manual 1121 snapshot to be deleted. 1122 Constraints: Must be the name of an existing snapshot that is in the 1123 `available` state. 1124 1125 :type snapshot_cluster_identifier: string 1126 :param snapshot_cluster_identifier: The unique identifier of the 1127 cluster the snapshot was created from. This parameter is required 1128 if your IAM user has a policy containing a snapshot resource 1129 element that specifies anything other than * for the cluster name. 1130 Constraints: Must be the name of valid cluster. 1131 1132 """ 1133 params = {'SnapshotIdentifier': snapshot_identifier, } 1134 if snapshot_cluster_identifier is not None: 1135 params['SnapshotClusterIdentifier'] = snapshot_cluster_identifier 1136 return self._make_request( 1137 action='DeleteClusterSnapshot', 1138 verb='POST', 1139 path='/', params=params) 1140 1141 def delete_cluster_subnet_group(self, cluster_subnet_group_name): 1142 """ 1143 Deletes the specified cluster subnet group. 1144 1145 :type cluster_subnet_group_name: string 1146 :param cluster_subnet_group_name: The name of the cluster subnet group 1147 name to be deleted. 1148 1149 """ 1150 params = { 1151 'ClusterSubnetGroupName': cluster_subnet_group_name, 1152 } 1153 return self._make_request( 1154 action='DeleteClusterSubnetGroup', 1155 verb='POST', 1156 path='/', params=params) 1157 1158 def delete_event_subscription(self, subscription_name): 1159 """ 1160 Deletes an Amazon Redshift event notification subscription. 1161 1162 :type subscription_name: string 1163 :param subscription_name: The name of the Amazon Redshift event 1164 notification subscription to be deleted. 1165 1166 """ 1167 params = {'SubscriptionName': subscription_name, } 1168 return self._make_request( 1169 action='DeleteEventSubscription', 1170 verb='POST', 1171 path='/', params=params) 1172 1173 def delete_hsm_client_certificate(self, 1174 hsm_client_certificate_identifier): 1175 """ 1176 Deletes the specified HSM client certificate. 1177 1178 :type hsm_client_certificate_identifier: string 1179 :param hsm_client_certificate_identifier: The identifier of the HSM 1180 client certificate to be deleted. 1181 1182 """ 1183 params = { 1184 'HsmClientCertificateIdentifier': hsm_client_certificate_identifier, 1185 } 1186 return self._make_request( 1187 action='DeleteHsmClientCertificate', 1188 verb='POST', 1189 path='/', params=params) 1190 1191 def delete_hsm_configuration(self, hsm_configuration_identifier): 1192 """ 1193 Deletes the specified Amazon Redshift HSM configuration. 1194 1195 :type hsm_configuration_identifier: string 1196 :param hsm_configuration_identifier: The identifier of the Amazon 1197 Redshift HSM configuration to be deleted. 1198 1199 """ 1200 params = { 1201 'HsmConfigurationIdentifier': hsm_configuration_identifier, 1202 } 1203 return self._make_request( 1204 action='DeleteHsmConfiguration', 1205 verb='POST', 1206 path='/', params=params) 1207 1208 def describe_cluster_parameter_groups(self, parameter_group_name=None, 1209 max_records=None, marker=None): 1210 """ 1211 Returns a list of Amazon Redshift parameter groups, including 1212 parameter groups you created and the default parameter group. 1213 For each parameter group, the response includes the parameter 1214 group name, description, and parameter group family name. You 1215 can optionally specify a name to retrieve the description of a 1216 specific parameter group. 1217 1218 For more information about managing parameter groups, go to 1219 `Amazon Redshift Parameter Groups`_ in the Amazon Redshift 1220 Management Guide . 1221 1222 :type parameter_group_name: string 1223 :param parameter_group_name: The name of a specific parameter group for 1224 which to return details. By default, details about all parameter 1225 groups and the default parameter group are returned. 1226 1227 :type max_records: integer 1228 :param max_records: The maximum number of response records to return in 1229 each call. If the number of remaining response records exceeds the 1230 specified `MaxRecords` value, a value is returned in a `marker` 1231 field of the response. You can retrieve the next set of records by 1232 retrying the command with the returned marker value. 1233 Default: `100` 1234 1235 Constraints: minimum 20, maximum 100. 1236 1237 :type marker: string 1238 :param marker: An optional parameter that specifies the starting point 1239 to return a set of response records. When the results of a 1240 DescribeClusterParameterGroups request exceed the value specified 1241 in `MaxRecords`, AWS returns a value in the `Marker` field of the 1242 response. You can retrieve the next set of response records by 1243 providing the returned marker value in the `Marker` parameter and 1244 retrying the request. 1245 1246 """ 1247 params = {} 1248 if parameter_group_name is not None: 1249 params['ParameterGroupName'] = parameter_group_name 1250 if max_records is not None: 1251 params['MaxRecords'] = max_records 1252 if marker is not None: 1253 params['Marker'] = marker 1254 return self._make_request( 1255 action='DescribeClusterParameterGroups', 1256 verb='POST', 1257 path='/', params=params) 1258 1259 def describe_cluster_parameters(self, parameter_group_name, source=None, 1260 max_records=None, marker=None): 1261 """ 1262 Returns a detailed list of parameters contained within the 1263 specified Amazon Redshift parameter group. For each parameter 1264 the response includes information such as parameter name, 1265 description, data type, value, whether the parameter value is 1266 modifiable, and so on. 1267 1268 You can specify source filter to retrieve parameters of only 1269 specific type. For example, to retrieve parameters that were 1270 modified by a user action such as from 1271 ModifyClusterParameterGroup, you can specify source equal to 1272 user . 1273 1274 For more information about managing parameter groups, go to 1275 `Amazon Redshift Parameter Groups`_ in the Amazon Redshift 1276 Management Guide . 1277 1278 :type parameter_group_name: string 1279 :param parameter_group_name: The name of a cluster parameter group for 1280 which to return details. 1281 1282 :type source: string 1283 :param source: The parameter types to return. Specify `user` to show 1284 parameters that are different form the default. Similarly, specify 1285 `engine-default` to show parameters that are the same as the 1286 default parameter group. 1287 Default: All parameter types returned. 1288 1289 Valid Values: `user` | `engine-default` 1290 1291 :type max_records: integer 1292 :param max_records: The maximum number of response records to return in 1293 each call. If the number of remaining response records exceeds the 1294 specified `MaxRecords` value, a value is returned in a `marker` 1295 field of the response. You can retrieve the next set of records by 1296 retrying the command with the returned marker value. 1297 Default: `100` 1298 1299 Constraints: minimum 20, maximum 100. 1300 1301 :type marker: string 1302 :param marker: An optional parameter that specifies the starting point 1303 to return a set of response records. When the results of a 1304 DescribeClusterParameters request exceed the value specified in 1305 `MaxRecords`, AWS returns a value in the `Marker` field of the 1306 response. You can retrieve the next set of response records by 1307 providing the returned marker value in the `Marker` parameter and 1308 retrying the request. 1309 1310 """ 1311 params = {'ParameterGroupName': parameter_group_name, } 1312 if source is not None: 1313 params['Source'] = source 1314 if max_records is not None: 1315 params['MaxRecords'] = max_records 1316 if marker is not None: 1317 params['Marker'] = marker 1318 return self._make_request( 1319 action='DescribeClusterParameters', 1320 verb='POST', 1321 path='/', params=params) 1322 1323 def describe_cluster_security_groups(self, 1324 cluster_security_group_name=None, 1325 max_records=None, marker=None): 1326 """ 1327 Returns information about Amazon Redshift security groups. If 1328 the name of a security group is specified, the response will 1329 contain only information about only that security group. 1330 1331 For information about managing security groups, go to `Amazon 1332 Redshift Cluster Security Groups`_ in the Amazon Redshift 1333 Management Guide . 1334 1335 :type cluster_security_group_name: string 1336 :param cluster_security_group_name: The name of a cluster security 1337 group for which you are requesting details. You can specify either 1338 the **Marker** parameter or a **ClusterSecurityGroupName** 1339 parameter, but not both. 1340 Example: `securitygroup1` 1341 1342 :type max_records: integer 1343 :param max_records: The maximum number of response records to return in 1344 each call. If the number of remaining response records exceeds the 1345 specified `MaxRecords` value, a value is returned in a `marker` 1346 field of the response. You can retrieve the next set of records by 1347 retrying the command with the returned marker value. 1348 Default: `100` 1349 1350 Constraints: minimum 20, maximum 100. 1351 1352 :type marker: string 1353 :param marker: An optional parameter that specifies the starting point 1354 to return a set of response records. When the results of a 1355 DescribeClusterSecurityGroups request exceed the value specified in 1356 `MaxRecords`, AWS returns a value in the `Marker` field of the 1357 response. You can retrieve the next set of response records by 1358 providing the returned marker value in the `Marker` parameter and 1359 retrying the request. 1360 Constraints: You can specify either the **ClusterSecurityGroupName** 1361 parameter or the **Marker** parameter, but not both. 1362 1363 """ 1364 params = {} 1365 if cluster_security_group_name is not None: 1366 params['ClusterSecurityGroupName'] = cluster_security_group_name 1367 if max_records is not None: 1368 params['MaxRecords'] = max_records 1369 if marker is not None: 1370 params['Marker'] = marker 1371 return self._make_request( 1372 action='DescribeClusterSecurityGroups', 1373 verb='POST', 1374 path='/', params=params) 1375 1376 def describe_cluster_snapshots(self, cluster_identifier=None, 1377 snapshot_identifier=None, 1378 snapshot_type=None, start_time=None, 1379 end_time=None, max_records=None, 1380 marker=None, owner_account=None): 1381 """ 1382 Returns one or more snapshot objects, which contain metadata 1383 about your cluster snapshots. By default, this operation 1384 returns information about all snapshots of all clusters that 1385 are owned by you AWS customer account. No information is 1386 returned for snapshots owned by inactive AWS customer 1387 accounts. 1388 1389 :type cluster_identifier: string 1390 :param cluster_identifier: The identifier of the cluster for which 1391 information about snapshots is requested. 1392 1393 :type snapshot_identifier: string 1394 :param snapshot_identifier: The snapshot identifier of the snapshot 1395 about which to return information. 1396 1397 :type snapshot_type: string 1398 :param snapshot_type: The type of snapshots for which you are 1399 requesting information. By default, snapshots of all types are 1400 returned. 1401 Valid Values: `automated` | `manual` 1402 1403 :type start_time: timestamp 1404 :param start_time: A value that requests only snapshots created at or 1405 after the specified time. The time value is specified in ISO 8601 1406 format. For more information about ISO 8601, go to the `ISO8601 1407 Wikipedia page.`_ 1408 Example: `2012-07-16T18:00:00Z` 1409 1410 :type end_time: timestamp 1411 :param end_time: A time value that requests only snapshots created at 1412 or before the specified time. The time value is specified in ISO 1413 8601 format. For more information about ISO 8601, go to the 1414 `ISO8601 Wikipedia page.`_ 1415 Example: `2012-07-16T18:00:00Z` 1416 1417 :type max_records: integer 1418 :param max_records: The maximum number of response records to return in 1419 each call. If the number of remaining response records exceeds the 1420 specified `MaxRecords` value, a value is returned in a `marker` 1421 field of the response. You can retrieve the next set of records by 1422 retrying the command with the returned marker value. 1423 Default: `100` 1424 1425 Constraints: minimum 20, maximum 100. 1426 1427 :type marker: string 1428 :param marker: An optional parameter that specifies the starting point 1429 to return a set of response records. When the results of a 1430 DescribeClusterSnapshots request exceed the value specified in 1431 `MaxRecords`, AWS returns a value in the `Marker` field of the 1432 response. You can retrieve the next set of response records by 1433 providing the returned marker value in the `Marker` parameter and 1434 retrying the request. 1435 1436 :type owner_account: string 1437 :param owner_account: The AWS customer account used to create or copy 1438 the snapshot. Use this field to filter the results to snapshots 1439 owned by a particular account. To describe snapshots you own, 1440 either specify your AWS customer account, or do not specify the 1441 parameter. 1442 1443 """ 1444 params = {} 1445 if cluster_identifier is not None: 1446 params['ClusterIdentifier'] = cluster_identifier 1447 if snapshot_identifier is not None: 1448 params['SnapshotIdentifier'] = snapshot_identifier 1449 if snapshot_type is not None: 1450 params['SnapshotType'] = snapshot_type 1451 if start_time is not None: 1452 params['StartTime'] = start_time 1453 if end_time is not None: 1454 params['EndTime'] = end_time 1455 if max_records is not None: 1456 params['MaxRecords'] = max_records 1457 if marker is not None: 1458 params['Marker'] = marker 1459 if owner_account is not None: 1460 params['OwnerAccount'] = owner_account 1461 return self._make_request( 1462 action='DescribeClusterSnapshots', 1463 verb='POST', 1464 path='/', params=params) 1465 1466 def describe_cluster_subnet_groups(self, cluster_subnet_group_name=None, 1467 max_records=None, marker=None): 1468 """ 1469 Returns one or more cluster subnet group objects, which 1470 contain metadata about your cluster subnet groups. By default, 1471 this operation returns information about all cluster subnet 1472 groups that are defined in you AWS account. 1473 1474 :type cluster_subnet_group_name: string 1475 :param cluster_subnet_group_name: The name of the cluster subnet group 1476 for which information is requested. 1477 1478 :type max_records: integer 1479 :param max_records: The maximum number of response records to return in 1480 each call. If the number of remaining response records exceeds the 1481 specified `MaxRecords` value, a value is returned in a `marker` 1482 field of the response. You can retrieve the next set of records by 1483 retrying the command with the returned marker value. 1484 Default: `100` 1485 1486 Constraints: minimum 20, maximum 100. 1487 1488 :type marker: string 1489 :param marker: An optional parameter that specifies the starting point 1490 to return a set of response records. When the results of a 1491 DescribeClusterSubnetGroups request exceed the value specified in 1492 `MaxRecords`, AWS returns a value in the `Marker` field of the 1493 response. You can retrieve the next set of response records by 1494 providing the returned marker value in the `Marker` parameter and 1495 retrying the request. 1496 1497 """ 1498 params = {} 1499 if cluster_subnet_group_name is not None: 1500 params['ClusterSubnetGroupName'] = cluster_subnet_group_name 1501 if max_records is not None: 1502 params['MaxRecords'] = max_records 1503 if marker is not None: 1504 params['Marker'] = marker 1505 return self._make_request( 1506 action='DescribeClusterSubnetGroups', 1507 verb='POST', 1508 path='/', params=params) 1509 1510 def describe_cluster_versions(self, cluster_version=None, 1511 cluster_parameter_group_family=None, 1512 max_records=None, marker=None): 1513 """ 1514 Returns descriptions of the available Amazon Redshift cluster 1515 versions. You can call this operation even before creating any 1516 clusters to learn more about the Amazon Redshift versions. For 1517 more information about managing clusters, go to `Amazon 1518 Redshift Clusters`_ in the Amazon Redshift Management Guide 1519 1520 :type cluster_version: string 1521 :param cluster_version: The specific cluster version to return. 1522 Example: `1.0` 1523 1524 :type cluster_parameter_group_family: string 1525 :param cluster_parameter_group_family: 1526 The name of a specific cluster parameter group family to return details 1527 for. 1528 1529 Constraints: 1530 1531 1532 + Must be 1 to 255 alphanumeric characters 1533 + First character must be a letter 1534 + Cannot end with a hyphen or contain two consecutive hyphens 1535 1536 :type max_records: integer 1537 :param max_records: The maximum number of response records to return in 1538 each call. If the number of remaining response records exceeds the 1539 specified `MaxRecords` value, a value is returned in a `marker` 1540 field of the response. You can retrieve the next set of records by 1541 retrying the command with the returned marker value. 1542 Default: `100` 1543 1544 Constraints: minimum 20, maximum 100. 1545 1546 :type marker: string 1547 :param marker: An optional parameter that specifies the starting point 1548 to return a set of response records. When the results of a 1549 DescribeClusterVersions request exceed the value specified in 1550 `MaxRecords`, AWS returns a value in the `Marker` field of the 1551 response. You can retrieve the next set of response records by 1552 providing the returned marker value in the `Marker` parameter and 1553 retrying the request. 1554 1555 """ 1556 params = {} 1557 if cluster_version is not None: 1558 params['ClusterVersion'] = cluster_version 1559 if cluster_parameter_group_family is not None: 1560 params['ClusterParameterGroupFamily'] = cluster_parameter_group_family 1561 if max_records is not None: 1562 params['MaxRecords'] = max_records 1563 if marker is not None: 1564 params['Marker'] = marker 1565 return self._make_request( 1566 action='DescribeClusterVersions', 1567 verb='POST', 1568 path='/', params=params) 1569 1570 def describe_clusters(self, cluster_identifier=None, max_records=None, 1571 marker=None): 1572 """ 1573 Returns properties of provisioned clusters including general 1574 cluster properties, cluster database properties, maintenance 1575 and backup properties, and security and access properties. 1576 This operation supports pagination. For more information about 1577 managing clusters, go to `Amazon Redshift Clusters`_ in the 1578 Amazon Redshift Management Guide . 1579 1580 :type cluster_identifier: string 1581 :param cluster_identifier: The unique identifier of a cluster whose 1582 properties you are requesting. This parameter is case sensitive. 1583 The default is that all clusters defined for an account are returned. 1584 1585 :type max_records: integer 1586 :param max_records: The maximum number of response records to return in 1587 each call. If the number of remaining response records exceeds the 1588 specified `MaxRecords` value, a value is returned in a `marker` 1589 field of the response. You can retrieve the next set of records by 1590 retrying the command with the returned marker value. 1591 Default: `100` 1592 1593 Constraints: minimum 20, maximum 100. 1594 1595 :type marker: string 1596 :param marker: An optional parameter that specifies the starting point 1597 to return a set of response records. When the results of a 1598 DescribeClusters request exceed the value specified in 1599 `MaxRecords`, AWS returns a value in the `Marker` field of the 1600 response. You can retrieve the next set of response records by 1601 providing the returned marker value in the `Marker` parameter and 1602 retrying the request. 1603 Constraints: You can specify either the **ClusterIdentifier** parameter 1604 or the **Marker** parameter, but not both. 1605 1606 """ 1607 params = {} 1608 if cluster_identifier is not None: 1609 params['ClusterIdentifier'] = cluster_identifier 1610 if max_records is not None: 1611 params['MaxRecords'] = max_records 1612 if marker is not None: 1613 params['Marker'] = marker 1614 return self._make_request( 1615 action='DescribeClusters', 1616 verb='POST', 1617 path='/', params=params) 1618 1619 def describe_default_cluster_parameters(self, parameter_group_family, 1620 max_records=None, marker=None): 1621 """ 1622 Returns a list of parameter settings for the specified 1623 parameter group family. 1624 1625 For more information about managing parameter groups, go to 1626 `Amazon Redshift Parameter Groups`_ in the Amazon Redshift 1627 Management Guide . 1628 1629 :type parameter_group_family: string 1630 :param parameter_group_family: The name of the cluster parameter group 1631 family. 1632 1633 :type max_records: integer 1634 :param max_records: The maximum number of response records to return in 1635 each call. If the number of remaining response records exceeds the 1636 specified `MaxRecords` value, a value is returned in a `marker` 1637 field of the response. You can retrieve the next set of records by 1638 retrying the command with the returned marker value. 1639 Default: `100` 1640 1641 Constraints: minimum 20, maximum 100. 1642 1643 :type marker: string 1644 :param marker: An optional parameter that specifies the starting point 1645 to return a set of response records. When the results of a 1646 DescribeDefaultClusterParameters request exceed the value specified 1647 in `MaxRecords`, AWS returns a value in the `Marker` field of the 1648 response. You can retrieve the next set of response records by 1649 providing the returned marker value in the `Marker` parameter and 1650 retrying the request. 1651 1652 """ 1653 params = {'ParameterGroupFamily': parameter_group_family, } 1654 if max_records is not None: 1655 params['MaxRecords'] = max_records 1656 if marker is not None: 1657 params['Marker'] = marker 1658 return self._make_request( 1659 action='DescribeDefaultClusterParameters', 1660 verb='POST', 1661 path='/', params=params) 1662 1663 def describe_event_categories(self, source_type=None): 1664 """ 1665 Displays a list of event categories for all event source 1666 types, or for a specified source type. For a list of the event 1667 categories and source types, go to `Amazon Redshift Event 1668 Notifications`_. 1669 1670 :type source_type: string 1671 :param source_type: The source type, such as cluster or parameter 1672 group, to which the described event categories apply. 1673 Valid values: cluster, snapshot, parameter group, and security group. 1674 1675 """ 1676 params = {} 1677 if source_type is not None: 1678 params['SourceType'] = source_type 1679 return self._make_request( 1680 action='DescribeEventCategories', 1681 verb='POST', 1682 path='/', params=params) 1683 1684 def describe_event_subscriptions(self, subscription_name=None, 1685 max_records=None, marker=None): 1686 """ 1687 Lists descriptions of all the Amazon Redshift event 1688 notifications subscription for a customer account. If you 1689 specify a subscription name, lists the description for that 1690 subscription. 1691 1692 :type subscription_name: string 1693 :param subscription_name: The name of the Amazon Redshift event 1694 notification subscription to be described. 1695 1696 :type max_records: integer 1697 :param max_records: The maximum number of response records to return in 1698 each call. If the number of remaining response records exceeds the 1699 specified `MaxRecords` value, a value is returned in a `marker` 1700 field of the response. You can retrieve the next set of records by 1701 retrying the command with the returned marker value. 1702 Default: `100` 1703 1704 Constraints: minimum 20, maximum 100. 1705 1706 :type marker: string 1707 :param marker: An optional parameter that specifies the starting point 1708 to return a set of response records. When the results of a 1709 DescribeEventSubscriptions request exceed the value specified in 1710 `MaxRecords`, AWS returns a value in the `Marker` field of the 1711 response. You can retrieve the next set of response records by 1712 providing the returned marker value in the `Marker` parameter and 1713 retrying the request. 1714 1715 """ 1716 params = {} 1717 if subscription_name is not None: 1718 params['SubscriptionName'] = subscription_name 1719 if max_records is not None: 1720 params['MaxRecords'] = max_records 1721 if marker is not None: 1722 params['Marker'] = marker 1723 return self._make_request( 1724 action='DescribeEventSubscriptions', 1725 verb='POST', 1726 path='/', params=params) 1727 1728 def describe_events(self, source_identifier=None, source_type=None, 1729 start_time=None, end_time=None, duration=None, 1730 max_records=None, marker=None): 1731 """ 1732 Returns events related to clusters, security groups, 1733 snapshots, and parameter groups for the past 14 days. Events 1734 specific to a particular cluster, security group, snapshot or 1735 parameter group can be obtained by providing the name as a 1736 parameter. By default, the past hour of events are returned. 1737 1738 :type source_identifier: string 1739 :param source_identifier: 1740 The identifier of the event source for which events will be returned. 1741 If this parameter is not specified, then all sources are included 1742 in the response. 1743 1744 Constraints: 1745 1746 If SourceIdentifier is supplied, SourceType must also be provided. 1747 1748 1749 + Specify a cluster identifier when SourceType is `cluster`. 1750 + Specify a cluster security group name when SourceType is `cluster- 1751 security-group`. 1752 + Specify a cluster parameter group name when SourceType is `cluster- 1753 parameter-group`. 1754 + Specify a cluster snapshot identifier when SourceType is `cluster- 1755 snapshot`. 1756 1757 :type source_type: string 1758 :param source_type: 1759 The event source to retrieve events for. If no value is specified, all 1760 events are returned. 1761 1762 Constraints: 1763 1764 If SourceType is supplied, SourceIdentifier must also be provided. 1765 1766 1767 + Specify `cluster` when SourceIdentifier is a cluster identifier. 1768 + Specify `cluster-security-group` when SourceIdentifier is a cluster 1769 security group name. 1770 + Specify `cluster-parameter-group` when SourceIdentifier is a cluster 1771 parameter group name. 1772 + Specify `cluster-snapshot` when SourceIdentifier is a cluster 1773 snapshot identifier. 1774 1775 :type start_time: timestamp 1776 :param start_time: The beginning of the time interval to retrieve 1777 events for, specified in ISO 8601 format. For more information 1778 about ISO 8601, go to the `ISO8601 Wikipedia page.`_ 1779 Example: `2009-07-08T18:00Z` 1780 1781 :type end_time: timestamp 1782 :param end_time: The end of the time interval for which to retrieve 1783 events, specified in ISO 8601 format. For more information about 1784 ISO 8601, go to the `ISO8601 Wikipedia page.`_ 1785 Example: `2009-07-08T18:00Z` 1786 1787 :type duration: integer 1788 :param duration: The number of minutes prior to the time of the request 1789 for which to retrieve events. For example, if the request is sent 1790 at 18:00 and you specify a duration of 60, then only events which 1791 have occurred after 17:00 will be returned. 1792 Default: `60` 1793 1794 :type max_records: integer 1795 :param max_records: The maximum number of response records to return in 1796 each call. If the number of remaining response records exceeds the 1797 specified `MaxRecords` value, a value is returned in a `marker` 1798 field of the response. You can retrieve the next set of records by 1799 retrying the command with the returned marker value. 1800 Default: `100` 1801 1802 Constraints: minimum 20, maximum 100. 1803 1804 :type marker: string 1805 :param marker: An optional parameter that specifies the starting point 1806 to return a set of response records. When the results of a 1807 DescribeEvents request exceed the value specified in `MaxRecords`, 1808 AWS returns a value in the `Marker` field of the response. You can 1809 retrieve the next set of response records by providing the returned 1810 marker value in the `Marker` parameter and retrying the request. 1811 1812 """ 1813 params = {} 1814 if source_identifier is not None: 1815 params['SourceIdentifier'] = source_identifier 1816 if source_type is not None: 1817 params['SourceType'] = source_type 1818 if start_time is not None: 1819 params['StartTime'] = start_time 1820 if end_time is not None: 1821 params['EndTime'] = end_time 1822 if duration is not None: 1823 params['Duration'] = duration 1824 if max_records is not None: 1825 params['MaxRecords'] = max_records 1826 if marker is not None: 1827 params['Marker'] = marker 1828 return self._make_request( 1829 action='DescribeEvents', 1830 verb='POST', 1831 path='/', params=params) 1832 1833 def describe_hsm_client_certificates(self, 1834 hsm_client_certificate_identifier=None, 1835 max_records=None, marker=None): 1836 """ 1837 Returns information about the specified HSM client 1838 certificate. If no certificate ID is specified, returns 1839 information about all the HSM certificates owned by your AWS 1840 customer account. 1841 1842 :type hsm_client_certificate_identifier: string 1843 :param hsm_client_certificate_identifier: The identifier of a specific 1844 HSM client certificate for which you want information. If no 1845 identifier is specified, information is returned for all HSM client 1846 certificates owned by your AWS customer account. 1847 1848 :type max_records: integer 1849 :param max_records: The maximum number of response records to return in 1850 each call. If the number of remaining response records exceeds the 1851 specified `MaxRecords` value, a value is returned in a `marker` 1852 field of the response. You can retrieve the next set of records by 1853 retrying the command with the returned marker value. 1854 Default: `100` 1855 1856 Constraints: minimum 20, maximum 100. 1857 1858 :type marker: string 1859 :param marker: An optional parameter that specifies the starting point 1860 to return a set of response records. When the results of a 1861 DescribeHsmClientCertificates request exceed the value specified in 1862 `MaxRecords`, AWS returns a value in the `Marker` field of the 1863 response. You can retrieve the next set of response records by 1864 providing the returned marker value in the `Marker` parameter and 1865 retrying the request. 1866 1867 """ 1868 params = {} 1869 if hsm_client_certificate_identifier is not None: 1870 params['HsmClientCertificateIdentifier'] = hsm_client_certificate_identifier 1871 if max_records is not None: 1872 params['MaxRecords'] = max_records 1873 if marker is not None: 1874 params['Marker'] = marker 1875 return self._make_request( 1876 action='DescribeHsmClientCertificates', 1877 verb='POST', 1878 path='/', params=params) 1879 1880 def describe_hsm_configurations(self, hsm_configuration_identifier=None, 1881 max_records=None, marker=None): 1882 """ 1883 Returns information about the specified Amazon Redshift HSM 1884 configuration. If no configuration ID is specified, returns 1885 information about all the HSM configurations owned by your AWS 1886 customer account. 1887 1888 :type hsm_configuration_identifier: string 1889 :param hsm_configuration_identifier: The identifier of a specific 1890 Amazon Redshift HSM configuration to be described. If no identifier 1891 is specified, information is returned for all HSM configurations 1892 owned by your AWS customer account. 1893 1894 :type max_records: integer 1895 :param max_records: The maximum number of response records to return in 1896 each call. If the number of remaining response records exceeds the 1897 specified `MaxRecords` value, a value is returned in a `marker` 1898 field of the response. You can retrieve the next set of records by 1899 retrying the command with the returned marker value. 1900 Default: `100` 1901 1902 Constraints: minimum 20, maximum 100. 1903 1904 :type marker: string 1905 :param marker: An optional parameter that specifies the starting point 1906 to return a set of response records. When the results of a 1907 DescribeHsmConfigurations request exceed the value specified in 1908 `MaxRecords`, AWS returns a value in the `Marker` field of the 1909 response. You can retrieve the next set of response records by 1910 providing the returned marker value in the `Marker` parameter and 1911 retrying the request. 1912 1913 """ 1914 params = {} 1915 if hsm_configuration_identifier is not None: 1916 params['HsmConfigurationIdentifier'] = hsm_configuration_identifier 1917 if max_records is not None: 1918 params['MaxRecords'] = max_records 1919 if marker is not None: 1920 params['Marker'] = marker 1921 return self._make_request( 1922 action='DescribeHsmConfigurations', 1923 verb='POST', 1924 path='/', params=params) 1925 1926 def describe_logging_status(self, cluster_identifier): 1927 """ 1928 Describes whether information, such as queries and connection 1929 attempts, is being logged for the specified Amazon Redshift 1930 cluster. 1931 1932 :type cluster_identifier: string 1933 :param cluster_identifier: The identifier of the cluster to get the 1934 logging status from. 1935 Example: `examplecluster` 1936 1937 """ 1938 params = {'ClusterIdentifier': cluster_identifier, } 1939 return self._make_request( 1940 action='DescribeLoggingStatus', 1941 verb='POST', 1942 path='/', params=params) 1943 1944 def describe_orderable_cluster_options(self, cluster_version=None, 1945 node_type=None, max_records=None, 1946 marker=None): 1947 """ 1948 Returns a list of orderable cluster options. Before you create 1949 a new cluster you can use this operation to find what options 1950 are available, such as the EC2 Availability Zones (AZ) in the 1951 specific AWS region that you can specify, and the node types 1952 you can request. The node types differ by available storage, 1953 memory, CPU and price. With the cost involved you might want 1954 to obtain a list of cluster options in the specific region and 1955 specify values when creating a cluster. For more information 1956 about managing clusters, go to `Amazon Redshift Clusters`_ in 1957 the Amazon Redshift Management Guide 1958 1959 :type cluster_version: string 1960 :param cluster_version: The version filter value. Specify this 1961 parameter to show only the available offerings matching the 1962 specified version. 1963 Default: All versions. 1964 1965 Constraints: Must be one of the version returned from 1966 DescribeClusterVersions. 1967 1968 :type node_type: string 1969 :param node_type: The node type filter value. Specify this parameter to 1970 show only the available offerings matching the specified node type. 1971 1972 :type max_records: integer 1973 :param max_records: The maximum number of response records to return in 1974 each call. If the number of remaining response records exceeds the 1975 specified `MaxRecords` value, a value is returned in a `marker` 1976 field of the response. You can retrieve the next set of records by 1977 retrying the command with the returned marker value. 1978 Default: `100` 1979 1980 Constraints: minimum 20, maximum 100. 1981 1982 :type marker: string 1983 :param marker: An optional parameter that specifies the starting point 1984 to return a set of response records. When the results of a 1985 DescribeOrderableClusterOptions request exceed the value specified 1986 in `MaxRecords`, AWS returns a value in the `Marker` field of the 1987 response. You can retrieve the next set of response records by 1988 providing the returned marker value in the `Marker` parameter and 1989 retrying the request. 1990 1991 """ 1992 params = {} 1993 if cluster_version is not None: 1994 params['ClusterVersion'] = cluster_version 1995 if node_type is not None: 1996 params['NodeType'] = node_type 1997 if max_records is not None: 1998 params['MaxRecords'] = max_records 1999 if marker is not None: 2000 params['Marker'] = marker 2001 return self._make_request( 2002 action='DescribeOrderableClusterOptions', 2003 verb='POST', 2004 path='/', params=params) 2005 2006 def describe_reserved_node_offerings(self, 2007 reserved_node_offering_id=None, 2008 max_records=None, marker=None): 2009 """ 2010 Returns a list of the available reserved node offerings by 2011 Amazon Redshift with their descriptions including the node 2012 type, the fixed and recurring costs of reserving the node and 2013 duration the node will be reserved for you. These descriptions 2014 help you determine which reserve node offering you want to 2015 purchase. You then use the unique offering ID in you call to 2016 PurchaseReservedNodeOffering to reserve one or more nodes for 2017 your Amazon Redshift cluster. 2018 2019 For more information about managing parameter groups, go to 2020 `Purchasing Reserved Nodes`_ in the Amazon Redshift Management 2021 Guide . 2022 2023 :type reserved_node_offering_id: string 2024 :param reserved_node_offering_id: The unique identifier for the 2025 offering. 2026 2027 :type max_records: integer 2028 :param max_records: The maximum number of response records to return in 2029 each call. If the number of remaining response records exceeds the 2030 specified `MaxRecords` value, a value is returned in a `marker` 2031 field of the response. You can retrieve the next set of records by 2032 retrying the command with the returned marker value. 2033 Default: `100` 2034 2035 Constraints: minimum 20, maximum 100. 2036 2037 :type marker: string 2038 :param marker: An optional parameter that specifies the starting point 2039 to return a set of response records. When the results of a 2040 DescribeReservedNodeOfferings request exceed the value specified in 2041 `MaxRecords`, AWS returns a value in the `Marker` field of the 2042 response. You can retrieve the next set of response records by 2043 providing the returned marker value in the `Marker` parameter and 2044 retrying the request. 2045 2046 """ 2047 params = {} 2048 if reserved_node_offering_id is not None: 2049 params['ReservedNodeOfferingId'] = reserved_node_offering_id 2050 if max_records is not None: 2051 params['MaxRecords'] = max_records 2052 if marker is not None: 2053 params['Marker'] = marker 2054 return self._make_request( 2055 action='DescribeReservedNodeOfferings', 2056 verb='POST', 2057 path='/', params=params) 2058 2059 def describe_reserved_nodes(self, reserved_node_id=None, 2060 max_records=None, marker=None): 2061 """ 2062 Returns the descriptions of the reserved nodes. 2063 2064 :type reserved_node_id: string 2065 :param reserved_node_id: Identifier for the node reservation. 2066 2067 :type max_records: integer 2068 :param max_records: The maximum number of response records to return in 2069 each call. If the number of remaining response records exceeds the 2070 specified `MaxRecords` value, a value is returned in a `marker` 2071 field of the response. You can retrieve the next set of records by 2072 retrying the command with the returned marker value. 2073 Default: `100` 2074 2075 Constraints: minimum 20, maximum 100. 2076 2077 :type marker: string 2078 :param marker: An optional parameter that specifies the starting point 2079 to return a set of response records. When the results of a 2080 DescribeReservedNodes request exceed the value specified in 2081 `MaxRecords`, AWS returns a value in the `Marker` field of the 2082 response. You can retrieve the next set of response records by 2083 providing the returned marker value in the `Marker` parameter and 2084 retrying the request. 2085 2086 """ 2087 params = {} 2088 if reserved_node_id is not None: 2089 params['ReservedNodeId'] = reserved_node_id 2090 if max_records is not None: 2091 params['MaxRecords'] = max_records 2092 if marker is not None: 2093 params['Marker'] = marker 2094 return self._make_request( 2095 action='DescribeReservedNodes', 2096 verb='POST', 2097 path='/', params=params) 2098 2099 def describe_resize(self, cluster_identifier): 2100 """ 2101 Returns information about the last resize operation for the 2102 specified cluster. If no resize operation has ever been 2103 initiated for the specified cluster, a `HTTP 404` error is 2104 returned. If a resize operation was initiated and completed, 2105 the status of the resize remains as `SUCCEEDED` until the next 2106 resize. 2107 2108 A resize operation can be requested using ModifyCluster and 2109 specifying a different number or type of nodes for the 2110 cluster. 2111 2112 :type cluster_identifier: string 2113 :param cluster_identifier: The unique identifier of a cluster whose 2114 resize progress you are requesting. This parameter isn't case- 2115 sensitive. 2116 By default, resize operations for all clusters defined for an AWS 2117 account are returned. 2118 2119 """ 2120 params = {'ClusterIdentifier': cluster_identifier, } 2121 return self._make_request( 2122 action='DescribeResize', 2123 verb='POST', 2124 path='/', params=params) 2125 2126 def disable_logging(self, cluster_identifier): 2127 """ 2128 Stops logging information, such as queries and connection 2129 attempts, for the specified Amazon Redshift cluster. 2130 2131 :type cluster_identifier: string 2132 :param cluster_identifier: The identifier of the cluster on which 2133 logging is to be stopped. 2134 Example: `examplecluster` 2135 2136 """ 2137 params = {'ClusterIdentifier': cluster_identifier, } 2138 return self._make_request( 2139 action='DisableLogging', 2140 verb='POST', 2141 path='/', params=params) 2142 2143 def disable_snapshot_copy(self, cluster_identifier): 2144 """ 2145 Disables the automatic copying of snapshots from one region to 2146 another region for a specified cluster. 2147 2148 :type cluster_identifier: string 2149 :param cluster_identifier: The unique identifier of the source cluster 2150 that you want to disable copying of snapshots to a destination 2151 region. 2152 Constraints: Must be the valid name of an existing cluster that has 2153 cross-region snapshot copy enabled. 2154 2155 """ 2156 params = {'ClusterIdentifier': cluster_identifier, } 2157 return self._make_request( 2158 action='DisableSnapshotCopy', 2159 verb='POST', 2160 path='/', params=params) 2161 2162 def enable_logging(self, cluster_identifier, bucket_name, 2163 s3_key_prefix=None): 2164 """ 2165 Starts logging information, such as queries and connection 2166 attempts, for the specified Amazon Redshift cluster. 2167 2168 :type cluster_identifier: string 2169 :param cluster_identifier: The identifier of the cluster on which 2170 logging is to be started. 2171 Example: `examplecluster` 2172 2173 :type bucket_name: string 2174 :param bucket_name: 2175 The name of an existing S3 bucket where the log files are to be stored. 2176 2177 Constraints: 2178 2179 2180 + Must be in the same region as the cluster 2181 + The cluster must have read bucket and put object permissions 2182 2183 :type s3_key_prefix: string 2184 :param s3_key_prefix: 2185 The prefix applied to the log file names. 2186 2187 Constraints: 2188 2189 2190 + Cannot exceed 512 characters 2191 + Cannot contain spaces( ), double quotes ("), single quotes ('), a 2192 backslash (\), or control characters. The hexadecimal codes for 2193 invalid characters are: 2194 2195 + x00 to x20 2196 + x22 2197 + x27 2198 + x5c 2199 + x7f or larger 2200 2201 """ 2202 params = { 2203 'ClusterIdentifier': cluster_identifier, 2204 'BucketName': bucket_name, 2205 } 2206 if s3_key_prefix is not None: 2207 params['S3KeyPrefix'] = s3_key_prefix 2208 return self._make_request( 2209 action='EnableLogging', 2210 verb='POST', 2211 path='/', params=params) 2212 2213 def enable_snapshot_copy(self, cluster_identifier, destination_region, 2214 retention_period=None): 2215 """ 2216 Enables the automatic copy of snapshots from one region to 2217 another region for a specified cluster. 2218 2219 :type cluster_identifier: string 2220 :param cluster_identifier: The unique identifier of the source cluster 2221 to copy snapshots from. 2222 Constraints: Must be the valid name of an existing cluster that does 2223 not already have cross-region snapshot copy enabled. 2224 2225 :type destination_region: string 2226 :param destination_region: The destination region that you want to copy 2227 snapshots to. 2228 Constraints: Must be the name of a valid region. For more information, 2229 see `Regions and Endpoints`_ in the Amazon Web Services General 2230 Reference. 2231 2232 :type retention_period: integer 2233 :param retention_period: The number of days to retain automated 2234 snapshots in the destination region after they are copied from the 2235 source region. 2236 Default: 7. 2237 2238 Constraints: Must be at least 1 and no more than 35. 2239 2240 """ 2241 params = { 2242 'ClusterIdentifier': cluster_identifier, 2243 'DestinationRegion': destination_region, 2244 } 2245 if retention_period is not None: 2246 params['RetentionPeriod'] = retention_period 2247 return self._make_request( 2248 action='EnableSnapshotCopy', 2249 verb='POST', 2250 path='/', params=params) 2251 2252 def modify_cluster(self, cluster_identifier, cluster_type=None, 2253 node_type=None, number_of_nodes=None, 2254 cluster_security_groups=None, 2255 vpc_security_group_ids=None, 2256 master_user_password=None, 2257 cluster_parameter_group_name=None, 2258 automated_snapshot_retention_period=None, 2259 preferred_maintenance_window=None, 2260 cluster_version=None, allow_version_upgrade=None, 2261 hsm_client_certificate_identifier=None, 2262 hsm_configuration_identifier=None, 2263 new_cluster_identifier=None): 2264 """ 2265 Modifies the settings for a cluster. For example, you can add 2266 another security or parameter group, update the preferred 2267 maintenance window, or change the master user password. 2268 Resetting a cluster password or modifying the security groups 2269 associated with a cluster do not need a reboot. However, 2270 modifying a parameter group requires a reboot for parameters 2271 to take effect. For more information about managing clusters, 2272 go to `Amazon Redshift Clusters`_ in the Amazon Redshift 2273 Management Guide 2274 2275 You can also change node type and the number of nodes to scale 2276 up or down the cluster. When resizing a cluster, you must 2277 specify both the number of nodes and the node type even if one 2278 of the parameters does not change. If you specify the same 2279 number of nodes and node type that are already configured for 2280 the cluster, an error is returned. 2281 2282 :type cluster_identifier: string 2283 :param cluster_identifier: The unique identifier of the cluster to be 2284 modified. 2285 Example: `examplecluster` 2286 2287 :type cluster_type: string 2288 :param cluster_type: The new cluster type. 2289 When you submit your cluster resize request, your existing cluster goes 2290 into a read-only mode. After Amazon Redshift provisions a new 2291 cluster based on your resize requirements, there will be outage for 2292 a period while the old cluster is deleted and your connection is 2293 switched to the new cluster. You can use DescribeResize to track 2294 the progress of the resize request. 2295 2296 Valid Values: ` multi-node | single-node ` 2297 2298 :type node_type: string 2299 :param node_type: The new node type of the cluster. If you specify a 2300 new node type, you must also specify the number of nodes parameter 2301 also. 2302 When you submit your request to resize a cluster, Amazon Redshift sets 2303 access permissions for the cluster to read-only. After Amazon 2304 Redshift provisions a new cluster according to your resize 2305 requirements, there will be a temporary outage while the old 2306 cluster is deleted and your connection is switched to the new 2307 cluster. When the new connection is complete, the original access 2308 permissions for the cluster are restored. You can use the 2309 DescribeResize to track the progress of the resize request. 2310 2311 Valid Values: ` dw1.xlarge` | `dw1.8xlarge` | `dw2.large` | 2312 `dw2.8xlarge`. 2313 2314 :type number_of_nodes: integer 2315 :param number_of_nodes: The new number of nodes of the cluster. If you 2316 specify a new number of nodes, you must also specify the node type 2317 parameter also. 2318 When you submit your request to resize a cluster, Amazon Redshift sets 2319 access permissions for the cluster to read-only. After Amazon 2320 Redshift provisions a new cluster according to your resize 2321 requirements, there will be a temporary outage while the old 2322 cluster is deleted and your connection is switched to the new 2323 cluster. When the new connection is complete, the original access 2324 permissions for the cluster are restored. You can use 2325 DescribeResize to track the progress of the resize request. 2326 2327 Valid Values: Integer greater than `0`. 2328 2329 :type cluster_security_groups: list 2330 :param cluster_security_groups: 2331 A list of cluster security groups to be authorized on this cluster. 2332 This change is asynchronously applied as soon as possible. 2333 2334 Security groups currently associated with the cluster, and not in the 2335 list of groups to apply, will be revoked from the cluster. 2336 2337 Constraints: 2338 2339 2340 + Must be 1 to 255 alphanumeric characters or hyphens 2341 + First character must be a letter 2342 + Cannot end with a hyphen or contain two consecutive hyphens 2343 2344 :type vpc_security_group_ids: list 2345 :param vpc_security_group_ids: A list of virtual private cloud (VPC) 2346 security groups to be associated with the cluster. 2347 2348 :type master_user_password: string 2349 :param master_user_password: 2350 The new password for the cluster master user. This change is 2351 asynchronously applied as soon as possible. Between the time of the 2352 request and the completion of the request, the `MasterUserPassword` 2353 element exists in the `PendingModifiedValues` element of the 2354 operation response. 2355 2356 Default: Uses existing setting. 2357 2358 Constraints: 2359 2360 2361 + Must be between 8 and 64 characters in length. 2362 + Must contain at least one uppercase letter. 2363 + Must contain at least one lowercase letter. 2364 + Must contain one number. 2365 + Can be any printable ASCII character (ASCII code 33 to 126) except ' 2366 (single quote), " (double quote), \, /, @, or space. 2367 2368 :type cluster_parameter_group_name: string 2369 :param cluster_parameter_group_name: The name of the cluster parameter 2370 group to apply to this cluster. This change is applied only after 2371 the cluster is rebooted. To reboot a cluster use RebootCluster. 2372 Default: Uses existing setting. 2373 2374 Constraints: The cluster parameter group must be in the same parameter 2375 group family that matches the cluster version. 2376 2377 :type automated_snapshot_retention_period: integer 2378 :param automated_snapshot_retention_period: The number of days that 2379 automated snapshots are retained. If the value is 0, automated 2380 snapshots are disabled. Even if automated snapshots are disabled, 2381 you can still create manual snapshots when you want with 2382 CreateClusterSnapshot. 2383 If you decrease the automated snapshot retention period from its 2384 current value, existing automated snapshots that fall outside of 2385 the new retention period will be immediately deleted. 2386 2387 Default: Uses existing setting. 2388 2389 Constraints: Must be a value from 0 to 35. 2390 2391 :type preferred_maintenance_window: string 2392 :param preferred_maintenance_window: The weekly time range (in UTC) 2393 during which system maintenance can occur, if necessary. If system 2394 maintenance is necessary during the window, it may result in an 2395 outage. 2396 This maintenance window change is made immediately. If the new 2397 maintenance window indicates the current time, there must be at 2398 least 120 minutes between the current time and end of the window in 2399 order to ensure that pending changes are applied. 2400 2401 Default: Uses existing setting. 2402 2403 Format: ddd:hh24:mi-ddd:hh24:mi, for example `wed:07:30-wed:08:00`. 2404 2405 Valid Days: Mon | Tue | Wed | Thu | Fri | Sat | Sun 2406 2407 Constraints: Must be at least 30 minutes. 2408 2409 :type cluster_version: string 2410 :param cluster_version: The new version number of the Amazon Redshift 2411 engine to upgrade to. 2412 For major version upgrades, if a non-default cluster parameter group is 2413 currently in use, a new cluster parameter group in the cluster 2414 parameter group family for the new version must be specified. The 2415 new cluster parameter group can be the default for that cluster 2416 parameter group family. For more information about managing 2417 parameter groups, go to `Amazon Redshift Parameter Groups`_ in the 2418 Amazon Redshift Management Guide . 2419 2420 Example: `1.0` 2421 2422 :type allow_version_upgrade: boolean 2423 :param allow_version_upgrade: If `True`, upgrades will be applied 2424 automatically to the cluster during the maintenance window. 2425 Default: `False` 2426 2427 :type hsm_client_certificate_identifier: string 2428 :param hsm_client_certificate_identifier: Specifies the name of the HSM 2429 client certificate the Amazon Redshift cluster uses to retrieve the 2430 data encryption keys stored in an HSM. 2431 2432 :type hsm_configuration_identifier: string 2433 :param hsm_configuration_identifier: Specifies the name of the HSM 2434 configuration that contains the information the Amazon Redshift 2435 cluster can use to retrieve and store keys in an HSM. 2436 2437 :type new_cluster_identifier: string 2438 :param new_cluster_identifier: The new identifier for the cluster. 2439 Constraints: 2440 2441 2442 + Must contain from 1 to 63 alphanumeric characters or hyphens. 2443 + Alphabetic characters must be lowercase. 2444 + First character must be a letter. 2445 + Cannot end with a hyphen or contain two consecutive hyphens. 2446 + Must be unique for all clusters within an AWS account. 2447 2448 2449 Example: `examplecluster` 2450 2451 """ 2452 params = {'ClusterIdentifier': cluster_identifier, } 2453 if cluster_type is not None: 2454 params['ClusterType'] = cluster_type 2455 if node_type is not None: 2456 params['NodeType'] = node_type 2457 if number_of_nodes is not None: 2458 params['NumberOfNodes'] = number_of_nodes 2459 if cluster_security_groups is not None: 2460 self.build_list_params(params, 2461 cluster_security_groups, 2462 'ClusterSecurityGroups.member') 2463 if vpc_security_group_ids is not None: 2464 self.build_list_params(params, 2465 vpc_security_group_ids, 2466 'VpcSecurityGroupIds.member') 2467 if master_user_password is not None: 2468 params['MasterUserPassword'] = master_user_password 2469 if cluster_parameter_group_name is not None: 2470 params['ClusterParameterGroupName'] = cluster_parameter_group_name 2471 if automated_snapshot_retention_period is not None: 2472 params['AutomatedSnapshotRetentionPeriod'] = automated_snapshot_retention_period 2473 if preferred_maintenance_window is not None: 2474 params['PreferredMaintenanceWindow'] = preferred_maintenance_window 2475 if cluster_version is not None: 2476 params['ClusterVersion'] = cluster_version 2477 if allow_version_upgrade is not None: 2478 params['AllowVersionUpgrade'] = str( 2479 allow_version_upgrade).lower() 2480 if hsm_client_certificate_identifier is not None: 2481 params['HsmClientCertificateIdentifier'] = hsm_client_certificate_identifier 2482 if hsm_configuration_identifier is not None: 2483 params['HsmConfigurationIdentifier'] = hsm_configuration_identifier 2484 if new_cluster_identifier is not None: 2485 params['NewClusterIdentifier'] = new_cluster_identifier 2486 return self._make_request( 2487 action='ModifyCluster', 2488 verb='POST', 2489 path='/', params=params) 2490 2491 def modify_cluster_parameter_group(self, parameter_group_name, 2492 parameters): 2493 """ 2494 Modifies the parameters of a parameter group. 2495 2496 For more information about managing parameter groups, go to 2497 `Amazon Redshift Parameter Groups`_ in the Amazon Redshift 2498 Management Guide . 2499 2500 :type parameter_group_name: string 2501 :param parameter_group_name: The name of the parameter group to be 2502 modified. 2503 2504 :type parameters: list 2505 :param parameters: An array of parameters to be modified. A maximum of 2506 20 parameters can be modified in a single request. 2507 For each parameter to be modified, you must supply at least the 2508 parameter name and parameter value; other name-value pairs of the 2509 parameter are optional. 2510 2511 For the workload management (WLM) configuration, you must supply all 2512 the name-value pairs in the wlm_json_configuration parameter. 2513 2514 """ 2515 params = {'ParameterGroupName': parameter_group_name, } 2516 self.build_complex_list_params( 2517 params, parameters, 2518 'Parameters.member', 2519 ('ParameterName', 'ParameterValue', 'Description', 'Source', 'DataType', 'AllowedValues', 'IsModifiable', 'MinimumEngineVersion')) 2520 return self._make_request( 2521 action='ModifyClusterParameterGroup', 2522 verb='POST', 2523 path='/', params=params) 2524 2525 def modify_cluster_subnet_group(self, cluster_subnet_group_name, 2526 subnet_ids, description=None): 2527 """ 2528 Modifies a cluster subnet group to include the specified list 2529 of VPC subnets. The operation replaces the existing list of 2530 subnets with the new list of subnets. 2531 2532 :type cluster_subnet_group_name: string 2533 :param cluster_subnet_group_name: The name of the subnet group to be 2534 modified. 2535 2536 :type description: string 2537 :param description: A text description of the subnet group to be 2538 modified. 2539 2540 :type subnet_ids: list 2541 :param subnet_ids: An array of VPC subnet IDs. A maximum of 20 subnets 2542 can be modified in a single request. 2543 2544 """ 2545 params = { 2546 'ClusterSubnetGroupName': cluster_subnet_group_name, 2547 } 2548 self.build_list_params(params, 2549 subnet_ids, 2550 'SubnetIds.member') 2551 if description is not None: 2552 params['Description'] = description 2553 return self._make_request( 2554 action='ModifyClusterSubnetGroup', 2555 verb='POST', 2556 path='/', params=params) 2557 2558 def modify_event_subscription(self, subscription_name, 2559 sns_topic_arn=None, source_type=None, 2560 source_ids=None, event_categories=None, 2561 severity=None, enabled=None): 2562 """ 2563 Modifies an existing Amazon Redshift event notification 2564 subscription. 2565 2566 :type subscription_name: string 2567 :param subscription_name: The name of the modified Amazon Redshift 2568 event notification subscription. 2569 2570 :type sns_topic_arn: string 2571 :param sns_topic_arn: The Amazon Resource Name (ARN) of the SNS topic 2572 to be used by the event notification subscription. 2573 2574 :type source_type: string 2575 :param source_type: The type of source that will be generating the 2576 events. For example, if you want to be notified of events generated 2577 by a cluster, you would set this parameter to cluster. If this 2578 value is not specified, events are returned for all Amazon Redshift 2579 objects in your AWS account. You must specify a source type in 2580 order to specify source IDs. 2581 Valid values: cluster, cluster-parameter-group, cluster-security-group, 2582 and cluster-snapshot. 2583 2584 :type source_ids: list 2585 :param source_ids: A list of one or more identifiers of Amazon Redshift 2586 source objects. All of the objects must be of the same type as was 2587 specified in the source type parameter. The event subscription will 2588 return only events generated by the specified objects. If not 2589 specified, then events are returned for all objects within the 2590 source type specified. 2591 Example: my-cluster-1, my-cluster-2 2592 2593 Example: my-snapshot-20131010 2594 2595 :type event_categories: list 2596 :param event_categories: Specifies the Amazon Redshift event categories 2597 to be published by the event notification subscription. 2598 Values: Configuration, Management, Monitoring, Security 2599 2600 :type severity: string 2601 :param severity: Specifies the Amazon Redshift event severity to be 2602 published by the event notification subscription. 2603 Values: ERROR, INFO 2604 2605 :type enabled: boolean 2606 :param enabled: A Boolean value indicating if the subscription is 2607 enabled. `True` indicates the subscription is enabled 2608 2609 """ 2610 params = {'SubscriptionName': subscription_name, } 2611 if sns_topic_arn is not None: 2612 params['SnsTopicArn'] = sns_topic_arn 2613 if source_type is not None: 2614 params['SourceType'] = source_type 2615 if source_ids is not None: 2616 self.build_list_params(params, 2617 source_ids, 2618 'SourceIds.member') 2619 if event_categories is not None: 2620 self.build_list_params(params, 2621 event_categories, 2622 'EventCategories.member') 2623 if severity is not None: 2624 params['Severity'] = severity 2625 if enabled is not None: 2626 params['Enabled'] = str( 2627 enabled).lower() 2628 return self._make_request( 2629 action='ModifyEventSubscription', 2630 verb='POST', 2631 path='/', params=params) 2632 2633 def modify_snapshot_copy_retention_period(self, cluster_identifier, 2634 retention_period): 2635 """ 2636 Modifies the number of days to retain automated snapshots in 2637 the destination region after they are copied from the source 2638 region. 2639 2640 :type cluster_identifier: string 2641 :param cluster_identifier: The unique identifier of the cluster for 2642 which you want to change the retention period for automated 2643 snapshots that are copied to a destination region. 2644 Constraints: Must be the valid name of an existing cluster that has 2645 cross-region snapshot copy enabled. 2646 2647 :type retention_period: integer 2648 :param retention_period: The number of days to retain automated 2649 snapshots in the destination region after they are copied from the 2650 source region. 2651 If you decrease the retention period for automated snapshots that are 2652 copied to a destination region, Amazon Redshift will delete any 2653 existing automated snapshots that were copied to the destination 2654 region and that fall outside of the new retention period. 2655 2656 Constraints: Must be at least 1 and no more than 35. 2657 2658 """ 2659 params = { 2660 'ClusterIdentifier': cluster_identifier, 2661 'RetentionPeriod': retention_period, 2662 } 2663 return self._make_request( 2664 action='ModifySnapshotCopyRetentionPeriod', 2665 verb='POST', 2666 path='/', params=params) 2667 2668 def purchase_reserved_node_offering(self, reserved_node_offering_id, 2669 node_count=None): 2670 """ 2671 Allows you to purchase reserved nodes. Amazon Redshift offers 2672 a predefined set of reserved node offerings. You can purchase 2673 one of the offerings. You can call the 2674 DescribeReservedNodeOfferings API to obtain the available 2675 reserved node offerings. You can call this API by providing a 2676 specific reserved node offering and the number of nodes you 2677 want to reserve. 2678 2679 For more information about managing parameter groups, go to 2680 `Purchasing Reserved Nodes`_ in the Amazon Redshift Management 2681 Guide . 2682 2683 :type reserved_node_offering_id: string 2684 :param reserved_node_offering_id: The unique identifier of the reserved 2685 node offering you want to purchase. 2686 2687 :type node_count: integer 2688 :param node_count: The number of reserved nodes you want to purchase. 2689 Default: `1` 2690 2691 """ 2692 params = { 2693 'ReservedNodeOfferingId': reserved_node_offering_id, 2694 } 2695 if node_count is not None: 2696 params['NodeCount'] = node_count 2697 return self._make_request( 2698 action='PurchaseReservedNodeOffering', 2699 verb='POST', 2700 path='/', params=params) 2701 2702 def reboot_cluster(self, cluster_identifier): 2703 """ 2704 Reboots a cluster. This action is taken as soon as possible. 2705 It results in a momentary outage to the cluster, during which 2706 the cluster status is set to `rebooting`. A cluster event is 2707 created when the reboot is completed. Any pending cluster 2708 modifications (see ModifyCluster) are applied at this reboot. 2709 For more information about managing clusters, go to `Amazon 2710 Redshift Clusters`_ in the Amazon Redshift Management Guide 2711 2712 :type cluster_identifier: string 2713 :param cluster_identifier: The cluster identifier. 2714 2715 """ 2716 params = {'ClusterIdentifier': cluster_identifier, } 2717 return self._make_request( 2718 action='RebootCluster', 2719 verb='POST', 2720 path='/', params=params) 2721 2722 def reset_cluster_parameter_group(self, parameter_group_name, 2723 reset_all_parameters=None, 2724 parameters=None): 2725 """ 2726 Sets one or more parameters of the specified parameter group 2727 to their default values and sets the source values of the 2728 parameters to "engine-default". To reset the entire parameter 2729 group specify the ResetAllParameters parameter. For parameter 2730 changes to take effect you must reboot any associated 2731 clusters. 2732 2733 :type parameter_group_name: string 2734 :param parameter_group_name: The name of the cluster parameter group to 2735 be reset. 2736 2737 :type reset_all_parameters: boolean 2738 :param reset_all_parameters: If `True`, all parameters in the specified 2739 parameter group will be reset to their default values. 2740 Default: `True` 2741 2742 :type parameters: list 2743 :param parameters: An array of names of parameters to be reset. If 2744 ResetAllParameters option is not used, then at least one parameter 2745 name must be supplied. 2746 Constraints: A maximum of 20 parameters can be reset in a single 2747 request. 2748 2749 """ 2750 params = {'ParameterGroupName': parameter_group_name, } 2751 if reset_all_parameters is not None: 2752 params['ResetAllParameters'] = str( 2753 reset_all_parameters).lower() 2754 if parameters is not None: 2755 self.build_complex_list_params( 2756 params, parameters, 2757 'Parameters.member', 2758 ('ParameterName', 'ParameterValue', 'Description', 'Source', 'DataType', 'AllowedValues', 'IsModifiable', 'MinimumEngineVersion')) 2759 return self._make_request( 2760 action='ResetClusterParameterGroup', 2761 verb='POST', 2762 path='/', params=params) 2763 2764 def restore_from_cluster_snapshot(self, cluster_identifier, 2765 snapshot_identifier, 2766 snapshot_cluster_identifier=None, 2767 port=None, availability_zone=None, 2768 allow_version_upgrade=None, 2769 cluster_subnet_group_name=None, 2770 publicly_accessible=None, 2771 owner_account=None, 2772 hsm_client_certificate_identifier=None, 2773 hsm_configuration_identifier=None, 2774 elastic_ip=None, 2775 cluster_parameter_group_name=None, 2776 cluster_security_groups=None, 2777 vpc_security_group_ids=None, 2778 preferred_maintenance_window=None, 2779 automated_snapshot_retention_period=None): 2780 """ 2781 Creates a new cluster from a snapshot. Amazon Redshift creates 2782 the resulting cluster with the same configuration as the 2783 original cluster from which the snapshot was created, except 2784 that the new cluster is created with the default cluster 2785 security and parameter group. After Amazon Redshift creates 2786 the cluster you can use the ModifyCluster API to associate a 2787 different security group and different parameter group with 2788 the restored cluster. 2789 2790 If you restore a cluster into a VPC, you must provide a 2791 cluster subnet group where you want the cluster restored. 2792 2793 For more information about working with snapshots, go to 2794 `Amazon Redshift Snapshots`_ in the Amazon Redshift Management 2795 Guide . 2796 2797 :type cluster_identifier: string 2798 :param cluster_identifier: The identifier of the cluster that will be 2799 created from restoring the snapshot. 2800 2801 Constraints: 2802 2803 2804 + Must contain from 1 to 63 alphanumeric characters or hyphens. 2805 + Alphabetic characters must be lowercase. 2806 + First character must be a letter. 2807 + Cannot end with a hyphen or contain two consecutive hyphens. 2808 + Must be unique for all clusters within an AWS account. 2809 2810 :type snapshot_identifier: string 2811 :param snapshot_identifier: The name of the snapshot from which to 2812 create the new cluster. This parameter isn't case sensitive. 2813 Example: `my-snapshot-id` 2814 2815 :type snapshot_cluster_identifier: string 2816 :param snapshot_cluster_identifier: The name of the cluster the source 2817 snapshot was created from. This parameter is required if your IAM 2818 user has a policy containing a snapshot resource element that 2819 specifies anything other than * for the cluster name. 2820 2821 :type port: integer 2822 :param port: The port number on which the cluster accepts connections. 2823 Default: The same port as the original cluster. 2824 2825 Constraints: Must be between `1115` and `65535`. 2826 2827 :type availability_zone: string 2828 :param availability_zone: The Amazon EC2 Availability Zone in which to 2829 restore the cluster. 2830 Default: A random, system-chosen Availability Zone. 2831 2832 Example: `us-east-1a` 2833 2834 :type allow_version_upgrade: boolean 2835 :param allow_version_upgrade: If `True`, upgrades can be applied during 2836 the maintenance window to the Amazon Redshift engine that is 2837 running on the cluster. 2838 Default: `True` 2839 2840 :type cluster_subnet_group_name: string 2841 :param cluster_subnet_group_name: The name of the subnet group where 2842 you want to cluster restored. 2843 A snapshot of cluster in VPC can be restored only in VPC. Therefore, 2844 you must provide subnet group name where you want the cluster 2845 restored. 2846 2847 :type publicly_accessible: boolean 2848 :param publicly_accessible: If `True`, the cluster can be accessed from 2849 a public network. 2850 2851 :type owner_account: string 2852 :param owner_account: The AWS customer account used to create or copy 2853 the snapshot. Required if you are restoring a snapshot you do not 2854 own, optional if you own the snapshot. 2855 2856 :type hsm_client_certificate_identifier: string 2857 :param hsm_client_certificate_identifier: Specifies the name of the HSM 2858 client certificate the Amazon Redshift cluster uses to retrieve the 2859 data encryption keys stored in an HSM. 2860 2861 :type hsm_configuration_identifier: string 2862 :param hsm_configuration_identifier: Specifies the name of the HSM 2863 configuration that contains the information the Amazon Redshift 2864 cluster can use to retrieve and store keys in an HSM. 2865 2866 :type elastic_ip: string 2867 :param elastic_ip: The elastic IP (EIP) address for the cluster. 2868 2869 :type cluster_parameter_group_name: string 2870 :param cluster_parameter_group_name: 2871 The name of the parameter group to be associated with this cluster. 2872 2873 Default: The default Amazon Redshift cluster parameter group. For 2874 information about the default parameter group, go to `Working with 2875 Amazon Redshift Parameter Groups`_. 2876 2877 Constraints: 2878 2879 2880 + Must be 1 to 255 alphanumeric characters or hyphens. 2881 + First character must be a letter. 2882 + Cannot end with a hyphen or contain two consecutive hyphens. 2883 2884 :type cluster_security_groups: list 2885 :param cluster_security_groups: A list of security groups to be 2886 associated with this cluster. 2887 Default: The default cluster security group for Amazon Redshift. 2888 2889 Cluster security groups only apply to clusters outside of VPCs. 2890 2891 :type vpc_security_group_ids: list 2892 :param vpc_security_group_ids: A list of Virtual Private Cloud (VPC) 2893 security groups to be associated with the cluster. 2894 Default: The default VPC security group is associated with the cluster. 2895 2896 VPC security groups only apply to clusters in VPCs. 2897 2898 :type preferred_maintenance_window: string 2899 :param preferred_maintenance_window: The weekly time range (in UTC) 2900 during which automated cluster maintenance can occur. 2901 Format: `ddd:hh24:mi-ddd:hh24:mi` 2902 2903 Default: The value selected for the cluster from which the snapshot was 2904 taken. The following list shows the time blocks for each region 2905 from which the default maintenance windows are assigned. 2906 2907 2908 + **US-East (Northern Virginia) Region:** 03:00-11:00 UTC 2909 + **US-West (Oregon) Region** 06:00-14:00 UTC 2910 + **EU (Ireland) Region** 22:00-06:00 UTC 2911 + **Asia Pacific (Singapore) Region** 14:00-22:00 UTC 2912 + **Asia Pacific (Sydney) Region** 12:00-20:00 UTC 2913 + **Asia Pacific (Tokyo) Region** 17:00-03:00 UTC 2914 2915 2916 Valid Days: Mon | Tue | Wed | Thu | Fri | Sat | Sun 2917 2918 Constraints: Minimum 30-minute window. 2919 2920 :type automated_snapshot_retention_period: integer 2921 :param automated_snapshot_retention_period: The number of days that 2922 automated snapshots are retained. If the value is 0, automated 2923 snapshots are disabled. Even if automated snapshots are disabled, 2924 you can still create manual snapshots when you want with 2925 CreateClusterSnapshot. 2926 Default: The value selected for the cluster from which the snapshot was 2927 taken. 2928 2929 Constraints: Must be a value from 0 to 35. 2930 2931 """ 2932 params = { 2933 'ClusterIdentifier': cluster_identifier, 2934 'SnapshotIdentifier': snapshot_identifier, 2935 } 2936 if snapshot_cluster_identifier is not None: 2937 params['SnapshotClusterIdentifier'] = snapshot_cluster_identifier 2938 if port is not None: 2939 params['Port'] = port 2940 if availability_zone is not None: 2941 params['AvailabilityZone'] = availability_zone 2942 if allow_version_upgrade is not None: 2943 params['AllowVersionUpgrade'] = str( 2944 allow_version_upgrade).lower() 2945 if cluster_subnet_group_name is not None: 2946 params['ClusterSubnetGroupName'] = cluster_subnet_group_name 2947 if publicly_accessible is not None: 2948 params['PubliclyAccessible'] = str( 2949 publicly_accessible).lower() 2950 if owner_account is not None: 2951 params['OwnerAccount'] = owner_account 2952 if hsm_client_certificate_identifier is not None: 2953 params['HsmClientCertificateIdentifier'] = hsm_client_certificate_identifier 2954 if hsm_configuration_identifier is not None: 2955 params['HsmConfigurationIdentifier'] = hsm_configuration_identifier 2956 if elastic_ip is not None: 2957 params['ElasticIp'] = elastic_ip 2958 if cluster_parameter_group_name is not None: 2959 params['ClusterParameterGroupName'] = cluster_parameter_group_name 2960 if cluster_security_groups is not None: 2961 self.build_list_params(params, 2962 cluster_security_groups, 2963 'ClusterSecurityGroups.member') 2964 if vpc_security_group_ids is not None: 2965 self.build_list_params(params, 2966 vpc_security_group_ids, 2967 'VpcSecurityGroupIds.member') 2968 if preferred_maintenance_window is not None: 2969 params['PreferredMaintenanceWindow'] = preferred_maintenance_window 2970 if automated_snapshot_retention_period is not None: 2971 params['AutomatedSnapshotRetentionPeriod'] = automated_snapshot_retention_period 2972 return self._make_request( 2973 action='RestoreFromClusterSnapshot', 2974 verb='POST', 2975 path='/', params=params) 2976 2977 def revoke_cluster_security_group_ingress(self, 2978 cluster_security_group_name, 2979 cidrip=None, 2980 ec2_security_group_name=None, 2981 ec2_security_group_owner_id=None): 2982 """ 2983 Revokes an ingress rule in an Amazon Redshift security group 2984 for a previously authorized IP range or Amazon EC2 security 2985 group. To add an ingress rule, see 2986 AuthorizeClusterSecurityGroupIngress. For information about 2987 managing security groups, go to `Amazon Redshift Cluster 2988 Security Groups`_ in the Amazon Redshift Management Guide . 2989 2990 :type cluster_security_group_name: string 2991 :param cluster_security_group_name: The name of the security Group from 2992 which to revoke the ingress rule. 2993 2994 :type cidrip: string 2995 :param cidrip: The IP range for which to revoke access. This range must 2996 be a valid Classless Inter-Domain Routing (CIDR) block of IP 2997 addresses. If `CIDRIP` is specified, `EC2SecurityGroupName` and 2998 `EC2SecurityGroupOwnerId` cannot be provided. 2999 3000 :type ec2_security_group_name: string 3001 :param ec2_security_group_name: The name of the EC2 Security Group 3002 whose access is to be revoked. If `EC2SecurityGroupName` is 3003 specified, `EC2SecurityGroupOwnerId` must also be provided and 3004 `CIDRIP` cannot be provided. 3005 3006 :type ec2_security_group_owner_id: string 3007 :param ec2_security_group_owner_id: The AWS account number of the owner 3008 of the security group specified in the `EC2SecurityGroupName` 3009 parameter. The AWS access key ID is not an acceptable value. If 3010 `EC2SecurityGroupOwnerId` is specified, `EC2SecurityGroupName` must 3011 also be provided. and `CIDRIP` cannot be provided. 3012 Example: `111122223333` 3013 3014 """ 3015 params = { 3016 'ClusterSecurityGroupName': cluster_security_group_name, 3017 } 3018 if cidrip is not None: 3019 params['CIDRIP'] = cidrip 3020 if ec2_security_group_name is not None: 3021 params['EC2SecurityGroupName'] = ec2_security_group_name 3022 if ec2_security_group_owner_id is not None: 3023 params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id 3024 return self._make_request( 3025 action='RevokeClusterSecurityGroupIngress', 3026 verb='POST', 3027 path='/', params=params) 3028 3029 def revoke_snapshot_access(self, snapshot_identifier, 3030 account_with_restore_access, 3031 snapshot_cluster_identifier=None): 3032 """ 3033 Removes the ability of the specified AWS customer account to 3034 restore the specified snapshot. If the account is currently 3035 restoring the snapshot, the restore will run to completion. 3036 3037 For more information about working with snapshots, go to 3038 `Amazon Redshift Snapshots`_ in the Amazon Redshift Management 3039 Guide . 3040 3041 :type snapshot_identifier: string 3042 :param snapshot_identifier: The identifier of the snapshot that the 3043 account can no longer access. 3044 3045 :type snapshot_cluster_identifier: string 3046 :param snapshot_cluster_identifier: The identifier of the cluster the 3047 snapshot was created from. This parameter is required if your IAM 3048 user has a policy containing a snapshot resource element that 3049 specifies anything other than * for the cluster name. 3050 3051 :type account_with_restore_access: string 3052 :param account_with_restore_access: The identifier of the AWS customer 3053 account that can no longer restore the specified snapshot. 3054 3055 """ 3056 params = { 3057 'SnapshotIdentifier': snapshot_identifier, 3058 'AccountWithRestoreAccess': account_with_restore_access, 3059 } 3060 if snapshot_cluster_identifier is not None: 3061 params['SnapshotClusterIdentifier'] = snapshot_cluster_identifier 3062 return self._make_request( 3063 action='RevokeSnapshotAccess', 3064 verb='POST', 3065 path='/', params=params) 3066 3067 def rotate_encryption_key(self, cluster_identifier): 3068 """ 3069 Rotates the encryption keys for a cluster. 3070 3071 :type cluster_identifier: string 3072 :param cluster_identifier: The unique identifier of the cluster that 3073 you want to rotate the encryption keys for. 3074 Constraints: Must be the name of valid cluster that has encryption 3075 enabled. 3076 3077 """ 3078 params = {'ClusterIdentifier': cluster_identifier, } 3079 return self._make_request( 3080 action='RotateEncryptionKey', 3081 verb='POST', 3082 path='/', params=params) 3083 3084 def _make_request(self, action, verb, path, params): 3085 params['ContentType'] = 'JSON' 3086 response = self.make_request(action=action, verb='POST', 3087 path='/', params=params) 3088 body = response.read().decode('utf-8') 3089 boto.log.debug(body) 3090 if response.status == 200: 3091 return json.loads(body) 3092 else: 3093 json_body = json.loads(body) 3094 fault_name = json_body.get('Error', {}).get('Code', None) 3095 exception_class = self._faults.get(fault_name, self.ResponseError) 3096 raise exception_class(response.status, response.reason, 3097 body=json_body) 3098