Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1304)

Unified Diff: third_party/boto/boto/rds/__init__.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/boto/boto/pyami/config.py ('k') | third_party/boto/boto/rds/logfile.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/boto/boto/rds/__init__.py
===================================================================
--- third_party/boto/boto/rds/__init__.py (revision 33376)
+++ third_party/boto/boto/rds/__init__.py (working copy)
@@ -31,7 +31,10 @@
from boto.rds.regioninfo import RDSRegionInfo
from boto.rds.dbsubnetgroup import DBSubnetGroup
from boto.rds.vpcsecuritygroupmembership import VPCSecurityGroupMembership
+from boto.regioninfo import get_regions
+from boto.rds.logfile import LogFile, LogFileObject
+
def regions():
"""
Get all available regions for the RDS service.
@@ -39,27 +42,11 @@
:rtype: list
:return: A list of :class:`boto.rds.regioninfo.RDSRegionInfo`
"""
- return [RDSRegionInfo(name='us-east-1',
- endpoint='rds.amazonaws.com'),
- RDSRegionInfo(name='us-gov-west-1',
- endpoint='rds.us-gov-west-1.amazonaws.com'),
- RDSRegionInfo(name='eu-west-1',
- endpoint='rds.eu-west-1.amazonaws.com'),
- RDSRegionInfo(name='us-west-1',
- endpoint='rds.us-west-1.amazonaws.com'),
- RDSRegionInfo(name='us-west-2',
- endpoint='rds.us-west-2.amazonaws.com'),
- RDSRegionInfo(name='sa-east-1',
- endpoint='rds.sa-east-1.amazonaws.com'),
- RDSRegionInfo(name='ap-northeast-1',
- endpoint='rds.ap-northeast-1.amazonaws.com'),
- RDSRegionInfo(name='ap-southeast-1',
- endpoint='rds.ap-southeast-1.amazonaws.com'),
- RDSRegionInfo(name='ap-southeast-2',
- endpoint='rds.ap-southeast-2.amazonaws.com'),
- RDSRegionInfo(name='cn-north-1',
- endpoint='rds.cn-north-1.amazonaws.com.cn'),
- ]
+ return get_regions(
+ 'rds',
+ region_cls=RDSRegionInfo,
+ connection_cls=RDSConnection
+ )
def connect_to_region(region_name, **kw_params):
@@ -94,7 +81,8 @@
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='/',
- security_token=None, validate_certs=True):
+ security_token=None, validate_certs=True,
+ profile_name=None):
if not region:
region = RDSRegionInfo(self, self.DefaultRegionName,
self.DefaultRegionEndpoint)
@@ -106,7 +94,8 @@
self.region.endpoint, debug,
https_connection_factory, path,
security_token,
- validate_certs=validate_certs)
+ validate_certs=validate_certs,
+ profile_name=profile_name)
def _required_auth_capability(self):
return ['hmac-v4']
@@ -1087,6 +1076,91 @@
return self.get_list('DescribeDBSnapshots', params,
[('DBSnapshot', DBSnapshot)])
+ def get_all_logs(self, dbinstance_id, max_records=None, marker=None, file_size=None, filename_contains=None, file_last_written=None):
+ """
+ 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 this size in bytes.
+
+ :filename_contains: str
+ :param filename_contains: Filter results to files with filename containing this string
+
+ :file_last_written: int
+ :param file_last_written: Filter results to files written after this time (POSIX timestamp)
+
+ :rtype: list
+ :return: A list of :class:`boto.rds.logfile.LogFile`
+ """
+ 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
+
+ if max_records:
+ params['MaxRecords'] = max_records
+
+ return self.get_list('DescribeDBLogFiles', params,
+ [('DescribeDBLogFilesDetails',LogFile)])
+
+ def get_log_file(self, dbinstance_id, log_file_name, marker=None, number_of_lines=None, max_records=None):
+ """
+ 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 marker is specified, this will fetch log lines from the end of file instead.
+
+ :type number_of_lines: int
+ :param marker: The maximium number of lines to be returned.
+ """
+
+ 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('DownloadDBLogFilePortion', params, LogFileObject)
+
+ if logfile:
+ logfile.log_filename = log_file_name
+ logfile.dbinstance_id = dbinstance_id
+
+ return logfile
+
def create_dbsnapshot(self, snapshot_id, dbinstance_id):
"""
Create a new DB snapshot.
« no previous file with comments | « third_party/boto/boto/pyami/config.py ('k') | third_party/boto/boto/rds/logfile.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698