<s> import boto <EOL> from boto . compat import json <EOL> from boto . connection import AWSQueryConnection <EOL> from boto . regioninfo import RegionInfo <EOL> from boto . exception import JSONResponseError <EOL> from boto . redshift import exceptions <EOL> class RedshiftConnection ( AWSQueryConnection ) : <EOL> """<STR_LIT>""" <EOL> APIVersion = "<STR_LIT>" <EOL> DefaultRegionName = "<STR_LIT>" <EOL> DefaultRegionEndpoint = "<STR_LIT>" <EOL> ResponseError = JSONResponseError <EOL> _faults = { <EOL> "<STR_LIT>" : exceptions . SnapshotCopyAlreadyDisabled , <EOL> "<STR_LIT>" : exceptions . ClusterNotFound , <EOL> "<STR_LIT>" : exceptions . UnknownSnapshotCopyRegion , <EOL> "<STR_LIT>" : exceptions . InvalidClusterSubnetState , <EOL> "<STR_LIT>" : exceptions . InvalidSubnet , <EOL> "<STR_LIT>" : exceptions . ReservedNodeQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . InvalidClusterState , <EOL> "<STR_LIT>" : exceptions . HsmClientCertificateQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . SubscriptionCategoryNotFound , <EOL> "<STR_LIT>" : exceptions . HsmClientCertificateNotFound , <EOL> "<STR_LIT>" : exceptions . SubscriptionEventIdNotFound , <EOL> "<STR_LIT>" : exceptions . ClusterSecurityGroupAlreadyExists , <EOL> "<STR_LIT>" : exceptions . HsmConfigurationAlreadyExists , <EOL> "<STR_LIT>" : exceptions . NumberOfNodesQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . ReservedNodeOfferingNotFound , <EOL> "<STR_LIT>" : exceptions . BucketNotFound , <EOL> "<STR_LIT>" : exceptions . InsufficientClusterCapacity , <EOL> "<STR_LIT>" : exceptions . InvalidRestore , <EOL> "<STR_LIT>" : exceptions . UnauthorizedOperation , <EOL> "<STR_LIT>" : exceptions . ClusterQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . InvalidVPCNetworkState , <EOL> "<STR_LIT>" : exceptions . ClusterSnapshotNotFound , <EOL> "<STR_LIT>" : exceptions . AuthorizationQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . InvalidHsmClientCertificateState , <EOL> "<STR_LIT>" : exceptions . SNSTopicArnNotFound , <EOL> "<STR_LIT>" : exceptions . ResizeNotFound , <EOL> "<STR_LIT>" : exceptions . ClusterSubnetGroupNotFound , <EOL> "<STR_LIT>" : exceptions . SNSNoAuthorization , <EOL> "<STR_LIT>" : exceptions . ClusterSnapshotQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . AccessToSnapshotDenied , <EOL> "<STR_LIT>" : exceptions . InvalidClusterSecurityGroupState , <EOL> "<STR_LIT>" : exceptions . NumberOfNodesPerClusterLimitExceeded , <EOL> "<STR_LIT>" : exceptions . ClusterSubnetQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . SNSInvalidTopic , <EOL> "<STR_LIT>" : exceptions . ClusterSecurityGroupNotFound , <EOL> "<STR_LIT>" : exceptions . InvalidElasticIp , <EOL> "<STR_LIT>" : exceptions . InvalidClusterParameterGroupState , <EOL> "<STR_LIT>" : exceptions . InvalidHsmConfigurationState , <EOL> "<STR_LIT>" : exceptions . ClusterAlreadyExists , <EOL> "<STR_LIT>" : exceptions . HsmConfigurationQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . ClusterSnapshotAlreadyExists , <EOL> "<STR_LIT>" : exceptions . SubscriptionSeverityNotFound , <EOL> "<STR_LIT>" : exceptions . SourceNotFound , <EOL> "<STR_LIT>" : exceptions . ReservedNodeAlreadyExists , <EOL> "<STR_LIT>" : exceptions . ClusterSubnetGroupQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . ClusterParameterGroupNotFound , <EOL> "<STR_LIT>" : exceptions . InvalidS3BucketName , <EOL> "<STR_LIT>" : exceptions . InvalidS3KeyPrefix , <EOL> "<STR_LIT>" : exceptions . SubscriptionAlreadyExist , <EOL> "<STR_LIT>" : exceptions . HsmConfigurationNotFound , <EOL> "<STR_LIT>" : exceptions . InvalidSubscriptionState , <EOL> "<STR_LIT>" : exceptions . AuthorizationNotFound , <EOL> "<STR_LIT>" : exceptions . ClusterSecurityGroupQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . SubnetAlreadyInUse , <EOL> "<STR_LIT>" : exceptions . EventSubscriptionQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . AuthorizationAlreadyExists , <EOL> "<STR_LIT>" : exceptions . InvalidClusterSnapshotState , <EOL> "<STR_LIT>" : exceptions . ClusterParameterGroupQuotaExceeded , <EOL> "<STR_LIT>" : exceptions . SnapshotCopyDisabled , <EOL> "<STR_LIT>" : exceptions . ClusterSubnetGroupAlreadyExists , <EOL> "<STR_LIT>" : exceptions . ReservedNodeNotFound , <EOL> "<STR_LIT>" : exceptions . HsmClientCertificateAlreadyExists , <EOL> "<STR_LIT>" : exceptions . InvalidClusterSubnetGroupState , <EOL> "<STR_LIT>" : exceptions . SubscriptionNotFound , <EOL> "<STR_LIT>" : exceptions . InsufficientS3BucketPolicy , <EOL> "<STR_LIT>" : exceptions . ClusterParameterGroupAlreadyExists , <EOL> "<STR_LIT>" : exceptions . UnsupportedOption , <EOL> "<STR_LIT>" : exceptions . CopyToRegionDisabled , <EOL> "<STR_LIT>" : exceptions . SnapshotCopyAlreadyEnabled , <EOL> "<STR_LIT>" : exceptions . IncompatibleOrderableOptions , <EOL> } <EOL> def __init__ ( self , ** kwargs ) : <EOL> region = kwargs . pop ( '<STR_LIT>' , None ) <EOL> if not region : <EOL> region = RegionInfo ( self , self . DefaultRegionName , <EOL> self . DefaultRegionEndpoint ) <EOL> if '<STR_LIT:host>' not in kwargs or kwargs [ '<STR_LIT:host>' ] is None : <EOL> kwargs [ '<STR_LIT:host>' ] = region . endpoint <EOL> super ( RedshiftConnection , self ) . __init__ ( ** kwargs ) <EOL> self . region = region <EOL> def _required_auth_capability ( self ) : <EOL> return [ '<STR_LIT>' ] <EOL> def authorize_cluster_security_group_ingress ( self , <EOL> cluster_security_group_name , <EOL> cidrip = None , <EOL> ec2_security_group_name = None , <EOL> ec2_security_group_owner_id = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_security_group_name , <EOL> } <EOL> if cidrip is not None : <EOL> params [ '<STR_LIT>' ] = cidrip <EOL> if ec2_security_group_name is not None : <EOL> params [ '<STR_LIT>' ] = ec2_security_group_name <EOL> if ec2_security_group_owner_id is not None : <EOL> params [ '<STR_LIT>' ] = ec2_security_group_owner_id <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def authorize_snapshot_access ( self , snapshot_identifier , <EOL> account_with_restore_access , <EOL> snapshot_cluster_identifier = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : snapshot_identifier , <EOL> '<STR_LIT>' : account_with_restore_access , <EOL> } <EOL> if snapshot_cluster_identifier is not None : <EOL> params [ '<STR_LIT>' ] = snapshot_cluster_identifier <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def copy_cluster_snapshot ( self , source_snapshot_identifier , <EOL> target_snapshot_identifier , <EOL> source_snapshot_cluster_identifier = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : source_snapshot_identifier , <EOL> '<STR_LIT>' : target_snapshot_identifier , <EOL> } <EOL> if source_snapshot_cluster_identifier is not None : <EOL> params [ '<STR_LIT>' ] = source_snapshot_cluster_identifier <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def create_cluster ( self , cluster_identifier , node_type , master_username , <EOL> master_user_password , db_name = None , cluster_type = None , <EOL> cluster_security_groups = None , <EOL> vpc_security_group_ids = None , <EOL> cluster_subnet_group_name = None , <EOL> availability_zone = None , <EOL> preferred_maintenance_window = None , <EOL> cluster_parameter_group_name = None , <EOL> automated_snapshot_retention_period = None , port = None , <EOL> cluster_version = None , allow_version_upgrade = None , <EOL> number_of_nodes = None , publicly_accessible = None , <EOL> encrypted = None , <EOL> hsm_client_certificate_identifier = None , <EOL> hsm_configuration_identifier = None , elastic_ip = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_identifier , <EOL> '<STR_LIT>' : node_type , <EOL> '<STR_LIT>' : master_username , <EOL> '<STR_LIT>' : master_user_password , <EOL> } <EOL> if db_name is not None : <EOL> params [ '<STR_LIT>' ] = db_name <EOL> if cluster_type is not None : <EOL> params [ '<STR_LIT>' ] = cluster_type <EOL> if cluster_security_groups is not None : <EOL> self . build_list_params ( params , <EOL> cluster_security_groups , <EOL> '<STR_LIT>' ) <EOL> if vpc_security_group_ids is not None : <EOL> self . build_list_params ( params , <EOL> vpc_security_group_ids , <EOL> '<STR_LIT>' ) <EOL> if cluster_subnet_group_name is not None : <EOL> params [ '<STR_LIT>' ] = cluster_subnet_group_name <EOL> if availability_zone is not None : <EOL> params [ '<STR_LIT>' ] = availability_zone <EOL> if preferred_maintenance_window is not None : <EOL> params [ '<STR_LIT>' ] = preferred_maintenance_window <EOL> if cluster_parameter_group_name is not None : <EOL> params [ '<STR_LIT>' ] = cluster_parameter_group_name <EOL> if automated_snapshot_retention_period is not None : <EOL> params [ '<STR_LIT>' ] = automated_snapshot_retention_period <EOL> if port is not None : <EOL> params [ '<STR_LIT>' ] = port <EOL> if cluster_version is not None : <EOL> params [ '<STR_LIT>' ] = cluster_version <EOL> if allow_version_upgrade is not None : <EOL> params [ '<STR_LIT>' ] = str ( <EOL> allow_version_upgrade ) . lower ( ) <EOL> if number_of_nodes is not None : <EOL> params [ '<STR_LIT>' ] = number_of_nodes <EOL> if publicly_accessible is not None : <EOL> params [ '<STR_LIT>' ] = str ( <EOL> publicly_accessible ) . lower ( ) <EOL> if encrypted is not None : <EOL> params [ '<STR_LIT>' ] = str ( <EOL> encrypted ) . lower ( ) <EOL> if hsm_client_certificate_identifier is not None : <EOL> params [ '<STR_LIT>' ] = hsm_client_certificate_identifier <EOL> if hsm_configuration_identifier is not None : <EOL> params [ '<STR_LIT>' ] = hsm_configuration_identifier <EOL> if elastic_ip is not None : <EOL> params [ '<STR_LIT>' ] = elastic_ip <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def create_cluster_parameter_group ( self , parameter_group_name , <EOL> parameter_group_family , description ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : parameter_group_name , <EOL> '<STR_LIT>' : parameter_group_family , <EOL> '<STR_LIT>' : description , <EOL> } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def create_cluster_security_group ( self , cluster_security_group_name , <EOL> description ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_security_group_name , <EOL> '<STR_LIT>' : description , <EOL> } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def create_cluster_snapshot ( self , snapshot_identifier , <EOL> cluster_identifier ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : snapshot_identifier , <EOL> '<STR_LIT>' : cluster_identifier , <EOL> } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def create_cluster_subnet_group ( self , cluster_subnet_group_name , <EOL> description , subnet_ids ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_subnet_group_name , <EOL> '<STR_LIT>' : description , <EOL> } <EOL> self . build_list_params ( params , <EOL> subnet_ids , <EOL> '<STR_LIT>' ) <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def create_event_subscription ( self , subscription_name , sns_topic_arn , <EOL> source_type = None , source_ids = None , <EOL> event_categories = None , severity = None , <EOL> enabled = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : subscription_name , <EOL> '<STR_LIT>' : sns_topic_arn , <EOL> } <EOL> if source_type is not None : <EOL> params [ '<STR_LIT>' ] = source_type <EOL> if source_ids is not None : <EOL> self . build_list_params ( params , <EOL> source_ids , <EOL> '<STR_LIT>' ) <EOL> if event_categories is not None : <EOL> self . build_list_params ( params , <EOL> event_categories , <EOL> '<STR_LIT>' ) <EOL> if severity is not None : <EOL> params [ '<STR_LIT>' ] = severity <EOL> if enabled is not None : <EOL> params [ '<STR_LIT>' ] = str ( <EOL> enabled ) . lower ( ) <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def create_hsm_client_certificate ( self , <EOL> hsm_client_certificate_identifier ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : hsm_client_certificate_identifier , <EOL> } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def create_hsm_configuration ( self , hsm_configuration_identifier , <EOL> description , hsm_ip_address , <EOL> hsm_partition_name , hsm_partition_password , <EOL> hsm_server_public_certificate ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : hsm_configuration_identifier , <EOL> '<STR_LIT>' : description , <EOL> '<STR_LIT>' : hsm_ip_address , <EOL> '<STR_LIT>' : hsm_partition_name , <EOL> '<STR_LIT>' : hsm_partition_password , <EOL> '<STR_LIT>' : hsm_server_public_certificate , <EOL> } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def delete_cluster ( self , cluster_identifier , <EOL> skip_final_cluster_snapshot = None , <EOL> final_cluster_snapshot_identifier = None ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : cluster_identifier , } <EOL> if skip_final_cluster_snapshot is not None : <EOL> params [ '<STR_LIT>' ] = str ( <EOL> skip_final_cluster_snapshot ) . lower ( ) <EOL> if final_cluster_snapshot_identifier is not None : <EOL> params [ '<STR_LIT>' ] = final_cluster_snapshot_identifier <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def delete_cluster_parameter_group ( self , parameter_group_name ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : parameter_group_name , } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def delete_cluster_security_group ( self , cluster_security_group_name ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_security_group_name , <EOL> } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def delete_cluster_snapshot ( self , snapshot_identifier , <EOL> snapshot_cluster_identifier = None ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : snapshot_identifier , } <EOL> if snapshot_cluster_identifier is not None : <EOL> params [ '<STR_LIT>' ] = snapshot_cluster_identifier <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def delete_cluster_subnet_group ( self , cluster_subnet_group_name ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_subnet_group_name , <EOL> } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def delete_event_subscription ( self , subscription_name ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : subscription_name , } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def delete_hsm_client_certificate ( self , <EOL> hsm_client_certificate_identifier ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : hsm_client_certificate_identifier , <EOL> } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def delete_hsm_configuration ( self , hsm_configuration_identifier ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : hsm_configuration_identifier , <EOL> } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_cluster_parameter_groups ( self , parameter_group_name = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if parameter_group_name is not None : <EOL> params [ '<STR_LIT>' ] = parameter_group_name <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_cluster_parameters ( self , parameter_group_name , source = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : parameter_group_name , } <EOL> if source is not None : <EOL> params [ '<STR_LIT>' ] = source <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_cluster_security_groups ( self , <EOL> cluster_security_group_name = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if cluster_security_group_name is not None : <EOL> params [ '<STR_LIT>' ] = cluster_security_group_name <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_cluster_snapshots ( self , cluster_identifier = None , <EOL> snapshot_identifier = None , <EOL> snapshot_type = None , start_time = None , <EOL> end_time = None , max_records = None , <EOL> marker = None , owner_account = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if cluster_identifier is not None : <EOL> params [ '<STR_LIT>' ] = cluster_identifier <EOL> if snapshot_identifier is not None : <EOL> params [ '<STR_LIT>' ] = snapshot_identifier <EOL> if snapshot_type is not None : <EOL> params [ '<STR_LIT>' ] = snapshot_type <EOL> if start_time is not None : <EOL> params [ '<STR_LIT>' ] = start_time <EOL> if end_time is not None : <EOL> params [ '<STR_LIT>' ] = end_time <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> if owner_account is not None : <EOL> params [ '<STR_LIT>' ] = owner_account <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_cluster_subnet_groups ( self , cluster_subnet_group_name = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if cluster_subnet_group_name is not None : <EOL> params [ '<STR_LIT>' ] = cluster_subnet_group_name <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_cluster_versions ( self , cluster_version = None , <EOL> cluster_parameter_group_family = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if cluster_version is not None : <EOL> params [ '<STR_LIT>' ] = cluster_version <EOL> if cluster_parameter_group_family is not None : <EOL> params [ '<STR_LIT>' ] = cluster_parameter_group_family <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_clusters ( self , cluster_identifier = None , max_records = None , <EOL> marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if cluster_identifier is not None : <EOL> params [ '<STR_LIT>' ] = cluster_identifier <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_default_cluster_parameters ( self , parameter_group_family , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : parameter_group_family , } <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_event_categories ( self , source_type = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if source_type is not None : <EOL> params [ '<STR_LIT>' ] = source_type <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_event_subscriptions ( self , subscription_name = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if subscription_name is not None : <EOL> params [ '<STR_LIT>' ] = subscription_name <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_events ( self , source_identifier = None , source_type = None , <EOL> start_time = None , end_time = None , duration = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if source_identifier is not None : <EOL> params [ '<STR_LIT>' ] = source_identifier <EOL> if source_type is not None : <EOL> params [ '<STR_LIT>' ] = source_type <EOL> if start_time is not None : <EOL> params [ '<STR_LIT>' ] = start_time <EOL> if end_time is not None : <EOL> params [ '<STR_LIT>' ] = end_time <EOL> if duration is not None : <EOL> params [ '<STR_LIT>' ] = duration <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_hsm_client_certificates ( self , <EOL> hsm_client_certificate_identifier = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if hsm_client_certificate_identifier is not None : <EOL> params [ '<STR_LIT>' ] = hsm_client_certificate_identifier <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_hsm_configurations ( self , hsm_configuration_identifier = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if hsm_configuration_identifier is not None : <EOL> params [ '<STR_LIT>' ] = hsm_configuration_identifier <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_logging_status ( self , cluster_identifier ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : cluster_identifier , } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_orderable_cluster_options ( self , cluster_version = None , <EOL> node_type = None , max_records = None , <EOL> marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if cluster_version is not None : <EOL> params [ '<STR_LIT>' ] = cluster_version <EOL> if node_type is not None : <EOL> params [ '<STR_LIT>' ] = node_type <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_reserved_node_offerings ( self , <EOL> reserved_node_offering_id = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if reserved_node_offering_id is not None : <EOL> params [ '<STR_LIT>' ] = reserved_node_offering_id <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_reserved_nodes ( self , reserved_node_id = None , <EOL> max_records = None , marker = None ) : <EOL> """<STR_LIT>""" <EOL> params = { } <EOL> if reserved_node_id is not None : <EOL> params [ '<STR_LIT>' ] = reserved_node_id <EOL> if max_records is not None : <EOL> params [ '<STR_LIT>' ] = max_records <EOL> if marker is not None : <EOL> params [ '<STR_LIT>' ] = marker <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def describe_resize ( self , cluster_identifier ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : cluster_identifier , } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def disable_logging ( self , cluster_identifier ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : cluster_identifier , } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def disable_snapshot_copy ( self , cluster_identifier ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : cluster_identifier , } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def enable_logging ( self , cluster_identifier , bucket_name , <EOL> s3_key_prefix = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_identifier , <EOL> '<STR_LIT>' : bucket_name , <EOL> } <EOL> if s3_key_prefix is not None : <EOL> params [ '<STR_LIT>' ] = s3_key_prefix <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def enable_snapshot_copy ( self , cluster_identifier , destination_region , <EOL> retention_period = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_identifier , <EOL> '<STR_LIT>' : destination_region , <EOL> } <EOL> if retention_period is not None : <EOL> params [ '<STR_LIT>' ] = retention_period <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def modify_cluster ( self , cluster_identifier , cluster_type = None , <EOL> node_type = None , number_of_nodes = None , <EOL> cluster_security_groups = None , <EOL> vpc_security_group_ids = None , <EOL> master_user_password = None , <EOL> cluster_parameter_group_name = None , <EOL> automated_snapshot_retention_period = None , <EOL> preferred_maintenance_window = None , <EOL> cluster_version = None , allow_version_upgrade = None , <EOL> hsm_client_certificate_identifier = None , <EOL> hsm_configuration_identifier = None , <EOL> new_cluster_identifier = None ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : cluster_identifier , } <EOL> if cluster_type is not None : <EOL> params [ '<STR_LIT>' ] = cluster_type <EOL> if node_type is not None : <EOL> params [ '<STR_LIT>' ] = node_type <EOL> if number_of_nodes is not None : <EOL> params [ '<STR_LIT>' ] = number_of_nodes <EOL> if cluster_security_groups is not None : <EOL> self . build_list_params ( params , <EOL> cluster_security_groups , <EOL> '<STR_LIT>' ) <EOL> if vpc_security_group_ids is not None : <EOL> self . build_list_params ( params , <EOL> vpc_security_group_ids , <EOL> '<STR_LIT>' ) <EOL> if master_user_password is not None : <EOL> params [ '<STR_LIT>' ] = master_user_password <EOL> if cluster_parameter_group_name is not None : <EOL> params [ '<STR_LIT>' ] = cluster_parameter_group_name <EOL> if automated_snapshot_retention_period is not None : <EOL> params [ '<STR_LIT>' ] = automated_snapshot_retention_period <EOL> if preferred_maintenance_window is not None : <EOL> params [ '<STR_LIT>' ] = preferred_maintenance_window <EOL> if cluster_version is not None : <EOL> params [ '<STR_LIT>' ] = cluster_version <EOL> if allow_version_upgrade is not None : <EOL> params [ '<STR_LIT>' ] = str ( <EOL> allow_version_upgrade ) . lower ( ) <EOL> if hsm_client_certificate_identifier is not None : <EOL> params [ '<STR_LIT>' ] = hsm_client_certificate_identifier <EOL> if hsm_configuration_identifier is not None : <EOL> params [ '<STR_LIT>' ] = hsm_configuration_identifier <EOL> if new_cluster_identifier is not None : <EOL> params [ '<STR_LIT>' ] = new_cluster_identifier <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def modify_cluster_parameter_group ( self , parameter_group_name , <EOL> parameters ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : parameter_group_name , } <EOL> self . build_complex_list_params ( <EOL> params , parameters , <EOL> '<STR_LIT>' , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def modify_cluster_subnet_group ( self , cluster_subnet_group_name , <EOL> subnet_ids , description = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_subnet_group_name , <EOL> } <EOL> self . build_list_params ( params , <EOL> subnet_ids , <EOL> '<STR_LIT>' ) <EOL> if description is not None : <EOL> params [ '<STR_LIT>' ] = description <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def modify_event_subscription ( self , subscription_name , <EOL> sns_topic_arn = None , source_type = None , <EOL> source_ids = None , event_categories = None , <EOL> severity = None , enabled = None ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : subscription_name , } <EOL> if sns_topic_arn is not None : <EOL> params [ '<STR_LIT>' ] = sns_topic_arn <EOL> if source_type is not None : <EOL> params [ '<STR_LIT>' ] = source_type <EOL> if source_ids is not None : <EOL> self . build_list_params ( params , <EOL> source_ids , <EOL> '<STR_LIT>' ) <EOL> if event_categories is not None : <EOL> self . build_list_params ( params , <EOL> event_categories , <EOL> '<STR_LIT>' ) <EOL> if severity is not None : <EOL> params [ '<STR_LIT>' ] = severity <EOL> if enabled is not None : <EOL> params [ '<STR_LIT>' ] = str ( <EOL> enabled ) . lower ( ) <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def modify_snapshot_copy_retention_period ( self , cluster_identifier , <EOL> retention_period ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_identifier , <EOL> '<STR_LIT>' : retention_period , <EOL> } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def purchase_reserved_node_offering ( self , reserved_node_offering_id , <EOL> node_count = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : reserved_node_offering_id , <EOL> } <EOL> if node_count is not None : <EOL> params [ '<STR_LIT>' ] = node_count <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def reboot_cluster ( self , cluster_identifier ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : cluster_identifier , } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def reset_cluster_parameter_group ( self , parameter_group_name , <EOL> reset_all_parameters = None , <EOL> parameters = None ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : parameter_group_name , } <EOL> if reset_all_parameters is not None : <EOL> params [ '<STR_LIT>' ] = str ( <EOL> reset_all_parameters ) . lower ( ) <EOL> if parameters is not None : <EOL> self . build_complex_list_params ( <EOL> params , parameters , <EOL> '<STR_LIT>' , <EOL> ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def restore_from_cluster_snapshot ( self , cluster_identifier , <EOL> snapshot_identifier , <EOL> snapshot_cluster_identifier = None , <EOL> port = None , availability_zone = None , <EOL> allow_version_upgrade = None , <EOL> cluster_subnet_group_name = None , <EOL> publicly_accessible = None , <EOL> owner_account = None , <EOL> hsm_client_certificate_identifier = None , <EOL> hsm_configuration_identifier = None , <EOL> elastic_ip = None , <EOL> cluster_parameter_group_name = None , <EOL> cluster_security_groups = None , <EOL> vpc_security_group_ids = None , <EOL> preferred_maintenance_window = None , <EOL> automated_snapshot_retention_period = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_identifier , <EOL> '<STR_LIT>' : snapshot_identifier , <EOL> } <EOL> if snapshot_cluster_identifier is not None : <EOL> params [ '<STR_LIT>' ] = snapshot_cluster_identifier <EOL> if port is not None : <EOL> params [ '<STR_LIT>' ] = port <EOL> if availability_zone is not None : <EOL> params [ '<STR_LIT>' ] = availability_zone <EOL> if allow_version_upgrade is not None : <EOL> params [ '<STR_LIT>' ] = str ( <EOL> allow_version_upgrade ) . lower ( ) <EOL> if cluster_subnet_group_name is not None : <EOL> params [ '<STR_LIT>' ] = cluster_subnet_group_name <EOL> if publicly_accessible is not None : <EOL> params [ '<STR_LIT>' ] = str ( <EOL> publicly_accessible ) . lower ( ) <EOL> if owner_account is not None : <EOL> params [ '<STR_LIT>' ] = owner_account <EOL> if hsm_client_certificate_identifier is not None : <EOL> params [ '<STR_LIT>' ] = hsm_client_certificate_identifier <EOL> if hsm_configuration_identifier is not None : <EOL> params [ '<STR_LIT>' ] = hsm_configuration_identifier <EOL> if elastic_ip is not None : <EOL> params [ '<STR_LIT>' ] = elastic_ip <EOL> if cluster_parameter_group_name is not None : <EOL> params [ '<STR_LIT>' ] = cluster_parameter_group_name <EOL> if cluster_security_groups is not None : <EOL> self . build_list_params ( params , <EOL> cluster_security_groups , <EOL> '<STR_LIT>' ) <EOL> if vpc_security_group_ids is not None : <EOL> self . build_list_params ( params , <EOL> vpc_security_group_ids , <EOL> '<STR_LIT>' ) <EOL> if preferred_maintenance_window is not None : <EOL> params [ '<STR_LIT>' ] = preferred_maintenance_window <EOL> if automated_snapshot_retention_period is not None : <EOL> params [ '<STR_LIT>' ] = automated_snapshot_retention_period <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def revoke_cluster_security_group_ingress ( self , <EOL> cluster_security_group_name , <EOL> cidrip = None , <EOL> ec2_security_group_name = None , <EOL> ec2_security_group_owner_id = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : cluster_security_group_name , <EOL> } <EOL> if cidrip is not None : <EOL> params [ '<STR_LIT>' ] = cidrip <EOL> if ec2_security_group_name is not None : <EOL> params [ '<STR_LIT>' ] = ec2_security_group_name <EOL> if ec2_security_group_owner_id is not None : <EOL> params [ '<STR_LIT>' ] = ec2_security_group_owner_id <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def revoke_snapshot_access ( self , snapshot_identifier , <EOL> account_with_restore_access , <EOL> snapshot_cluster_identifier = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> '<STR_LIT>' : snapshot_identifier , <EOL> '<STR_LIT>' : account_with_restore_access , <EOL> } <EOL> if snapshot_cluster_identifier is not None : <EOL> params [ '<STR_LIT>' ] = snapshot_cluster_identifier <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def rotate_encryption_key ( self , cluster_identifier ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT>' : cluster_identifier , } <EOL> return self . _make_request ( <EOL> action = '<STR_LIT>' , <EOL> verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> def _make_request ( self , action , verb , path , params ) : <EOL> params [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> response = self . make_request ( action = action , verb = '<STR_LIT:POST>' , <EOL> path = '<STR_LIT:/>' , params = params ) <EOL> body = response . read ( ) . decode ( '<STR_LIT:utf-8>' ) <EOL> boto . log . debug ( body ) <EOL> if response . status == <NUM_LIT:200> : <EOL> return json . loads ( body ) <EOL> else : <EOL> json_body = json . loads ( body ) <EOL> fault_name = json_body . get ( '<STR_LIT>' , { } ) . get ( '<STR_LIT>' , None ) <EOL> exception_class = self . _faults . get ( fault_name , self . ResponseError ) <EOL> raise exception_class ( response . status , response . reason , <EOL> body = json_body ) </s>
