desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'Creates an RDS event notification subscription. This action
requires a topic ARN (Amazon Resource Name) created by either
the RDS console, the SNS console, or the SNS API. To obtain an
ARN with SNS, you must create a topic in Amazon SNS and
subscribe to the topic. The ARN is displayed in the SNS
console.
You can speci... | def create_event_subscription(self, subscription_name, sns_topic_arn, source_type=None, event_categories=None, source_ids=None, enabled=None, tags=None):
| params = {'SubscriptionName': subscription_name, 'SnsTopicArn': sns_topic_arn}
if (source_type is not None):
params['SourceType'] = source_type
if (event_categories is not None):
self.build_list_params(params, event_categories, 'EventCategories.member')
if (source_ids is not None):
... |
'Creates a new option group. You can create up to 20 option
groups.
:type option_group_name: string
:param option_group_name: Specifies the name of the option group to be
created.
Constraints:
+ Must be 1 to 255 alphanumeric characters or hyphens
+ First character must be a letter
+ Cannot end with a hyphen or contain ... | def create_option_group(self, option_group_name, engine_name, major_engine_version, option_group_description, tags=None):
| params = {'OptionGroupName': option_group_name, 'EngineName': engine_name, 'MajorEngineVersion': major_engine_version, 'OptionGroupDescription': option_group_description}
if (tags is not None):
self.build_complex_list_params(params, tags, 'Tags.member', ('Key', 'Value'))
return self._make_request(ac... |
'The DeleteDBInstance action deletes a previously provisioned
DB instance. A successful response from the web service
indicates the request was received correctly. When you delete
a DB instance, all automated backups for that instance are
deleted and cannot be recovered. Manual DB snapshots of the DB
instance to be del... | def delete_db_instance(self, db_instance_identifier, skip_final_snapshot=None, final_db_snapshot_identifier=None):
| params = {'DBInstanceIdentifier': db_instance_identifier}
if (skip_final_snapshot is not None):
params['SkipFinalSnapshot'] = str(skip_final_snapshot).lower()
if (final_db_snapshot_identifier is not None):
params['FinalDBSnapshotIdentifier'] = final_db_snapshot_identifier
return self._ma... |
'Deletes a specified DBParameterGroup. The DBParameterGroup
cannot be associated with any RDS instances to be deleted.
The specified DB parameter group cannot be associated with any
DB instances.
:type db_parameter_group_name: string
:param db_parameter_group_name:
The name of the DB parameter group.
Constraints:
+ Mus... | def delete_db_parameter_group(self, db_parameter_group_name):
| params = {'DBParameterGroupName': db_parameter_group_name}
return self._make_request(action='DeleteDBParameterGroup', verb='POST', path='/', params=params)
|
'Deletes a DB security group.
The specified DB security group must not be associated with
any DB instances.
:type db_security_group_name: string
:param db_security_group_name:
The name of the DB security group to delete.
You cannot delete the default DB security group.
Constraints:
+ Must be 1 to 255 alphanumeric chara... | def delete_db_security_group(self, db_security_group_name):
| params = {'DBSecurityGroupName': db_security_group_name}
return self._make_request(action='DeleteDBSecurityGroup', verb='POST', path='/', params=params)
|
'Deletes a DBSnapshot.
The DBSnapshot must be in the `available` state to be deleted.
:type db_snapshot_identifier: string
:param db_snapshot_identifier: The DBSnapshot identifier.
Constraints: Must be the name of an existing DB snapshot in the
`available` state.'
| def delete_db_snapshot(self, db_snapshot_identifier):
| params = {'DBSnapshotIdentifier': db_snapshot_identifier}
return self._make_request(action='DeleteDBSnapshot', verb='POST', path='/', params=params)
|
'Deletes a DB subnet group.
The specified database subnet group must not be associated
with any DB instances.
:type db_subnet_group_name: string
:param db_subnet_group_name:
The name of the database subnet group to delete.
You cannot delete the default subnet group.
Constraints:
+ Must be 1 to 255 alphanumeric characte... | def delete_db_subnet_group(self, db_subnet_group_name):
| params = {'DBSubnetGroupName': db_subnet_group_name}
return self._make_request(action='DeleteDBSubnetGroup', verb='POST', path='/', params=params)
|
'Deletes an RDS event notification subscription.
:type subscription_name: string
:param subscription_name: The name of the RDS event notification
subscription you want to delete.'
| def delete_event_subscription(self, subscription_name):
| params = {'SubscriptionName': subscription_name}
return self._make_request(action='DeleteEventSubscription', verb='POST', path='/', params=params)
|
'Deletes an existing option group.
:type option_group_name: string
:param option_group_name:
The name of the option group to be deleted.
You cannot delete default option groups.'
| def delete_option_group(self, option_group_name):
| params = {'OptionGroupName': option_group_name}
return self._make_request(action='DeleteOptionGroup', verb='POST', path='/', params=params)
|
'Returns a list of the available DB engines.
:type engine: string
:param engine: The database engine to return.
:type engine_version: string
:param engine_version: The database engine version to return.
Example: `5.1.49`
:type db_parameter_group_family: string
:param db_parameter_group_family:
The name of a specific DB... | def describe_db_engine_versions(self, engine=None, engine_version=None, db_parameter_group_family=None, max_records=None, marker=None, default_only=None, list_supported_character_sets=None):
| params = {}
if (engine is not None):
params['Engine'] = engine
if (engine_version is not None):
params['EngineVersion'] = engine_version
if (db_parameter_group_family is not None):
params['DBParameterGroupFamily'] = db_parameter_group_family
if (max_records is not None):
... |
'Returns information about provisioned RDS instances. This API
supports pagination.
:type db_instance_identifier: string
:param db_instance_identifier:
The user-supplied instance identifier. If this parameter is specified,
information from only the specific DB instance is returned. This
parameter isn\'t case sensitive.... | def describe_db_instances(self, db_instance_identifier=None, filters=None, max_records=None, marker=None):
| params = {}
if (db_instance_identifier is not None):
params['DBInstanceIdentifier'] = db_instance_identifier
if (filters is not None):
self.build_complex_list_params(params, filters, 'Filters.member', ('FilterName', 'FilterValue'))
if (max_records is not None):
params['MaxRecords... |
'Returns a list of DB log files for the DB instance.
:type db_instance_identifier: string
:param db_instance_identifier:
The customer-assigned name of the DB instance that contains the log
files you want to list.
Constraints:
+ Must contain from 1 to 63 alphanumeric characters or hyphens
+ First character must be a let... | def describe_db_log_files(self, db_instance_identifier, filename_contains=None, file_last_written=None, file_size=None, max_records=None, marker=None):
| params = {'DBInstanceIdentifier': db_instance_identifier}
if (filename_contains is not None):
params['FilenameContains'] = filename_contains
if (file_last_written is not None):
params['FileLastWritten'] = file_last_written
if (file_size is not None):
params['FileSize'] = file_siz... |
'Returns a list of `DBParameterGroup` descriptions. If a
`DBParameterGroupName` is specified, the list will contain
only the description of the specified DB parameter group.
:type db_parameter_group_name: string
:param db_parameter_group_name:
The name of a specific DB parameter group to return details for.
Constraints... | def describe_db_parameter_groups(self, db_parameter_group_name=None, filters=None, max_records=None, marker=None):
| params = {}
if (db_parameter_group_name is not None):
params['DBParameterGroupName'] = db_parameter_group_name
if (filters is not None):
self.build_complex_list_params(params, filters, 'Filters.member', ('FilterName', 'FilterValue'))
if (max_records is not None):
params['MaxRecor... |
'Returns the detailed parameter list for a particular DB
parameter group.
:type db_parameter_group_name: string
:param db_parameter_group_name:
The name of a specific DB parameter group to return details for.
Constraints:
+ Must be 1 to 255 alphanumeric characters
+ First character must be a letter
+ Cannot end with a ... | def describe_db_parameters(self, db_parameter_group_name, source=None, max_records=None, marker=None):
| params = {'DBParameterGroupName': db_parameter_group_name}
if (source is not None):
params['Source'] = source
if (max_records is not None):
params['MaxRecords'] = max_records
if (marker is not None):
params['Marker'] = marker
return self._make_request(action='DescribeDBParame... |
'Returns a list of `DBSecurityGroup` descriptions. If a
`DBSecurityGroupName` is specified, the list will contain only
the descriptions of the specified DB security group.
:type db_security_group_name: string
:param db_security_group_name: The name of the DB security group to
return details for.
:type filters: list
:pa... | def describe_db_security_groups(self, db_security_group_name=None, filters=None, max_records=None, marker=None):
| params = {}
if (db_security_group_name is not None):
params['DBSecurityGroupName'] = db_security_group_name
if (filters is not None):
self.build_complex_list_params(params, filters, 'Filters.member', ('FilterName', 'FilterValue'))
if (max_records is not None):
params['MaxRecords'... |
'Returns information about DB snapshots. This API supports
pagination.
:type db_instance_identifier: string
:param db_instance_identifier:
A DB instance identifier to retrieve the list of DB snapshots for.
Cannot be used in conjunction with `DBSnapshotIdentifier`. This
parameter is not case sensitive.
Constraints:
+ Mu... | def describe_db_snapshots(self, db_instance_identifier=None, db_snapshot_identifier=None, snapshot_type=None, filters=None, max_records=None, marker=None):
| params = {}
if (db_instance_identifier is not None):
params['DBInstanceIdentifier'] = db_instance_identifier
if (db_snapshot_identifier is not None):
params['DBSnapshotIdentifier'] = db_snapshot_identifier
if (snapshot_type is not None):
params['SnapshotType'] = snapshot_type
... |
'Returns a list of DBSubnetGroup descriptions. If a
DBSubnetGroupName is specified, the list will contain only the
descriptions of the specified DBSubnetGroup.
For an overview of CIDR ranges, go to the `Wikipedia
Tutorial`_.
:type db_subnet_group_name: string
:param db_subnet_group_name: The name of the DB subnet group... | def describe_db_subnet_groups(self, db_subnet_group_name=None, filters=None, max_records=None, marker=None):
| params = {}
if (db_subnet_group_name is not None):
params['DBSubnetGroupName'] = db_subnet_group_name
if (filters is not None):
self.build_complex_list_params(params, filters, 'Filters.member', ('FilterName', 'FilterValue'))
if (max_records is not None):
params['MaxRecords'] = ma... |
'Returns the default engine and system parameter information
for the specified database engine.
:type db_parameter_group_family: string
:param db_parameter_group_family: The name of the DB parameter group
family.
:type max_records: integer
:param max_records: The maximum number of records to include in the
response. If... | def describe_engine_default_parameters(self, db_parameter_group_family, max_records=None, marker=None):
| params = {'DBParameterGroupFamily': db_parameter_group_family}
if (max_records is not None):
params['MaxRecords'] = max_records
if (marker is not None):
params['Marker'] = marker
return self._make_request(action='DescribeEngineDefaultParameters', verb='POST', path='/', params=params)
|
'Displays a list of categories for all event source types, or,
if specified, for a specified source type. You can see a list
of the event categories and source types in the ` Events`_
topic in the Amazon RDS User Guide.
:type source_type: string
:param source_type: The type of source that will be generating the
events.... | def describe_event_categories(self, source_type=None):
| params = {}
if (source_type is not None):
params['SourceType'] = source_type
return self._make_request(action='DescribeEventCategories', verb='POST', path='/', params=params)
|
'Lists all the subscription descriptions for a customer
account. The description for a subscription includes
SubscriptionName, SNSTopicARN, CustomerID, SourceType,
SourceID, CreationTime, and Status.
If you specify a SubscriptionName, lists the description for
that subscription.
:type subscription_name: string
:param s... | def describe_event_subscriptions(self, subscription_name=None, filters=None, max_records=None, marker=None):
| params = {}
if (subscription_name is not None):
params['SubscriptionName'] = subscription_name
if (filters is not None):
self.build_complex_list_params(params, filters, 'Filters.member', ('FilterName', 'FilterValue'))
if (max_records is not None):
params['MaxRecords'] = max_recor... |
'Returns events related to DB instances, DB security groups, DB
snapshots, and DB parameter groups for the past 14 days.
Events specific to a particular DB instance, DB security
group, database snapshot, or DB parameter group can be
obtained by providing the name as a parameter. By default, the
past hour of events are ... | def describe_events(self, source_identifier=None, source_type=None, start_time=None, end_time=None, duration=None, event_categories=None, max_records=None, marker=None):
| params = {}
if (source_identifier is not None):
params['SourceIdentifier'] = source_identifier
if (source_type is not None):
params['SourceType'] = source_type
if (start_time is not None):
params['StartTime'] = start_time
if (end_time is not None):
params['EndTime'] =... |
'Describes all available options.
:type engine_name: string
:param engine_name: A required parameter. Options available for the
given Engine name will be described.
:type major_engine_version: string
:param major_engine_version: If specified, filters the results to
include only options for the specified major engine ve... | def describe_option_group_options(self, engine_name, major_engine_version=None, max_records=None, marker=None):
| params = {'EngineName': engine_name}
if (major_engine_version is not None):
params['MajorEngineVersion'] = major_engine_version
if (max_records is not None):
params['MaxRecords'] = max_records
if (marker is not None):
params['Marker'] = marker
return self._make_request(action... |
'Describes the available option groups.
:type option_group_name: string
:param option_group_name: The name of the option group to describe.
Cannot be supplied together with EngineName or MajorEngineVersion.
:type filters: list
:param filters:
:type marker: string
:param marker: An optional pagination token provided by ... | def describe_option_groups(self, option_group_name=None, filters=None, marker=None, max_records=None, engine_name=None, major_engine_version=None):
| params = {}
if (option_group_name is not None):
params['OptionGroupName'] = option_group_name
if (filters is not None):
self.build_complex_list_params(params, filters, 'Filters.member', ('FilterName', 'FilterValue'))
if (marker is not None):
params['Marker'] = marker
if (max_... |
'Returns a list of orderable DB instance options for the
specified engine.
:type engine: string
:param engine: The name of the engine to retrieve DB instance options
for.
:type engine_version: string
:param engine_version: The engine version filter value. Specify this
parameter to show only the available offerings matc... | def describe_orderable_db_instance_options(self, engine, engine_version=None, db_instance_class=None, license_model=None, vpc=None, max_records=None, marker=None):
| params = {'Engine': engine}
if (engine_version is not None):
params['EngineVersion'] = engine_version
if (db_instance_class is not None):
params['DBInstanceClass'] = db_instance_class
if (license_model is not None):
params['LicenseModel'] = license_model
if (vpc is not None):... |
'Returns information about reserved DB instances for this
account, or about a specified reserved DB instance.
:type reserved_db_instance_id: string
:param reserved_db_instance_id: The reserved DB instance identifier
filter value. Specify this parameter to show only the reservation
that matches the specified reservation... | def describe_reserved_db_instances(self, reserved_db_instance_id=None, reserved_db_instances_offering_id=None, db_instance_class=None, duration=None, product_description=None, offering_type=None, multi_az=None, filters=None, max_records=None, marker=None):
| params = {}
if (reserved_db_instance_id is not None):
params['ReservedDBInstanceId'] = reserved_db_instance_id
if (reserved_db_instances_offering_id is not None):
params['ReservedDBInstancesOfferingId'] = reserved_db_instances_offering_id
if (db_instance_class is not None):
param... |
'Lists available reserved DB instance offerings.
:type reserved_db_instances_offering_id: string
:param reserved_db_instances_offering_id: The offering identifier
filter value. Specify this parameter to show only the available
offering that matches the specified reservation identifier.
Example: `438012d3-4052-4cc7-b2e3... | def describe_reserved_db_instances_offerings(self, reserved_db_instances_offering_id=None, db_instance_class=None, duration=None, product_description=None, offering_type=None, multi_az=None, max_records=None, marker=None):
| params = {}
if (reserved_db_instances_offering_id is not None):
params['ReservedDBInstancesOfferingId'] = reserved_db_instances_offering_id
if (db_instance_class is not None):
params['DBInstanceClass'] = db_instance_class
if (duration is not None):
params['Duration'] = duration
... |
'Downloads the last line of the specified log file.
:type db_instance_identifier: string
:param db_instance_identifier:
The customer-assigned name of the DB instance that contains the log
files you want to list.
Constraints:
+ Must contain from 1 to 63 alphanumeric characters or hyphens
+ First character must be a lett... | def download_db_log_file_portion(self, db_instance_identifier, log_file_name, marker=None, number_of_lines=None):
| params = {'DBInstanceIdentifier': db_instance_identifier, 'LogFileName': log_file_name}
if (marker is not None):
params['Marker'] = marker
if (number_of_lines is not None):
params['NumberOfLines'] = number_of_lines
return self._make_request(action='DownloadDBLogFilePortion', verb='POST',... |
'Lists all tags on an Amazon RDS resource.
For an overview on tagging an Amazon RDS resource, see
`Tagging Amazon RDS Resources`_.
:type resource_name: string
:param resource_name: The Amazon RDS resource with tags to be listed.
This value is an Amazon Resource Name (ARN). For information about
creating an ARN, see ` C... | def list_tags_for_resource(self, resource_name):
| params = {'ResourceName': resource_name}
return self._make_request(action='ListTagsForResource', verb='POST', path='/', params=params)
|
'Modify settings for a DB instance. You can change one or more
database configuration parameters by specifying these
parameters and the new values in the request.
:type db_instance_identifier: string
:param db_instance_identifier:
The DB instance identifier. This value is stored as a lowercase string.
Constraints:
+ Mu... | def modify_db_instance(self, db_instance_identifier, allocated_storage=None, db_instance_class=None, db_security_groups=None, vpc_security_group_ids=None, apply_immediately=None, master_user_password=None, db_parameter_group_name=None, backup_retention_period=None, preferred_backup_window=None, preferred_maintenance_wi... | params = {'DBInstanceIdentifier': db_instance_identifier}
if (allocated_storage is not None):
params['AllocatedStorage'] = allocated_storage
if (db_instance_class is not None):
params['DBInstanceClass'] = db_instance_class
if (db_security_groups is not None):
self.build_list_para... |
'Modifies the parameters of a DB parameter group. To modify
more than one parameter, submit a list of the following:
`ParameterName`, `ParameterValue`, and `ApplyMethod`. A
maximum of 20 parameters can be modified in a single request.
The `apply-immediate` method can be used only for dynamic
parameters; the `pending-re... | def modify_db_parameter_group(self, db_parameter_group_name, parameters):
| params = {'DBParameterGroupName': db_parameter_group_name}
self.build_complex_list_params(params, parameters, 'Parameters.member', ('ParameterName', 'ParameterValue', 'Description', 'Source', 'ApplyType', 'DataType', 'AllowedValues', 'IsModifiable', 'MinimumEngineVersion', 'ApplyMethod'))
return self._make_... |
'Modifies an existing DB subnet group. DB subnet groups must
contain at least one subnet in at least two AZs in the region.
:type db_subnet_group_name: string
:param db_subnet_group_name: The name for the DB subnet group. This
value is stored as a lowercase string.
Constraints: Must contain no more than 255 alphanumeri... | def modify_db_subnet_group(self, db_subnet_group_name, subnet_ids, db_subnet_group_description=None):
| params = {'DBSubnetGroupName': db_subnet_group_name}
self.build_list_params(params, subnet_ids, 'SubnetIds.member')
if (db_subnet_group_description is not None):
params['DBSubnetGroupDescription'] = db_subnet_group_description
return self._make_request(action='ModifyDBSubnetGroup', verb='POST', ... |
'Modifies an existing RDS event notification subscription. Note
that you cannot modify the source identifiers using this call;
to change source identifiers for a subscription, use the
AddSourceIdentifierToSubscription and
RemoveSourceIdentifierFromSubscription calls.
You can see a list of the event categories for a giv... | def modify_event_subscription(self, subscription_name, sns_topic_arn=None, source_type=None, event_categories=None, enabled=None):
| params = {'SubscriptionName': subscription_name}
if (sns_topic_arn is not None):
params['SnsTopicArn'] = sns_topic_arn
if (source_type is not None):
params['SourceType'] = source_type
if (event_categories is not None):
self.build_list_params(params, event_categories, 'EventCatego... |
'Modifies an existing option group.
:type option_group_name: string
:param option_group_name: The name of the option group to be modified.
Permanent options, such as the TDE option for Oracle Advanced Security
TDE, cannot be removed from an option group, and that option group
cannot be removed from a DB instance once i... | def modify_option_group(self, option_group_name, options_to_include=None, options_to_remove=None, apply_immediately=None):
| params = {'OptionGroupName': option_group_name}
if (options_to_include is not None):
self.build_complex_list_params(params, options_to_include, 'OptionsToInclude.member', ('OptionName', 'Port', 'DBSecurityGroupMemberships', 'VpcSecurityGroupMemberships', 'OptionSettings'))
if (options_to_remove is n... |
'Promotes a read replica DB instance to a standalone DB
instance.
:type db_instance_identifier: string
:param db_instance_identifier: The DB instance identifier. This value
is stored as a lowercase string.
Constraints:
+ Must be the identifier for an existing read replica DB instance
+ Must contain from 1 to 63 alphanu... | def promote_read_replica(self, db_instance_identifier, backup_retention_period=None, preferred_backup_window=None):
| params = {'DBInstanceIdentifier': db_instance_identifier}
if (backup_retention_period is not None):
params['BackupRetentionPeriod'] = backup_retention_period
if (preferred_backup_window is not None):
params['PreferredBackupWindow'] = preferred_backup_window
return self._make_request(acti... |
'Purchases a reserved DB instance offering.
:type reserved_db_instances_offering_id: string
:param reserved_db_instances_offering_id: The ID of the Reserved DB
instance offering to purchase.
Example: 438012d3-4052-4cc7-b2e3-8d3372e0e706
:type reserved_db_instance_id: string
:param reserved_db_instance_id: Customer-spec... | def purchase_reserved_db_instances_offering(self, reserved_db_instances_offering_id, reserved_db_instance_id=None, db_instance_count=None, tags=None):
| params = {'ReservedDBInstancesOfferingId': reserved_db_instances_offering_id}
if (reserved_db_instance_id is not None):
params['ReservedDBInstanceId'] = reserved_db_instance_id
if (db_instance_count is not None):
params['DBInstanceCount'] = db_instance_count
if (tags is not None):
... |
'Rebooting a DB instance restarts the database engine service.
A reboot also applies to the DB instance any modifications to
the associated DB parameter group that were pending. Rebooting
a DB instance results in a momentary outage of the instance,
during which the DB instance status is set to rebooting. If
the RDS ins... | def reboot_db_instance(self, db_instance_identifier, force_failover=None):
| params = {'DBInstanceIdentifier': db_instance_identifier}
if (force_failover is not None):
params['ForceFailover'] = str(force_failover).lower()
return self._make_request(action='RebootDBInstance', verb='POST', path='/', params=params)
|
'Removes a source identifier from an existing RDS event
notification subscription.
:type subscription_name: string
:param subscription_name: The name of the RDS event notification
subscription you want to remove a source identifier from.
:type source_identifier: string
:param source_identifier: The source identifier to... | def remove_source_identifier_from_subscription(self, subscription_name, source_identifier):
| params = {'SubscriptionName': subscription_name, 'SourceIdentifier': source_identifier}
return self._make_request(action='RemoveSourceIdentifierFromSubscription', verb='POST', path='/', params=params)
|
'Removes metadata tags from an Amazon RDS resource.
For an overview on tagging an Amazon RDS resource, see
`Tagging Amazon RDS Resources`_.
:type resource_name: string
:param resource_name: The Amazon RDS resource the tags will be removed
from. This value is an Amazon Resource Name (ARN). For information
about creating... | def remove_tags_from_resource(self, resource_name, tag_keys):
| params = {'ResourceName': resource_name}
self.build_list_params(params, tag_keys, 'TagKeys.member')
return self._make_request(action='RemoveTagsFromResource', verb='POST', path='/', params=params)
|
'Modifies the parameters of a DB parameter group to the
engine/system default value. To reset specific parameters
submit a list of the following: `ParameterName` and
`ApplyMethod`. To reset the entire DB parameter group, specify
the `DBParameterGroup` name and `ResetAllParameters`
parameters. When resetting the entire ... | def reset_db_parameter_group(self, db_parameter_group_name, reset_all_parameters=None, parameters=None):
| params = {'DBParameterGroupName': db_parameter_group_name}
if (reset_all_parameters is not None):
params['ResetAllParameters'] = str(reset_all_parameters).lower()
if (parameters is not None):
self.build_complex_list_params(params, parameters, 'Parameters.member', ('ParameterName', 'Parameter... |
'Creates a new DB instance from a DB snapshot. The target
database is created from the source database restore point
with the same configuration as the original source database,
except that the new RDS instance is created with the default
security group.
:type db_instance_identifier: string
:param db_instance_identifie... | def restore_db_instance_from_db_snapshot(self, db_instance_identifier, db_snapshot_identifier, db_instance_class=None, port=None, availability_zone=None, db_subnet_group_name=None, multi_az=None, publicly_accessible=None, auto_minor_version_upgrade=None, license_model=None, db_name=None, engine=None, iops=None, option_... | params = {'DBInstanceIdentifier': db_instance_identifier, 'DBSnapshotIdentifier': db_snapshot_identifier}
if (db_instance_class is not None):
params['DBInstanceClass'] = db_instance_class
if (port is not None):
params['Port'] = port
if (availability_zone is not None):
params['Ava... |
'Restores a DB instance to an arbitrary point-in-time. Users
can restore to any point in time before the
latestRestorableTime for up to backupRetentionPeriod days. The
target database is created from the source database with the
same configuration as the original database except that the DB
instance is created with the... | def restore_db_instance_to_point_in_time(self, source_db_instance_identifier, target_db_instance_identifier, restore_time=None, use_latest_restorable_time=None, db_instance_class=None, port=None, availability_zone=None, db_subnet_group_name=None, multi_az=None, publicly_accessible=None, auto_minor_version_upgrade=None,... | params = {'SourceDBInstanceIdentifier': source_db_instance_identifier, 'TargetDBInstanceIdentifier': target_db_instance_identifier}
if (restore_time is not None):
params['RestoreTime'] = restore_time
if (use_latest_restorable_time is not None):
params['UseLatestRestorableTime'] = str(use_lat... |
'Revokes ingress from a DBSecurityGroup for previously
authorized IP ranges or EC2 or VPC Security Groups. Required
parameters for this API are one of CIDRIP, EC2SecurityGroupId
for VPC, or (EC2SecurityGroupOwnerId and either
EC2SecurityGroupName or EC2SecurityGroupId).
:type db_security_group_name: string
:param db_se... | def revoke_db_security_group_ingress(self, db_security_group_name, cidrip=None, ec2_security_group_name=None, ec2_security_group_id=None, ec2_security_group_owner_id=None):
| params = {'DBSecurityGroupName': db_security_group_name}
if (cidrip is not None):
params['CIDRIP'] = cidrip
if (ec2_security_group_name is not None):
params['EC2SecurityGroupName'] = ec2_security_group_name
if (ec2_security_group_id is not None):
params['EC2SecurityGroupId'] = ec... |
'Store attributes for a given item.
:type item_name: string
:param item_name: The name of the item whose attributes are being stored.
:type attribute_names: dict or dict-like object
:param attribute_names: The name/value pairs to store as attributes
:type expected_value: list
:param expected_value: If supplied, this is... | def put_attributes(self, item_name, attributes, replace=True, expected_value=None):
| return self.connection.put_attributes(self, item_name, attributes, replace, expected_value)
|
'Store attributes for multiple items.
:type items: dict or dict-like object
:param items: A dictionary-like object. The keys of the dictionary are
the item names and the values are themselves dictionaries
of attribute names/values, exactly the same as the
attribute_names parameter of the scalar put_attributes
call.
:t... | def batch_put_attributes(self, items, replace=True):
| return self.connection.batch_put_attributes(self, items, replace)
|
'Retrieve attributes for a given item.
:type item_name: string
:param item_name: The name of the item whose attributes are being retrieved.
:type attribute_names: string or list of strings
:param attribute_names: An attribute name or list of attribute names. This
parameter is optional. If not supplied, all attributes... | def get_attributes(self, item_name, attribute_name=None, consistent_read=False, item=None):
| return self.connection.get_attributes(self, item_name, attribute_name, consistent_read, item)
|
'Delete attributes from a given item.
:type item_name: string
:param item_name: The name of the item whose attributes are being deleted.
:type attributes: dict, list or :class:`boto.sdb.item.Item`
:param attributes: Either a list containing attribute names which will cause
all values associated with that attribute name... | def delete_attributes(self, item_name, attributes=None, expected_values=None):
| return self.connection.delete_attributes(self, item_name, attributes, expected_values)
|
'Delete multiple items in this domain.
:type items: dict or dict-like object
:param items: A dictionary-like object. The keys of the dictionary are
the item names and the values are either:
* dictionaries of attribute names/values, exactly the
same as the attribute_names parameter of the scalar
put_attributes call. T... | def batch_delete_attributes(self, items):
| return self.connection.batch_delete_attributes(self, items)
|
'Returns a set of Attributes for item names within domain_name that match the query.
The query must be expressed in using the SELECT style syntax rather than the
original SimpleDB query language.
:type query: string
:param query: The SimpleDB query to be performed.
:rtype: iter
:return: An iterator containing the resul... | def select(self, query='', next_token=None, consistent_read=False, max_items=None):
| return SelectResultSet(self, query, max_items=max_items, next_token=next_token, consistent_read=consistent_read)
|
'Retrieves an item from the domain, along with all of its attributes.
:param string item_name: The name of the item to retrieve.
:rtype: :class:`boto.sdb.item.Item` or ``None``
:keyword bool consistent_read: When set to true, ensures that the most
recent data is returned.
:return: The requested item, or ``None`` if the... | def get_item(self, item_name, consistent_read=False):
| item = self.get_attributes(item_name, consistent_read=consistent_read)
if item:
item.domain = self
return item
else:
return None
|
'Get this domain as an XML DOM Document
:param f: Optional File to dump directly to
:type f: File or Stream
:return: File object where the XML has been dumped to
:rtype: file'
| def to_xml(self, f=None):
| if (not f):
from tempfile import TemporaryFile
f = TemporaryFile()
print('<?xml version="1.0" encoding="UTF-8"?>', file=f)
print(('<Domain id="%s">' % self.name), file=f)
for item in self:
print((' DCTB <Item id="%s">' % item.name), file=f)
for k in item:
... |
'Load this domain based on an XML document'
| def from_xml(self, doc):
| import xml.sax
handler = DomainDumpParser(self)
xml.sax.parse(doc, handler)
return handler
|
'Delete this domain, and all items under it'
| def delete(self):
| return self.connection.delete_domain(self)
|
'Create a new SequenceGenerator using the sequence_string
as how to generate the next item.
:param sequence_string: The string or list that explains
how to generate the next item in the sequence
:type sequence_string: str,iterable
:param rollover: Rollover instead of incrementing when
we hit the end of the sequence
:ty... | def __init__(self, sequence_string, rollover=False):
| self.sequence_string = sequence_string
self.sequence_length = len(sequence_string[0])
self.rollover = rollover
self.last_item = sequence_string[(-1)]
self.__name__ = ("%s('%s')" % (self.__class__.__name__, sequence_string))
|
'Get the next value in the sequence'
| def __call__(self, val, last=None):
| if ((val is None) or (len(val) < self.sequence_length)):
return self.sequence_string[0]
last_value = val[(- self.sequence_length):]
if ((not self.rollover) and (last_value == self.last_item)):
val = ('%s%s' % (self(val[:(- self.sequence_length)]), self._inc(last_value)))
else:
va... |
'Increment a single value'
| def _inc(self, val):
| assert (len(val) == self.sequence_length)
return self.sequence_string[((self.sequence_string.index(val) + 1) % len(self.sequence_string))]
|
'Create a new Sequence, using an optional function to
increment to the next number, by default we just increment by one.
Every parameter here is optional, if you don\'t specify any options
then you\'ll get a new SequenceGenerator with a random ID stored in the
default domain that increments by one and uses the default ... | def __init__(self, id=None, domain_name=None, fnc=increment_by_one, init_val=None):
| self._db = None
self._value = None
self.last_value = None
self.domain_name = domain_name
self.id = id
if (init_val is None):
init_val = fnc(init_val)
if (self.id is None):
import uuid
self.id = str(uuid.uuid4())
self.item_type = type(fnc(None))
self.timestamp ... |
'Set the value'
| def set(self, val):
| import time
now = time.time()
expected_value = []
new_val = {}
new_val['timestamp'] = now
if (self._value is not None):
new_val['last_value'] = self._value
expected_value = ['current_value', str(self._value)]
new_val['current_value'] = val
try:
self.db.put_attribu... |
'Get the value'
| def get(self):
| val = self.db.get_attributes(self.id, consistent_read=True)
if val:
if ('timestamp' in val):
self.timestamp = val['timestamp']
if ('current_value' in val):
self._value = self.item_type(val['current_value'])
if (('last_value' in val) and (val['last_value'] is not N... |
'Connect to our domain'
| def _connect(self):
| if (not self._db):
import boto
sdb = boto.connect_sdb()
if (not self.domain_name):
self.domain_name = boto.config.get('DB', 'sequence_db', boto.config.get('DB', 'db_name', 'default'))
try:
self._db = sdb.get_domain(self.domain_name)
except SDBResponseE... |
'Remove this sequence'
| def delete(self):
| self.db.delete_attributes(self.id)
|
'Not currently fully supported, but we can use this
to allow them to set a limit in a chainable method'
| def fetch(self, limit, offset=0):
| self.limit = limit
self.offset = offset
return self
|
'Save this object as it is, with an optional expected value
:param expected_value: Optional tuple of Attribute, and Value that
must be the same in order to save this object. If this
condition is not met, an SDBResponseError will be raised with a
Confict status code.
:type expected_value: tuple or list
:return: This obj... | def put(self, expected_value=None):
| self._manager.save_object(self, expected_value)
return self
|
'Save just these few attributes, not the whole object
:param attrs: Attributes to save, key->value dict
:type attrs: dict
:return: self
:rtype: :class:`boto.sdb.db.model.Model`'
| def put_attributes(self, attrs):
| assert isinstance(attrs, dict), 'Argument must be a dict of key->values to save'
for prop_name in attrs:
value = attrs[prop_name]
prop = self.find_property(prop_name)
assert prop, ('Property not found: %s' % prop_name)
self._manager.set_property(p... |
'Delete just these attributes, not the whole object.
:param attrs: Attributes to save, as a list of string names
:type attrs: list
:return: self
:rtype: :class:`boto.sdb.db.model.Model`'
| def delete_attributes(self, attrs):
| assert isinstance(attrs, list), 'Argument must be a list of names of keys to delete.'
self._manager.domain.delete_attributes(self.id, attrs)
self.reload()
return self
|
'Find a subclass with a given name'
| @classmethod
def find_subclass(cls, name):
| if (name == cls.__name__):
return cls
for sc in cls.__sub_classes__:
r = sc.find_subclass(name)
if (r is not None):
return r
|
'The hashfunc parameter overrides the default hashfunc in boto.utils.Password.
The remaining parameters are passed through to StringProperty.__init__'
| def __init__(self, verbose_name=None, name=None, default='', required=False, validator=None, choices=None, unique=False, hashfunc=None):
| super(PasswordProperty, self).__init__(verbose_name, name, default, required, validator, choices, unique)
self.hashfunc = hashfunc
|
'Don\'t allow this object to be associated to itself
This causes bad things to happen'
| def __set__(self, obj, value):
| if ((value is not None) and ((obj.id == value) or (hasattr(value, 'id') and (obj.id == value.id)))):
raise ValueError('Can not associate an object with itself!')
return super(ReferenceProperty, self).__set__(obj, value)
|
'Fetches collection of model instances of this collection property.'
| def __get__(self, model_instance, model_class):
| if (model_instance is not None):
query = Query(self.__model)
if isinstance(self.__property, list):
props = []
for prop in self.__property:
props.append(('%s =' % prop))
return query.filter(props, model_instance)
else:
return ... |
'Not possible to set a new collection.'
| def __set__(self, model_instance, value):
| raise ValueError('Virtual property is read-only')
|
'Not possible to set a new AutoID.'
| def __set__(self, obj, value):
| pass
|
'Override the set method to allow them to set the property to an instance of the item_type instead of requiring a list to be passed in'
| def __set__(self, obj, value):
| if (self.item_type in six.integer_types):
item_type = six.integer_types
elif (self.item_type in six.string_types):
item_type = six.string_types
else:
item_type = self.item_type
if isinstance(value, item_type):
value = [value]
elif (value is None):
value = []
... |
'Make a request on this connection'
| def _make_request(self, method, url, post_data=None, body=None):
| if (not self.connection):
self._connect()
try:
self.connection.close()
except:
pass
self.connection.connect()
headers = {}
if self.auth_header:
headers['Authorization'] = self.auth_header
self.connection.request(method, url, body, headers)
resp = self.conn... |
'Pull out the properties from this document
Returns the class, the properties in a hash, and the id if provided as a tuple
:return: (cls, props, id)'
| def get_props_from_doc(self, cls, id, doc):
| obj_node = doc.getElementsByTagName('object')[0]
if (not cls):
class_name = obj_node.getAttribute('class')
cls = find_class(class_name)
if (not id):
id = obj_node.getAttribute('id')
props = {}
for prop_node in obj_node.getElementsByTagName('property'):
prop_name = pro... |
'Marshal the object and do a PUT'
| def save_object(self, obj, expected_value=None):
| doc = self.marshal_object(obj)
if obj.id:
url = ('/%s/%s' % (self.db_name, obj.id))
else:
url = ('/%s' % self.db_name)
resp = self._make_request('PUT', url, body=doc.toxml())
new_obj = self.get_object_from_doc(obj.__class__, None, parse(resp))
obj.id = new_obj.id
for prop in ... |
'Same as unmarshalling an object, except it returns
from "get_props_from_doc"'
| def unmarshal_props(self, fp, cls=None, id=None):
| if isinstance(fp, six.string_types):
doc = parseString(fp)
else:
doc = parse(fp)
return self.get_props_from_doc(cls, id, doc)
|
'Decode a single element for a map'
| def decode_map_element(self, item_type, value):
| import urllib
key = value
if (':' in value):
(key, value) = value.split(':', 1)
key = urllib.unquote(key)
if (self.model_class in item_type.mro()):
value = item_type(id=value)
else:
value = self.decode(item_type, value)
return (key, value)
|
'See http://tools.ietf.org/html/draft-wood-ldapext-float-00.'
| def encode_float(self, value):
| s = ('%e' % value)
l = s.split('e')
mantissa = l[0].ljust(18, '0')
exponent = l[1]
if (value == 0.0):
case = '3'
exponent = '000'
elif ((mantissa[0] != '-') and (exponent[0] == '+')):
case = '5'
exponent = exponent[1:].rjust(3, '0')
elif ((mantissa[0] != '-') ... |
'Handles both Dates and DateTime objects'
| def decode_datetime(self, value):
| if (value is None):
return value
try:
if ('T' in value):
if ('.' in value):
return datetime.strptime(value.split('.')[0], '%Y-%m-%dT%H:%M:%S')
else:
return datetime.strptime(value, ISO8601)
else:
value = value.split('-')... |
'converts strings in the form of HH:MM:SS.mmmmmm
(created by datetime.time.isoformat()) to
datetime.time objects.
Timzone-aware strings ("HH:MM:SS.mmmmmm+HH:MM") won\'t
be handled right now and will raise TimeDecodeError.'
| def decode_time(self, value):
| if (('-' in value) or ('+' in value)):
raise TimeDecodeError(("Can't handle timezone aware objects: %r" % value))
tmp = value.split('.')
arg = map(int, tmp[0].split(':'))
if (len(tmp) == 2):
arg.append(int(tmp[1]))
return time(*arg)
|
'Convert ASCII, Latin-1 or UTF-8 to pure Unicode'
| def encode_string(self, value):
| if (not isinstance(value, str)):
return value
try:
return six.text_type(value, 'utf-8')
except:
arr = []
for ch in value:
arr.append(six.unichr(ord(ch)))
return u''.join(arr)
|
'Decoding a string is really nothing, just
return the value as-is'
| def decode_string(self, value):
| return value
|
'Get the number of results that would
be returned in this query'
| def count(self, cls, filters, quick=True, sort_by=None, select=None):
| query = ('select count(*) from `%s` %s' % (self.domain.name, self._build_filter_part(cls, filters, sort_by, select)))
count = 0
for row in self.domain.select(query):
count += int(row['Count'])
if quick:
return count
return count
|
'Build the filter part'
| def _build_filter_part(self, cls, filters, order_by=None, select=None):
| import types
query_parts = []
order_by_filtered = False
if order_by:
if (order_by[0] == '-'):
order_by_method = 'DESC'
order_by = order_by[1:]
else:
order_by_method = 'ASC'
if select:
if (order_by and (order_by in select)):
orde... |
'Get all decendents for a given class'
| def _get_all_decendents(self, cls):
| decendents = {}
for sc in cls.__sub_classes__:
decendents[sc.__name__] = sc
decendents.update(self._get_all_decendents(sc))
return decendents
|
':type domain: :py:class:`boto.sdb.domain.Domain`
:param domain: The domain that this item belongs to.
:param str name: The name of this item. This name will be used when
querying for items using methods like
:py:meth:`boto.sdb.domain.Domain.get_item`'
| def __init__(self, domain, name='', active=False):
| dict.__init__(self)
self.domain = domain
self.name = name
self.active = active
self.request_id = None
self.encoding = None
self.in_attribute = False
self.converter = self.domain.connection.converter
|
'Loads or re-loads this item\'s attributes from SDB.
.. warning::
If you have changed attribute values on an Item instance,
this method will over-write the values if they are different in
SDB. For any local attributes that don\'t yet exist in SDB,
they will be safe.'
| def load(self):
| self.domain.get_attributes(self.name, item=self)
|
'Saves this item to SDB.
:param bool replace: If ``True``, delete any attributes on the remote
SDB item that have a ``None`` value on this object.'
| def save(self, replace=True):
| self.domain.put_attributes(self.name, self, replace)
if replace:
del_attrs = []
for name in self:
if (self[name] is None):
del_attrs.append(name)
if (len(del_attrs) > 0):
self.domain.delete_attributes(self.name, del_attrs)
|
'Helps set or add to attributes on this item. If you are adding a new
attribute that has yet to be set, it will simply create an attribute
named ``key`` with your given ``value`` as its value. If you are
adding a value to an existing attribute, this method will convert the
attribute to a list (if it isn\'t already) and... | def add_value(self, key, value):
| if (key in self):
if (not isinstance(self[key], list)):
self[key] = [self[key]]
self[key].append(value)
else:
self[key] = value
|
'Deletes this item in SDB.
.. note:: This local Python object remains in its current state
after deletion, this only deletes the remote item in SDB.'
| def delete(self):
| self.domain.delete_item(self)
|
':param str name: A thread name. Used for identification.
:param str domain_name: The name of a SimpleDB
:class:`Domain <boto.sdb.domain.Domain>`
:type item_names: string or list of strings
:param item_names: The name(s) of the items to retrieve from the specified
:class:`Domain <boto.sdb.domain.Domain>`.
:ivar list it... | def __init__(self, name, domain_name, item_names):
| super(ItemThread, self).__init__(name=name)
self.domain_name = domain_name
self.conn = SDBConnection()
self.item_names = item_names
self.items = []
|
'Start the threaded retrieval of items. Populates the
``items`` list with :class:`Item <boto.sdb.item.Item>` objects.'
| def run(self):
| for item_name in self.item_names:
item = self.conn.get_attributes(self.domain_name, item_name)
self.items.append(item)
|
'For any keywords that aren\'t documented, refer to the parent class,
:py:class:`boto.connection.AWSAuthConnection`. You can avoid having
to worry about these keyword arguments by instantiating these objects
via :py:func:`boto.connect_sdb`.
:type region: :class:`boto.sdb.regioninfo.SDBRegionInfo`
:keyword region: Expli... | def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', converter=None, security_token=None, validate_certs=True, profile_name=None):
| if (not region):
region_name = boto.config.get('SDB', 'region', self.DefaultRegionName)
for reg in boto.sdb.regions():
if (reg.name == region_name):
region = reg
break
self.region = region
super(SDBConnection, self).__init__(aws_access_key_id, aws_... |
'While the default item class is :py:class:`boto.sdb.item.Item`, this
default may be overridden. Use this method to change a connection\'s
item class.
:param object cls: The new class to set as this connection\'s item
class. See the default item class for inspiration as to what your
replacement should/could look like.'... | def set_item_cls(self, cls):
| self.item_cls = cls
|
'Returns the BoxUsage (in USD) accumulated on this specific SDBConnection
instance.
.. tip:: This can be out of date, and should only be treated as a
rough estimate. Also note that this estimate only applies to the
requests made on this specific connection instance. It is by
no means an account-wide estimate.
:rtype: f... | def get_usage(self):
| return self.box_usage
|
'Print the BoxUsage and approximate costs of all requests made on
this specific SDBConnection instance.
.. tip:: This can be out of date, and should only be treated as a
rough estimate. Also note that this estimate only applies to the
requests made on this specific connection instance. It is by
no means an account-wide... | def print_usage(self):
| print ('Total Usage: %f compute seconds' % self.box_usage)
cost = (self.box_usage * 0.14)
print ('Approximate Cost: $%f' % cost)
|
'Retrieves a :py:class:`boto.sdb.domain.Domain` object whose name
matches ``domain_name``.
:param str domain_name: The name of the domain to retrieve
:keyword bool validate: When ``True``, check to see if the domain
actually exists. If ``False``, blindly return a
:py:class:`Domain <boto.sdb.domain.Domain>` object with ... | def get_domain(self, domain_name, validate=True):
| domain = Domain(self, domain_name)
if validate:
self.select(domain, ('select * from `%s` limit 1' % domain_name))
return domain
|
'Lookup an existing SimpleDB domain. This differs from
:py:meth:`get_domain` in that ``None`` is returned if ``validate`` is
``True`` and no match was found (instead of raising an exception).
:param str domain_name: The name of the domain to retrieve
:param bool validate: If ``True``, a ``None`` value will be returned
... | def lookup(self, domain_name, validate=True):
| try:
domain = self.get_domain(domain_name, validate)
except:
domain = None
return domain
|
'Returns a :py:class:`boto.resultset.ResultSet` containing
all :py:class:`boto.sdb.domain.Domain` objects associated with
this connection\'s Access Key ID.
:keyword int max_domains: Limit the returned
:py:class:`ResultSet <boto.resultset.ResultSet>` to the specified
number of members.
:keyword str next_token: A token s... | def get_all_domains(self, max_domains=None, next_token=None):
| params = {}
if max_domains:
params['MaxNumberOfDomains'] = max_domains
if next_token:
params['NextToken'] = next_token
return self.get_list('ListDomains', params, [('DomainName', Domain)])
|
'Create a SimpleDB domain.
:type domain_name: string
:param domain_name: The name of the new domain
:rtype: :class:`boto.sdb.domain.Domain` object
:return: The newly created domain'
| def create_domain(self, domain_name):
| params = {'DomainName': domain_name}
d = self.get_object('CreateDomain', params, Domain)
d.name = domain_name
return d
|
'Given a ``str`` or :class:`boto.sdb.domain.Domain`, return a
``tuple`` with the following members (in order):
* In instance of :class:`boto.sdb.domain.Domain` for the requested
domain
* The domain\'s name as a ``str``
:type domain_or_name: ``str`` or :class:`boto.sdb.domain.Domain`
:param domain_or_name: The domain or... | def get_domain_and_name(self, domain_or_name):
| if isinstance(domain_or_name, Domain):
return (domain_or_name, domain_or_name.name)
else:
return (self.get_domain(domain_or_name), domain_or_name)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.