desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
'Returns the current status of the specified configuration recorder. If a configuration recorder is not specified, this action returns the status of all configuration recorder associated with the account. :type configuration_recorder_names: list :param configuration_recorder_names: The name(s) of the configuration reco...
def describe_configuration_recorder_status(self, configuration_recorder_names=None):
params = {} if (configuration_recorder_names is not None): params['ConfigurationRecorderNames'] = configuration_recorder_names return self.make_request(action='DescribeConfigurationRecorderStatus', body=json.dumps(params))
'Returns the name of one or more specified configuration recorders. If the recorder name is not specified, this action returns the names of all the configuration recorders associated with the account. :type configuration_recorder_names: list :param configuration_recorder_names: A list of configuration recorder names.'
def describe_configuration_recorders(self, configuration_recorder_names=None):
params = {} if (configuration_recorder_names is not None): params['ConfigurationRecorderNames'] = configuration_recorder_names return self.make_request(action='DescribeConfigurationRecorders', body=json.dumps(params))
'Returns the current status of the specified delivery channel. If a delivery channel is not specified, this action returns the current status of all delivery channels associated with the account. :type delivery_channel_names: list :param delivery_channel_names: A list of delivery channel names.'
def describe_delivery_channel_status(self, delivery_channel_names=None):
params = {} if (delivery_channel_names is not None): params['DeliveryChannelNames'] = delivery_channel_names return self.make_request(action='DescribeDeliveryChannelStatus', body=json.dumps(params))
'Returns details about the specified delivery channel. If a delivery channel is not specified, this action returns the details of all delivery channels associated with the account. :type delivery_channel_names: list :param delivery_channel_names: A list of delivery channel names.'
def describe_delivery_channels(self, delivery_channel_names=None):
params = {} if (delivery_channel_names is not None): params['DeliveryChannelNames'] = delivery_channel_names return self.make_request(action='DescribeDeliveryChannels', body=json.dumps(params))
'Returns a list of configuration items for the specified resource. The list contains details about each state of the resource during the specified time interval. You can specify a `limit` on the number of results returned on the page. If a limit is specified, a `nextToken` is returned as part of the result that you can...
def get_resource_config_history(self, resource_type, resource_id, later_time=None, earlier_time=None, chronological_order=None, limit=None, next_token=None):
params = {'resourceType': resource_type, 'resourceId': resource_id} if (later_time is not None): params['laterTime'] = later_time if (earlier_time is not None): params['earlierTime'] = earlier_time if (chronological_order is not None): params['chronologicalOrder'] = chronological...
'Creates a new configuration recorder to record the resource configurations. You can use this action to change the role ( `roleARN`) of an existing recorder. To change the role, call the action on the existing configuration recorder and specify a role. :type configuration_recorder: dict :param configuration_recorder: T...
def put_configuration_recorder(self, configuration_recorder):
params = {'ConfigurationRecorder': configuration_recorder} return self.make_request(action='PutConfigurationRecorder', body=json.dumps(params))
'Creates a new delivery channel object to deliver the configuration information to an Amazon S3 bucket, and to an Amazon SNS topic. You can use this action to change the Amazon S3 bucket or an Amazon SNS topic of the existing delivery channel. To change the Amazon S3 bucket or an Amazon SNS topic, call this action and ...
def put_delivery_channel(self, delivery_channel):
params = {'DeliveryChannel': delivery_channel} return self.make_request(action='PutDeliveryChannel', body=json.dumps(params))
'Starts recording configurations of all the resources associated with the account. You must have created at least one delivery channel to successfully start the configuration recorder. :type configuration_recorder_name: string :param configuration_recorder_name: The name of the recorder object that records each configu...
def start_configuration_recorder(self, configuration_recorder_name):
params = {'ConfigurationRecorderName': configuration_recorder_name} return self.make_request(action='StartConfigurationRecorder', body=json.dumps(params))
'Stops recording configurations of all the resources associated with the account. :type configuration_recorder_name: string :param configuration_recorder_name: The name of the recorder object that records each configuration change made to the resources.'
def stop_configuration_recorder(self, configuration_recorder_name):
params = {'ConfigurationRecorderName': configuration_recorder_name} return self.make_request(action='StopConfigurationRecorder', body=json.dumps(params))
'Retrieve all the DBInstances in your account. :type instance_id: str :param instance_id: DB Instance identifier. If supplied, only information this instance will be returned. Otherwise, info about all DB Instances will be returned. :type max_records: int :param max_records: The maximum number of records to be returne...
def get_all_dbinstances(self, instance_id=None, max_records=None, marker=None):
params = {} if instance_id: params['DBInstanceIdentifier'] = instance_id if max_records: params['MaxRecords'] = max_records if marker: params['Marker'] = marker return self.get_list('DescribeDBInstances', params, [('DBInstance', DBInstance)])
'Create a new DBInstance. :type id: str :param id: Unique identifier for the new instance. Must contain 1-63 alphanumeric characters. First character must be a letter. May not end with a hyphen or contain two consecutive hyphens :type allocated_storage: int :param allocated_storage: Initially allocated storage size, in...
def create_dbinstance(self, id, allocated_storage, instance_class, master_username, master_password, port=3306, engine='MySQL5.1', db_name=None, param_group=None, security_groups=None, availability_zone=None, preferred_maintenance_window=None, backup_retention_period=None, preferred_backup_window=None, multi_az=False, ...
params = {'AllocatedStorage': allocated_storage, 'AutoMinorVersionUpgrade': (str(auto_minor_version_upgrade).lower() if auto_minor_version_upgrade else None), 'AvailabilityZone': availability_zone, 'BackupRetentionPeriod': backup_retention_period, 'CharacterSetName': character_set_name, 'DBInstanceClass': instance_...
'Create a new DBInstance Read Replica. :type id: str :param id: Unique identifier for the new instance. Must contain 1-63 alphanumeric characters. First character must be a letter. May not end with a hyphen or contain two consecutive hyphens :type source_id: str :param source_id: Unique identifier for the DB Instance f...
def create_dbinstance_read_replica(self, id, source_id, instance_class=None, port=3306, availability_zone=None, auto_minor_version_upgrade=None):
params = {'DBInstanceIdentifier': id, 'SourceDBInstanceIdentifier': source_id} if instance_class: params['DBInstanceClass'] = instance_class if port: params['Port'] = port if availability_zone: params['AvailabilityZone'] = availability_zone if (auto_minor_version_upgrade is n...
'Promote a Read Replica to a standalone DB Instance. :type id: str :param id: Unique identifier for the new instance. Must contain 1-63 alphanumeric characters. First character must be a letter. May not end with a hyphen or contain two consecutive hyphens :type backup_retention_period: int :param backup_retention_perio...
def promote_read_replica(self, id, backup_retention_period=None, preferred_backup_window=None):
params = {'DBInstanceIdentifier': id} if (backup_retention_period is not None): params['BackupRetentionPeriod'] = backup_retention_period if preferred_backup_window: params['PreferredBackupWindow'] = preferred_backup_window return self.get_object('PromoteReadReplica', params, DBInstance)...
'Modify an existing DBInstance. :type id: str :param id: Unique identifier for the new instance. :type param_group: str or ParameterGroup object :param param_group: Name of DBParameterGroup or ParameterGroup instance to associate with this DBInstance. If no groups are specified no parameter groups will be used. :type ...
def modify_dbinstance(self, id, param_group=None, security_groups=None, preferred_maintenance_window=None, master_password=None, allocated_storage=None, instance_class=None, backup_retention_period=None, preferred_backup_window=None, multi_az=False, apply_immediately=False, iops=None, vpc_security_groups=None, new_inst...
params = {'DBInstanceIdentifier': id} if param_group: params['DBParameterGroupName'] = (param_group.name if isinstance(param_group, ParameterGroup) else param_group) if security_groups: l = [] for group in security_groups: if isinstance(group, DBSecurityGroup): ...
'Delete an existing DBInstance. :type id: str :param id: Unique identifier for the new instance. :type skip_final_snapshot: bool :param skip_final_snapshot: This parameter determines whether a final db snapshot is created before the instance is deleted. If True, no snapshot is created. If False, a snapshot is created...
def delete_dbinstance(self, id, skip_final_snapshot=False, final_snapshot_id=''):
params = {'DBInstanceIdentifier': id} if skip_final_snapshot: params['SkipFinalSnapshot'] = 'true' else: params['SkipFinalSnapshot'] = 'false' params['FinalDBSnapshotIdentifier'] = final_snapshot_id return self.get_object('DeleteDBInstance', params, DBInstance)
'Reboot DBInstance. :type id: str :param id: Unique identifier of the instance. :rtype: :class:`boto.rds.dbinstance.DBInstance` :return: The rebooting db instance.'
def reboot_dbinstance(self, id):
params = {'DBInstanceIdentifier': id} return self.get_object('RebootDBInstance', params, DBInstance)
'Get all parameter groups associated with your account in a region. :type groupname: str :param groupname: The name of the DBParameter group to retrieve. If not provided, all DBParameter groups will be returned. :type max_records: int :param max_records: The maximum number of records to be returned. If more results are...
def get_all_dbparameter_groups(self, groupname=None, max_records=None, marker=None):
params = {} if groupname: params['DBParameterGroupName'] = groupname if max_records: params['MaxRecords'] = max_records if marker: params['Marker'] = marker return self.get_list('DescribeDBParameterGroups', params, [('DBParameterGroup', ParameterGroup)])
'Get all parameters associated with a ParameterGroup :type groupname: str :param groupname: The name of the DBParameter group to retrieve. :type source: str :param source: Specifies which parameters to return. If not specified, all parameters will be returned. Valid values are: user|system|engine-default :type max_reco...
def get_all_dbparameters(self, groupname, source=None, max_records=None, marker=None):
params = {'DBParameterGroupName': groupname} if source: params['Source'] = source if max_records: params['MaxRecords'] = max_records if marker: params['Marker'] = marker pg = self.get_object('DescribeDBParameters', params, ParameterGroup) pg.name = groupname return pg...
'Create a new dbparameter group for your account. :type name: string :param name: The name of the new dbparameter group :type engine: str :param engine: Name of database engine. :type description: string :param description: The description of the new dbparameter group :rtype: :class:`boto.rds.parametergroup.ParameterGr...
def create_parameter_group(self, name, engine='MySQL5.1', description=''):
params = {'DBParameterGroupName': name, 'DBParameterGroupFamily': engine, 'Description': description} return self.get_object('CreateDBParameterGroup', params, ParameterGroup)
'Modify a ParameterGroup for your account. :type name: string :param name: The name of the new ParameterGroup :type parameters: list of :class:`boto.rds.parametergroup.Parameter` :param parameters: The new parameters :rtype: :class:`boto.rds.parametergroup.ParameterGroup` :return: The newly created ParameterGroup'
def modify_parameter_group(self, name, parameters=None):
params = {'DBParameterGroupName': name} for i in range(0, len(parameters)): parameter = parameters[i] parameter.merge(params, (i + 1)) return self.get_list('ModifyDBParameterGroup', params, ParameterGroup, verb='POST')
'Resets some or all of the parameters of a ParameterGroup to the default value :type key_name: string :param key_name: The name of the ParameterGroup to reset :type parameters: list of :class:`boto.rds.parametergroup.Parameter` :param parameters: The parameters to reset. If not supplied, all parameters will be reset.'...
def reset_parameter_group(self, name, reset_all_params=False, parameters=None):
params = {'DBParameterGroupName': name} if reset_all_params: params['ResetAllParameters'] = 'true' else: params['ResetAllParameters'] = 'false' for i in range(0, len(parameters)): parameter = parameters[i] parameter.merge(params, (i + 1)) return self.get_s...
'Delete a ParameterGroup from your account. :type key_name: string :param key_name: The name of the ParameterGroup to delete'
def delete_parameter_group(self, name):
params = {'DBParameterGroupName': name} return self.get_status('DeleteDBParameterGroup', params)
'Get all security groups associated with your account in a region. :type groupnames: list :param groupnames: A list of the names of security groups to retrieve. If not provided, all security groups will be returned. :type max_records: int :param max_records: The maximum number of records to be returned. If more results...
def get_all_dbsecurity_groups(self, groupname=None, max_records=None, marker=None):
params = {} if groupname: params['DBSecurityGroupName'] = groupname if max_records: params['MaxRecords'] = max_records if marker: params['Marker'] = marker return self.get_list('DescribeDBSecurityGroups', params, [('DBSecurityGroup', DBSecurityGroup)])
'Create a new security group for your account. This will create the security group within the region you are currently connected to. :type name: string :param name: The name of the new security group :type description: string :param description: The description of the new security group :rtype: :class:`boto.rds.dbsecur...
def create_dbsecurity_group(self, name, description=None):
params = {'DBSecurityGroupName': name} if description: params['DBSecurityGroupDescription'] = description group = self.get_object('CreateDBSecurityGroup', params, DBSecurityGroup) group.name = name group.description = description return group
'Delete a DBSecurityGroup from your account. :type key_name: string :param key_name: The name of the DBSecurityGroup to delete'
def delete_dbsecurity_group(self, name):
params = {'DBSecurityGroupName': name} return self.get_status('DeleteDBSecurityGroup', params)
'Add a new rule to an existing security group. You need to pass in either src_security_group_name and src_security_group_owner_id OR a CIDR block but not both. :type group_name: string :param group_name: The name of the security group you are adding the rule to. :type ec2_security_group_name: string :param ec2_security...
def authorize_dbsecurity_group(self, group_name, cidr_ip=None, ec2_security_group_name=None, ec2_security_group_owner_id=None):
params = {'DBSecurityGroupName': group_name} if ec2_security_group_name: params['EC2SecurityGroupName'] = ec2_security_group_name if ec2_security_group_owner_id: params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id if cidr_ip: params['CIDRIP'] = urllib.quote(cidr_ip) ...
'Remove an existing rule from an existing security group. You need to pass in either ec2_security_group_name and ec2_security_group_owner_id OR a CIDR block. :type group_name: string :param group_name: The name of the security group you are removing the rule from. :type ec2_security_group_name: string :param ec2_securi...
def revoke_dbsecurity_group(self, group_name, ec2_security_group_name=None, ec2_security_group_owner_id=None, cidr_ip=None):
params = {'DBSecurityGroupName': group_name} if ec2_security_group_name: params['EC2SecurityGroupName'] = ec2_security_group_name if ec2_security_group_owner_id: params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id if cidr_ip: params['CIDRIP'] = cidr_ip return self...
'Get information about DB Snapshots. :type snapshot_id: str :param snapshot_id: The unique identifier of an RDS snapshot. If not provided, all RDS snapshots will be returned. :type instance_id: str :param instance_id: The identifier of a DBInstance. If provided, only the DBSnapshots related to that instance will be re...
def get_all_dbsnapshots(self, snapshot_id=None, instance_id=None, max_records=None, marker=None):
params = {} if snapshot_id: params['DBSnapshotIdentifier'] = snapshot_id if instance_id: params['DBInstanceIdentifier'] = instance_id if max_records: params['MaxRecords'] = max_records if marker: params['Marker'] = marker return self.get_list('DescribeDBSnapshots'...
'Get all log files :type instance_id: str :param instance_id: The identifier of a DBInstance. :type max_records: int :param max_records: Number of log file names to return. :type marker: str :param marker: The marker provided by a previous request. :file_size: int :param file_size: Filter results to files large than th...
def get_all_logs(self, dbinstance_id, max_records=None, marker=None, file_size=None, filename_contains=None, file_last_written=None):
params = {'DBInstanceIdentifier': dbinstance_id} if file_size: params['FileSize'] = file_size if filename_contains: params['FilenameContains'] = filename_contains if file_last_written: params['FileLastWritten'] = file_last_written if marker: params['Marker'] = marker ...
'Download a log file from RDS :type instance_id: str :param instance_id: The identifier of a DBInstance. :type log_file_name: str :param log_file_name: The name of the log file to retrieve :type marker: str :param marker: A marker returned from a previous call to this method, or 0 to indicate the start of file. If no m...
def get_log_file(self, dbinstance_id, log_file_name, marker=None, number_of_lines=None, max_records=None):
params = {'DBInstanceIdentifier': dbinstance_id, 'LogFileName': log_file_name} if marker: params['Marker'] = marker if number_of_lines: params['NumberOfLines'] = number_of_lines if max_records: params['MaxRecords'] = max_records logfile = self.get_object('DownloadDBLogFilePor...
'Create a new DB snapshot. :type snapshot_id: string :param snapshot_id: The identifier for the DBSnapshot :type dbinstance_id: string :param dbinstance_id: The source identifier for the RDS instance from which the snapshot is created. :rtype: :class:`boto.rds.dbsnapshot.DBSnapshot` :return: The newly created DBSnapsho...
def create_dbsnapshot(self, snapshot_id, dbinstance_id):
params = {'DBSnapshotIdentifier': snapshot_id, 'DBInstanceIdentifier': dbinstance_id} return self.get_object('CreateDBSnapshot', params, DBSnapshot)
'Copies the specified DBSnapshot. :type source_snapshot_id: string :param source_snapshot_id: The identifier for the source DB snapshot. :type target_snapshot_id: string :param target_snapshot_id: The identifier for the copied snapshot. :rtype: :class:`boto.rds.dbsnapshot.DBSnapshot` :return: The newly created DBSnapsh...
def copy_dbsnapshot(self, source_snapshot_id, target_snapshot_id):
params = {'SourceDBSnapshotIdentifier': source_snapshot_id, 'TargetDBSnapshotIdentifier': target_snapshot_id} return self.get_object('CopyDBSnapshot', params, DBSnapshot)
'Delete a DBSnapshot :type identifier: string :param identifier: The identifier of the DBSnapshot to delete'
def delete_dbsnapshot(self, identifier):
params = {'DBSnapshotIdentifier': identifier} return self.get_object('DeleteDBSnapshot', params, DBSnapshot)
'Create a new DBInstance from a DB snapshot. :type identifier: string :param identifier: The identifier for the DBSnapshot :type instance_id: string :param instance_id: The source identifier for the RDS instance from which the snapshot is created. :type instance_class: str :param instance_class: The compute and memory ...
def restore_dbinstance_from_dbsnapshot(self, identifier, instance_id, instance_class, port=None, availability_zone=None, multi_az=None, auto_minor_version_upgrade=None, db_subnet_group_name=None):
params = {'DBSnapshotIdentifier': identifier, 'DBInstanceIdentifier': instance_id, 'DBInstanceClass': instance_class} if port: params['Port'] = port if availability_zone: params['AvailabilityZone'] = availability_zone if (multi_az is not None): params['MultiAZ'] = str(multi_az).l...
'Create a new DBInstance from a point in time. :type source_instance_id: string :param source_instance_id: The identifier for the source DBInstance. :type target_instance_id: string :param target_instance_id: The identifier of the new DBInstance. :type use_latest: bool :param use_latest: If True, the latest snapshot av...
def restore_dbinstance_from_point_in_time(self, source_instance_id, target_instance_id, use_latest=False, restore_time=None, dbinstance_class=None, port=None, availability_zone=None, db_subnet_group_name=None):
params = {'SourceDBInstanceIdentifier': source_instance_id, 'TargetDBInstanceIdentifier': target_instance_id} if use_latest: params['UseLatestRestorableTime'] = 'true' elif restore_time: params['RestoreTime'] = restore_time.isoformat() if dbinstance_class: params['DBInstanceClass...
'Get information about events related to your DBInstances, DBSecurityGroups and DBParameterGroups. :type source_identifier: str :param source_identifier: If supplied, the events returned will be limited to those that apply to the identified source. The value of this parameter depends on the value of source_type. If n...
def get_all_events(self, source_identifier=None, source_type=None, start_time=None, end_time=None, max_records=None, marker=None):
params = {} if (source_identifier and source_type): params['SourceIdentifier'] = source_identifier params['SourceType'] = source_type if start_time: params['StartTime'] = start_time.isoformat() if end_time: params['EndTime'] = end_time.isoformat() if max_records: ...
'Create a new Database Subnet Group. :type name: string :param name: The identifier for the db_subnet_group :type desc: string :param desc: A description of the db_subnet_group :type subnet_ids: list :param subnets: A list of the subnet identifiers to include in the db_subnet_group :rtype: :class:`boto.rds.dbsubnetgrou...
def create_db_subnet_group(self, name, desc, subnet_ids):
params = {'DBSubnetGroupName': name, 'DBSubnetGroupDescription': desc} self.build_list_params(params, subnet_ids, 'SubnetIds.member') return self.get_object('CreateDBSubnetGroup', params, DBSubnetGroup)
'Delete a Database Subnet Group. :type name: string :param name: The identifier of the db_subnet_group to delete :rtype: :class:`boto.rds.dbsubnetgroup.DBSubnetGroup` :return: The deleted db_subnet_group.'
def delete_db_subnet_group(self, name):
params = {'DBSubnetGroupName': name} return self.get_object('DeleteDBSubnetGroup', params, DBSubnetGroup)
'Retrieve all the DBSubnetGroups in your account. :type name: str :param name: DBSubnetGroup name If supplied, only information about this DBSubnetGroup will be returned. Otherwise, info about all DBSubnetGroups will be returned. :type max_records: int :param max_records: The maximum number of records to be returned. I...
def get_all_db_subnet_groups(self, name=None, max_records=None, marker=None):
params = dict() if (name is not None): params['DBSubnetGroupName'] = name if (max_records is not None): params['MaxRecords'] = max_records if (marker is not None): params['Marker'] = marker return self.get_list('DescribeDBSubnetGroups', params, [('DBSubnetGroup', DBSubnetGrou...
'Modify a parameter group for your account. :type name: string :param name: The name of the new parameter group :type parameters: list of :class:`boto.rds.parametergroup.Parameter` :param parameters: The new parameters :rtype: :class:`boto.rds.parametergroup.ParameterGroup` :return: The newly created ParameterGroup'
def modify_db_subnet_group(self, name, description=None, subnet_ids=None):
params = {'DBSubnetGroupName': name} if (description is not None): params['DBSubnetGroupDescription'] = description if (subnet_ids is not None): self.build_list_params(params, subnet_ids, 'SubnetIds.member') return self.get_object('ModifyDBSubnetGroup', params, DBSubnetGroup)
'Create a new option group for your account. This will create the option group within the region you are currently connected to. :type name: string :param name: The name of the new option group :type engine_name: string :param engine_name: Specifies the name of the engine that this option group should be associated wit...
def create_option_group(self, name, engine_name, major_engine_version, description=None):
params = {'OptionGroupName': name, 'EngineName': engine_name, 'MajorEngineVersion': major_engine_version, 'OptionGroupDescription': description} group = self.get_object('CreateOptionGroup', params, OptionGroup) group.name = name group.engine_name = engine_name group.major_engine_version = major_engi...
'Delete an OptionGroup from your account. :type key_name: string :param key_name: The name of the OptionGroup to delete'
def delete_option_group(self, name):
params = {'OptionGroupName': name} return self.get_status('DeleteOptionGroup', params)
'Describes the available option groups. :type name: str :param name: The name of the option group to describe. Cannot be supplied together with engine_name or major_engine_version. :type engine_name: str :param engine_name: Filters the list of option groups to only include groups associated with a specific database eng...
def describe_option_groups(self, name=None, engine_name=None, major_engine_version=None, max_records=100, marker=None):
params = {} if name: params['OptionGroupName'] = name elif (engine_name and major_engine_version): params['EngineName'] = engine_name params['MajorEngineVersion'] = major_engine_version if max_records: params['MaxRecords'] = int(max_records) if marker: params[...
'Describes the available option group options. :type engine_name: str :param engine_name: Filters the list of option groups to only include groups associated with a specific database engine. :type major_engine_version: datetime :param major_engine_version: Filters the list of option groups to only include groups associ...
def describe_option_group_options(self, engine_name=None, major_engine_version=None, max_records=100, marker=None):
params = {} if (engine_name and major_engine_version): params['EngineName'] = engine_name params['MajorEngineVersion'] = major_engine_version if max_records: params['MaxRecords'] = int(max_records) if marker: params['Marker'] = marker return self.get_list('DescribeOpt...
'Add a new rule to this DBSecurity group. You need to pass in either a CIDR block to authorize or and EC2 SecurityGroup. :type cidr_ip: string :param cidr_ip: A valid CIDR IP range to authorize :type ec2_group: :class:`boto.ec2.securitygroup.SecurityGroup` :param ec2_group: An EC2 security group to authorize :rtype: bo...
def authorize(self, cidr_ip=None, ec2_group=None):
if isinstance(ec2_group, SecurityGroup): group_name = ec2_group.name group_owner_id = ec2_group.owner_id else: group_name = None group_owner_id = None return self.connection.authorize_dbsecurity_group(self.name, cidr_ip, group_name, group_owner_id)
'Revoke access to a CIDR range or EC2 SecurityGroup. You need to pass in either a CIDR block or an EC2 SecurityGroup from which to revoke access. :type cidr_ip: string :param cidr_ip: A valid CIDR IP range to revoke :type ec2_group: :class:`boto.ec2.securitygroup.SecurityGroup` :param ec2_group: An EC2 security group t...
def revoke(self, cidr_ip=None, ec2_group=None):
if isinstance(ec2_group, SecurityGroup): group_name = ec2_group.name group_owner_id = ec2_group.owner_id return self.connection.revoke_dbsecurity_group(self.name, ec2_security_group_name=group_name, ec2_security_group_owner_id=group_owner_id) return self.connection.revoke_dbsecurity_grou...
'Update the DB snapshot\'s status information by making a call to fetch the current snapshot attributes from the service. :type validate: bool :param validate: By default, if EC2 returns no data about the instance the update method returns quietly. If the validate param is True, however, it will raise a ValueError exc...
def update(self, validate=False):
rs = self.connection.get_all_dbsnapshots(self.id) if (len(rs) > 0): for i in rs: if (i.id == self.id): self.__dict__.update(i.__dict__) elif validate: raise ValueError(('%s is not a valid Snapshot ID' % self.id)) return self.status
'Provide backward compatibility for previous security_group attribute.'
@property def security_group(self):
if (len(self.security_groups) > 0): return self.security_groups[(-1)] else: return None
'Provide backward compatibility for previous parameter_group attribute.'
@property def parameter_group(self):
if (len(self.parameter_groups) > 0): return self.parameter_groups[(-1)] else: return None
'Create a new DB snapshot of this DBInstance. :type identifier: string :param identifier: The identifier for the DBSnapshot :rtype: :class:`boto.rds.dbsnapshot.DBSnapshot` :return: The newly created DBSnapshot'
def snapshot(self, snapshot_id):
return self.connection.create_dbsnapshot(snapshot_id, self.id)
'Reboot this DBInstance :rtype: :class:`boto.rds.dbsnapshot.DBSnapshot` :return: The newly created DBSnapshot'
def reboot(self):
return self.connection.reboot_dbinstance(self.id)
'Update the DB instance\'s status information by making a call to fetch the current instance attributes from the service. :type validate: bool :param validate: By default, if EC2 returns no data about the instance the update method returns quietly. If the validate param is True, however, it will raise a ValueError exc...
def update(self, validate=False):
rs = self.connection.get_all_dbinstances(self.id) if (len(rs) > 0): for i in rs: if (i.id == self.id): self.__dict__.update(i.__dict__) elif validate: raise ValueError(('%s is not a valid Instance ID' % self.id)) return self.status
'Delete this DBInstance. :type skip_final_snapshot: bool :param skip_final_snapshot: This parameter determines whether a final db snapshot is created before the instance is deleted. If True, no snapshot is created. If False, a snapshot is created before deleting the instance. :type final_snapshot_id: str :param final...
def stop(self, skip_final_snapshot=False, final_snapshot_id=''):
return self.connection.delete_dbinstance(self.id, skip_final_snapshot, final_snapshot_id)
'Modify this DBInstance. :type param_group: str :param param_group: Name of DBParameterGroup to associate with this DBInstance. :type security_groups: list of str or list of DBSecurityGroup objects :param security_groups: List of names of DBSecurityGroup to authorize on this DBInstance. :type preferred_maintenance_wind...
def modify(self, param_group=None, security_groups=None, preferred_maintenance_window=None, master_password=None, allocated_storage=None, instance_class=None, backup_retention_period=None, preferred_backup_window=None, multi_az=False, iops=None, vpc_security_groups=None, apply_immediately=False, new_instance_id=None):
return self.connection.modify_dbinstance(self.id, param_group, security_groups, preferred_maintenance_window, master_password, allocated_storage, instance_class, backup_retention_period, preferred_backup_window, multi_az, apply_immediately, iops, vpc_security_groups, new_instance_id)
'Select the headers from the request that need to be included in the StringToSign.'
def headers_to_sign(self, http_request):
headers_to_sign = {'Host': self.host} for (name, value) in http_request.headers.items(): lname = name.lower() if lname.startswith('x-amz'): headers_to_sign[name] = value return headers_to_sign
'Return the headers that need to be included in the StringToSign in their canonical form by converting all header keys to lower case, sorting them in alphabetical order and then joining them into a string, separated by newlines.'
def canonical_headers(self, headers_to_sign):
l = sorted([('%s:%s' % (n.lower().strip(), headers_to_sign[n].strip())) for n in headers_to_sign]) return '\n'.join(l)
'Return the canonical StringToSign as well as a dict containing the original version of all headers that were included in the StringToSign.'
def string_to_sign(self, http_request):
headers_to_sign = self.headers_to_sign(http_request) canonical_headers = self.canonical_headers(headers_to_sign) string_to_sign = '\n'.join([http_request.method, http_request.auth_path, '', canonical_headers, '', http_request.body]) return (string_to_sign, headers_to_sign)
'Add AWS3 authentication to a request. :type req: :class`boto.connection.HTTPRequest` :param req: The HTTPRequest object.'
def add_auth(self, req, **kwargs):
if ('X-Amzn-Authorization' in req.headers): del req.headers['X-Amzn-Authorization'] req.headers['X-Amz-Date'] = formatdate(usegmt=True) if self._provider.security_token: req.headers['X-Amz-Security-Token'] = self._provider.security_token (string_to_sign, headers_to_sign) = self.string_to...
'Select the headers from the request that need to be included in the StringToSign.'
def headers_to_sign(self, http_request):
host_header_value = self.host_header(self.host, http_request) if http_request.headers.get('Host'): host_header_value = http_request.headers['Host'] headers_to_sign = {'Host': host_header_value} for (name, value) in http_request.headers.items(): lname = name.lower() if lname.start...
'Return the headers that need to be included in the StringToSign in their canonical form by converting all header keys to lower case, sorting them in alphabetical order and then joining them into a string, separated by newlines.'
def canonical_headers(self, headers_to_sign):
canonical = [] for header in headers_to_sign: c_name = header.lower().strip() raw_value = str(headers_to_sign[header]) if ('"' in raw_value): c_value = raw_value.strip() else: c_value = ' '.join(raw_value.strip().split()) canonical.append(('%s:%...
'Return the canonical StringToSign as well as a dict containing the original version of all headers that were included in the StringToSign.'
def string_to_sign(self, http_request, canonical_request):
sts = ['AWS4-HMAC-SHA256'] sts.append(http_request.headers['X-Amz-Date']) sts.append(self.credential_scope(http_request)) sts.append(sha256(canonical_request.encode('utf-8')).hexdigest()) return '\n'.join(sts)
'Add AWS4 authentication to a request. :type req: :class`boto.connection.HTTPRequest` :param req: The HTTPRequest object.'
def add_auth(self, req, **kwargs):
if ('X-Amzn-Authorization' in req.headers): del req.headers['X-Amzn-Authorization'] now = datetime.datetime.utcnow() req.headers['X-Amz-Date'] = now.strftime('%Y%m%dT%H%M%SZ') if self._provider.security_token: req.headers['X-Amz-Security-Token'] = self._provider.security_token qs = s...
'Select the headers from the request that need to be included in the StringToSign.'
def headers_to_sign(self, http_request):
host_header_value = self.host_header(self.host, http_request) headers_to_sign = {'Host': host_header_value} for (name, value) in http_request.headers.items(): lname = name.lower() if (lname not in ['authorization']): headers_to_sign[name] = value return headers_to_sign
'Returns a copy of the request object with fixed ``auth_path/params`` attributes from the original.'
def mangle_path_and_params(self, req):
modified_req = copy.copy(req) parsed_path = urllib.parse.urlparse(modified_req.auth_path) modified_req.auth_path = parsed_path.path if (modified_req.params is None): modified_req.params = {} else: copy_params = req.params.copy() modified_req.params = copy_params raw_qs = ...
'Presign a request using SigV4 query params. Takes in an HTTP request and an expiration time in seconds and returns a URL. http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html'
def presign(self, req, expires, iso_date=None):
if (iso_date is None): iso_date = datetime.datetime.utcnow().strftime('%Y%m%dT%H%M%SZ') region = self.determine_region_name(req.host) service = self.determine_service_name(req.host) params = {'X-Amz-Algorithm': 'AWS4-HMAC-SHA256', 'X-Amz-Credential': ('%s/%s/%s/%s/aws4_request' % (self._provider...
':type endpoint_data: dict :param endpoint_data: Regions and endpoints data in the same format as is used by botocore / boto3. :type service_rename_map: dict :param service_rename_map: A mapping of boto2 service name to endpoint prefix.'
def __init__(self, endpoint_data, service_rename_map=None):
super(_CompatEndpointResolver, self).__init__(endpoint_data) if (service_rename_map is None): service_rename_map = self._DEFAULT_SERVICE_RENAMES self._endpoint_prefix_map = service_rename_map self._service_name_map = dict(((v, k) for (k, v) in service_rename_map.items()))
'Retrieve every region across partitions for a service.'
def get_all_available_regions(self, service_name):
regions = set() endpoint_prefix = self._endpoint_prefix(service_name) for partition_name in self.get_available_partitions(): if self._is_global_service(service_name, partition_name): partition = self._get_partition_data(partition_name) regions.update(partition['regions'].keys...
'Get a list of all the available services in the endpoints file(s)'
def get_available_services(self):
services = set() for partition in self._endpoint_data['partitions']: services.update(partition['services'].keys()) return [self._service_name(s) for s in services]
'Determines whether a service uses a global endpoint. In theory a service can be \'global\' in one partition but regional in another. In practice, each service is all global or all regional.'
def _is_global_service(self, service_name, partition_name='aws'):
endpoint_prefix = self._endpoint_prefix(service_name) partition = self._get_partition_data(partition_name) service = partition['services'].get(endpoint_prefix, {}) return ('partitionEndpoint' in service)
'Get partition information for a particular partition. This should NOT be used to get service endpoint data because it only loads from the new endpoint format. It should only be used for partition metadata and partition specific service metadata. :type partition_name: str :param partition_name: The name of the partitio...
def _get_partition_data(self, partition_name):
for partition in self._endpoint_data['partitions']: if (partition['partition'] == partition_name): return partition raise ValueError(('Could not find partition data for: %s' % partition_name))
'Given a boto2 service name, get the endpoint prefix.'
def _endpoint_prefix(self, service_name):
return self._endpoint_prefix_map.get(service_name, service_name)
'Given an endpoint prefix, get the boto2 service name.'
def _service_name(self, endpoint_prefix):
return self._service_name_map.get(endpoint_prefix, endpoint_prefix)
':type endpoint_data: dict :param endpoint_data: Regions and endpoints data in the same format as is used by botocore / boto3. :type service_rename_map: dict :param service_rename_map: A mapping of boto2 service name to endpoint prefix.'
def __init__(self, endpoint_data, service_rename_map=None):
self._resolver = _CompatEndpointResolver(endpoint_data, service_rename_map)
'Resolve the hostname for a service in a particular region. :type service_name: str :param service_name: The service to look up. :type region_name: str :param region_name: The region to find the endpoint for. :return: The hostname for the given service in the given region.'
def resolve_hostname(self, service_name, region_name):
endpoint = self._resolver.construct_endpoint(service_name, region_name) if (endpoint is None): return None return endpoint.get('sslCommonName', endpoint['hostname'])
'Get all the regions a service is available in. :type service_name: str :param service_name: The service to look up. :rtype: list of str :return: A list of all the regions the given service is available in.'
def get_all_available_regions(self, service_name):
return self._resolver.get_all_available_regions(service_name)
'Get all the services supported by the endpoint data. :rtype: list of str :return: A list of all the services explicitly contained within the endpoint data provided during instantiation.'
def get_available_services(self):
return self._resolver.get_available_services()
':type resolver: BotoEndpointResolver :param resolver: An endpoint resolver.'
def __init__(self, resolver):
self._resolver = resolver
'Build a set of static endpoints in the legacy boto2 format. :param service_names: The names of the services to build. They must use the names that boto2 uses, not boto3, e.g "ec2containerservice" and not "ecs". If no service names are provided, all available services will be built. :return: A dict consisting of:: {"se...
def build_static_endpoints(self, service_names=None):
if (service_names is None): service_names = self._resolver.get_available_services() static_endpoints = {} for name in service_names: endpoints_for_service = self._build_endpoints_for_service(name) if endpoints_for_service: static_endpoints[name] = endpoints_for_service ...
'Connect to this Region\'s endpoint. Returns an connection object pointing to the endpoint associated with this region. You may pass any of the arguments accepted by the connection class\'s constructor as keyword arguments and they will be passed along to the connection object. :rtype: Connection object :return: The co...
def connect(self, **kw_params):
if self.connection_cls: return self.connection_cls(host=self.endpoint, **kw_params)
'HealthCheck object :type ip_addr: str :param ip_addr: Optional IP Address :type port: int :param port: Port to check :type hc_type: str :param hc_type: One of HTTP | HTTPS | HTTP_STR_MATCH | HTTPS_STR_MATCH | TCP :type resource_path: str :param resource_path: Path to check :type fqdn: str :param fqdn: domain name of t...
def __init__(self, ip_addr, port, hc_type, resource_path, fqdn=None, string_match=None, request_interval=30, failure_threshold=3):
self.ip_addr = ip_addr self.port = port self.hc_type = hc_type self.resource_path = resource_path self.fqdn = fqdn self.string_match = string_match self.failure_threshold = failure_threshold if (request_interval in self.valid_request_intervals): self.request_interval = request_in...
'Returns a Python data structure with information about all Hosted Zones defined for the AWS account. :param int start_marker: start marker to pass when fetching additional results after a truncated list :param list zone_list: a HostedZones list to prepend to results'
def get_all_hosted_zones(self, start_marker=None, zone_list=None):
params = {} if start_marker: params = {'marker': start_marker} response = self.make_request('GET', ('/%s/hostedzone' % self.Version), params=params) body = response.read() boto.log.debug(body) if (response.status >= 300): raise exception.DNSServerError(response.status, response.r...
'Get detailed information about a particular Hosted Zone. :type hosted_zone_id: str :param hosted_zone_id: The unique identifier for the Hosted Zone'
def get_hosted_zone(self, hosted_zone_id):
uri = ('/%s/hostedzone/%s' % (self.Version, hosted_zone_id)) response = self.make_request('GET', uri) body = response.read() boto.log.debug(body) if (response.status >= 300): raise exception.DNSServerError(response.status, response.reason, body) e = boto.jsonresponse.Element(list_marker=...
'Get detailed information about a particular Hosted Zone. :type hosted_zone_name: str :param hosted_zone_name: The fully qualified domain name for the Hosted Zone'
def get_hosted_zone_by_name(self, hosted_zone_name):
if (hosted_zone_name[(-1)] != '.'): hosted_zone_name += '.' all_hosted_zones = self.get_all_hosted_zones() for zone in all_hosted_zones['ListHostedZonesResponse']['HostedZones']: if (zone['Name'] == hosted_zone_name): return self.get_hosted_zone(zone['Id'].split('/')[(-1)])
'Create a new Hosted Zone. Returns a Python data structure with information about the newly created Hosted Zone. :type domain_name: str :param domain_name: The name of the domain. This should be a fully-specified domain, and should end with a final period as the last label indication. If you omit the final period, Am...
def create_hosted_zone(self, domain_name, caller_ref=None, comment='', private_zone=False, vpc_id=None, vpc_region=None):
if (caller_ref is None): caller_ref = str(uuid.uuid4()) if private_zone: params = {'name': domain_name, 'caller_ref': caller_ref, 'comment': comment, 'vpc_id': vpc_id, 'vpc_region': vpc_region, 'xmlns': self.XMLNameSpace} xml_body = (HZPXML % params) else: params = {'name': d...
'Delete the hosted zone specified by the given id. :type hosted_zone_id: str :param hosted_zone_id: The hosted zone\'s id'
def delete_hosted_zone(self, hosted_zone_id):
uri = ('/%s/hostedzone/%s' % (self.Version, hosted_zone_id)) response = self.make_request('DELETE', uri) body = response.read() boto.log.debug(body) if (response.status not in (200, 204)): raise exception.DNSServerError(response.status, response.reason, body) e = boto.jsonresponse.Elemen...
'Create a new Health Check :type health_check: HealthCheck :param health_check: HealthCheck object :type caller_ref: str :param caller_ref: A unique string that identifies the request and that allows failed CreateHealthCheckRequest requests to be retried without the risk of executing the operation twice. If you don\'t...
def create_health_check(self, health_check, caller_ref=None):
if (caller_ref is None): caller_ref = str(uuid.uuid4()) uri = ('/%s/healthcheck' % self.Version) params = {'xmlns': self.XMLNameSpace, 'caller_ref': caller_ref, 'health_check': health_check.to_xml()} xml_body = (self.POSTHCXMLBody % params) response = self.make_request('POST', uri, {'Content...
'Return a list of health checks :type maxitems: int :param maxitems: Maximum number of items to return :type marker: str :param marker: marker to get next set of items to list'
def get_list_health_checks(self, maxitems=None, marker=None):
params = {} if (maxitems is not None): params['maxitems'] = maxitems if (marker is not None): params['marker'] = marker uri = ('/%s/healthcheck' % (self.Version,)) response = self.make_request('GET', uri, params=params) body = response.read() boto.log.debug(body) if (resp...
'Return a list of Route53 healthcheck IP ranges'
def get_checker_ip_ranges(self):
uri = ('/%s/checkeripranges' % self.Version) response = self.make_request('GET', uri) body = response.read() boto.log.debug(body) if (response.status >= 300): raise exception.DNSServerError(response.status, response.reason, body) e = boto.jsonresponse.Element(list_marker='CheckerIpRanges...
'Delete a health check :type health_check_id: str :param health_check_id: ID of the health check to delete'
def delete_health_check(self, health_check_id):
uri = ('/%s/healthcheck/%s' % (self.Version, health_check_id)) response = self.make_request('DELETE', uri) body = response.read() boto.log.debug(body) if (response.status not in (200, 204)): raise exception.DNSServerError(response.status, response.reason, body) e = boto.jsonresponse.Elem...
'Retrieve the Resource Record Sets defined for this Hosted Zone. Returns the raw XML data returned by the Route53 call. :type hosted_zone_id: str :param hosted_zone_id: The unique identifier for the Hosted Zone :type type: str :param type: The type of resource record set to begin the record listing from. Valid choices...
def get_all_rrsets(self, hosted_zone_id, type=None, name=None, identifier=None, maxitems=None):
params = {'type': type, 'name': name, 'identifier': identifier, 'maxitems': maxitems} uri = ('/%s/hostedzone/%s/rrset' % (self.Version, hosted_zone_id)) response = self.make_request('GET', uri, params=params) body = response.read() boto.log.debug(body) if (response.status >= 300): raise ...
'Create or change the authoritative DNS information for this Hosted Zone. Returns a Python data structure with information about the set of changes, including the Change ID. :type hosted_zone_id: str :param hosted_zone_id: The unique identifier for the Hosted Zone :type xml_body: str :param xml_body: The list of change...
def change_rrsets(self, hosted_zone_id, xml_body):
uri = ('/%s/hostedzone/%s/rrset' % (self.Version, hosted_zone_id)) response = self.make_request('POST', uri, {'Content-Type': 'text/xml'}, xml_body) body = response.read() boto.log.debug(body) if (response.status >= 300): raise exception.DNSServerError(response.status, response.reason, body)...
'Get information about a proposed set of changes, as submitted by the change_rrsets method. Returns a Python data structure with status information about the changes. :type change_id: str :param change_id: The unique identifier for the set of changes. This ID is returned in the response to the change_rrsets method.'
def get_change(self, change_id):
uri = ('/%s/change/%s' % (self.Version, change_id)) response = self.make_request('GET', uri) body = response.read() boto.log.debug(body) if (response.status >= 300): raise exception.DNSServerError(response.status, response.reason, body) e = boto.jsonresponse.Element() h = boto.jsonre...
'Create a new Hosted Zone. Returns a Zone object for the newly created Hosted Zone. :type name: str :param name: The name of the domain. This should be a fully-specified domain, and should end with a final period as the last label indication. If you omit the final period, Amazon Route 53 assumes the domain is relativ...
def create_zone(self, name, private_zone=False, vpc_id=None, vpc_region=None):
zone = self.create_hosted_zone(name, private_zone=private_zone, vpc_id=vpc_id, vpc_region=vpc_region) return Zone(self, zone['CreateHostedZoneResponse']['HostedZone'])
'Returns a Zone object for the specified Hosted Zone. :param name: The name of the domain. This should be a fully-specified domain, and should end with a final period as the last label indication.'
def get_zone(self, name):
name = self._make_qualified(name) for zone in self.get_zones(): if (name == zone.name): return zone
'Returns a list of Zone objects, one for each of the Hosted Zones defined for the AWS account. :rtype: list :returns: A list of Zone objects.'
def get_zones(self):
zones = self.get_all_hosted_zones() return [Zone(self, zone) for zone in zones['ListHostedZonesResponse']['HostedZones']]
'Ensure passed domain names end in a period (.) character. This will usually make a domain fully qualified.'
def _make_qualified(self, value):
if (type(value) in [list, tuple, set]): new_list = [] for record in value: if (record and (not (record[(-1)] == '.'))): new_list.append(('%s.' % record)) else: new_list.append(record) return new_list else: value = value.stri...
'Update the status of this request.'
def update(self):
status = self.route53connection.get_change(self.id)['GetChangeResponse']['ChangeInfo']['Status'] self.status = status return status
'Commit a set of changes and return the ChangeInfo portion of the response. :type changes: ResourceRecordSets :param changes: changes to be committed'
def _commit(self, changes):
response = changes.commit() return response['ChangeResourceRecordSetsResponse']['ChangeInfo']
'Add a CREATE change record to an existing ResourceRecordSets :type changes: ResourceRecordSets :param changes: change set to append to :type name: str :param name: The name of the resource record you want to perform the action on. :type resource_type: str :param resource_type: The DNS record type :param value: Appropr...
def _new_record(self, changes, resource_type, name, value, ttl, identifier, comment=''):
weight = None region = None if (identifier is not None): try: int(identifier[1]) weight = identifier[1] identifier = identifier[0] except: region = identifier[1] identifier = identifier[0] change = changes.add_change('CREATE', n...
'Add a new record to this Zone. See _new_record for parameter documentation. Returns a Status object.'
def add_record(self, resource_type, name, value, ttl=60, identifier=None, comment=''):
changes = ResourceRecordSets(self.route53connection, self.id, comment) self._new_record(changes, resource_type, name, value, ttl, identifier, comment) return Status(self.route53connection, self._commit(changes))