Initializes the instance - basically setting the formatter to None and the filter list to empty.
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s Auto Scaling Service |
:type use_block_device_types bool :param use_block_device_types: Specifies whether to return described Launch Configs with block device mappings containing
block device types, or a list of old style block device mappings (deprecated). This defaults to false for compatability with the old incorrect style.
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s Elastic Beanstalk service |
Parameters: | |
---|---|
Return type: | boto.cloudformation.CloudFormationConnection |
Returns: | A connection to Amazon’s CloudFormation Service |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to FPS |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s CloudSearch service |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s CloudSearch2 service |
Connect to AWS CloudTrail
Parameters: | |
---|---|
Return type: | boto.cloudtrail.layer1.CloudtrailConnection |
Returns: | A connection to the AWS Cloudtrail service |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s EC2 Monitoring service |
Connect to Amazon Cognito Identity
Parameters: |
---|
rtype: boto.cognito.identity.layer1.CognitoIdentityConnection :return: A connection to the Amazon Cognito Identity service
Connect to Amazon Cognito Sync
Parameters: |
---|
rtype: boto.cognito.sync.layer1.CognitoSyncConnection :return: A connection to the Amazon Cognito Sync service
Connect to AWS DirectConnect
Parameters: | |
---|---|
Return type: | boto.directconnect.layer1.DirectConnectConnection |
Returns: | A connection to the AWS DirectConnect service |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to the Layer2 interface for DynamoDB. |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s EC2 |
Connect to an EC2 Api endpoint. Additional arguments are passed through to connect_ec2.
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Eucalyptus server |
Parameters: | |
---|---|
Return type: | boto.ets.layer1.ElasticTranscoderConnection |
Returns: | A connection to Amazon’s Elastic Transcoder service |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s Load Balancing Service |
Parameters: | |
---|---|
Return type: | boto.emr.EmrConnection |
Returns: | A connection to Elastic mapreduce |
Connect to a Eucalyptus service.
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Eucalyptus server |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to FPS |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s Glacier Service |
@type gs_access_key_id: string @param gs_access_key_id: Your Google Cloud Storage Access Key ID
@type gs_secret_access_key: string @param gs_secret_access_key: Your Google Cloud Storage Secret Access Key
@rtype: L{GSConnection<boto.gs.connection.GSConnection>} @return: A connection to Google’s Storage service
Connect to the Internet Archive via their S3-like API.
Parameters: |
|
---|---|
Return type: | |
Returns: | A connection to the Internet Archive |
Parameters: | |
---|---|
Return type: | boto.iam.IAMConnection |
Returns: | A connection to Amazon’s IAM |
Connect to Amazon Kinesis
Parameters: |
---|
rtype: boto.kinesis.layer1.KinesisConnection :return: A connection to the Amazon Kinesis service
Connect to Amazon CloudWatch Logs
Parameters: |
---|
rtype: boto.kinesis.layer1.CloudWatchLogsConnection :return: A connection to the Amazon CloudWatch Logs service
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to MTurk |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to RDS |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to RDS |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s Redshift service |
Parameters: | |
---|---|
Return type: | boto.dns.Route53Connection |
Returns: | A connection to Amazon’s Route53 DNS Service |
Connect to Amazon Route 53 Domains
Parameters: |
---|
rtype: boto.route53.domains.layer1.Route53DomainsConnection :return: A connection to the Amazon Route 53 Domains service
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s S3 |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s SDB |
Parameters: | |
---|---|
Return type: | boto.ses.SESConnection |
Returns: | A connection to Amazon’s SES |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s SNS |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s SQS |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s STS |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Amazon’s Support service |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to the Layer1 interface for SWF. |
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to VPC |
Connect to a Walrus service.
Parameters: | |
---|---|
Return type: | |
Returns: | A connection to Walrus |
Instantiate a StorageUri from a URI string.
Parameters: |
|
---|
We allow validate to be disabled to allow caller to implement bucket-level wildcarding (outside the boto library; see gsutil).
Return type: | boto.StorageUri subclass |
---|---|
Returns: | StorageUri subclass for given URI. |
uri_str must be one of the following formats:
The last example uses the default scheme (‘file’, unless overridden).
Returns a StorageUri for the given key.
Parameters: | key (boto.s3.key.Key or subclass) – URI naming bucket + optional object. |
---|
Handles basic connections to AWS
Parameters: |
|
---|
(Optional) Close any open HTTP connections. This is non-destructive, and making a new request will open a connection again.
Makes a request to the server, with stock multiple-retry logic.
alias of BotoServerError
Serialize a list of structures.
For example:
items = [('foo', 'bar', 'baz'), ('foo2', 'bar2', 'baz2')]
label = 'ParamName.member'
names = ('One', 'Two', 'Three')
self.build_complex_list_params(params, items, label, names)
would result in the params dict being updated with these params:
ParamName.member.1.One = foo
ParamName.member.1.Two = bar
ParamName.member.1.Three = baz
ParamName.member.2.One = foo2
ParamName.member.2.Two = bar2
ParamName.member.2.Three = baz2
Parameters: |
---|
A connection pool that expires connections after a fixed period of time. This saves time spent waiting for a connection that AWS has timed out on the other end.
This class is thread-safe.
Clean up the stale connections in all of the pools, and then get rid of empty pools. Pools clean themselves every time a connection is fetched; this cleaning takes care of pools that aren’t being used any more, so nothing is being gotten from them.
Gets a connection from the pool for the named host. Returns None if there is no connection that can be reused. It’s the caller’s responsibility to call close() on the connection when it’s no longer needed.
Adds a connection to the pool of connections that can be reused for the named host.
Returns the number of connections in the pool.
Represents an HTTP request.
Parameters: |
|
---|
Read the response.
This method does not have the same behavior as http_client.HTTPResponse.read. Instead, if this method is called with no amt arg, then the response body will be cached. Subsequent calls to read() with no args will return the cached response.
A pool of connections for one remote (host,port,is_secure).
When connections are added to the pool, they are put into a pending queue. The _mexe method returns connections to the pool before the response body has been read, so they connections aren’t ready to send another request yet. They stay in the pending queue until they are ready for another request, at which point they are returned to the pool of ready connections.
The pool of ready connections is an ordered list of (connection,time) pairs, where the time is the time the connection was returned from _mexe. After a certain period of time, connections are considered stale, and discarded rather than being reused. This saves having to wait for the connection to time out if AWS has decided to close it on the other end because of inactivity.
Thread Safety:
This class is used only from ConnectionPool while it’s mutex is held.
Get rid of stale connections.
Returns the next connection in this pool that is ready to be reused. Returns None if there aren’t any.
Adds a connection to the pool, along with the time it was added.
Returns the number of connections in the pool for this host. Some of the connections may still be in use, and may not be ready to be returned by get().
Exception classes - Subclassing allows you to check for specific errors
General error connecting to Amazon Web Services.
General Boto Client error (error accessing AWS)
Error in response from EC2.
Error in response from EMR
Error copying a key on GS.
Error creating a bucket or key on GS.
Error receiving data from GS.
Permissions error when accessing a bucket or key on GS.
Error in response from GS.
Exception raised when ACL XML is invalid.
Exception raised when CORS XML is invalid.
Exception raised when GCS lifecycle configuration XML is invalid.
Exception raised when URI is invalid.
This exception expects the fully parsed and decoded JSON response body to be passed as the body parameter.
Variables: |
|
---|
Is raised when no auth handlers were found ready to authenticate.
Indicates a request should be retried.
Exception raised for various resumable download problems.
self.disposition is of type ResumableTransferDisposition.
Exception raised for various resumable upload problems.
self.disposition is of type ResumableTransferDisposition.
Error copying a key on S3.
Error creating a bucket or key on S3.
Error receiving data from S3.
Permissions error when accessing a bucket or key on S3.
Error in response from S3.
Error in responses from SDB.
Error when decoding an SQS message.
General Error on Simple Queue Service.
Error copying a key on a storage service.
Error creating a bucket or key on a storage service.
Error receiving data from a storage service.
Permissions error when accessing a bucket or key on a storage service.
Error in response from a storage service.
Exception raised when a search of Route53 records returns more records than requested.
The ResultSet is used to pass results back from the Amazon services to the client. It is light wrapper around Python’s list class, with some additional methods for parsing XML results from AWS. Because I don’t really want any dependencies on external libraries, I’m using the standard SAX parser that comes with Python. The good news is that it’s quite fast and efficient but it makes some things rather difficult.
You can pass in, as the marker_elem parameter, a list of tuples. Each tuple contains a string as the first element which represents the XML element that the resultset needs to be on the lookout for and a Python class as the second element of the tuple. Each time the specified element is found in the XML, a new instance of the class will be created and popped onto the stack.
Variables: | next_token (str) – A hash used to assist in paging through very long result sets. In most cases, passing this value to certain methods will give you another ‘page’ of results. |
---|
Some handy utility functions used by several classes.
This class extends the SMTPHandler in the standard Python logging module to accept a username and password on the constructor and to then use those credentials to authenticate with the SMTP server. To use this, you could add something like this in your boto config file:
[handler_hand07] class=boto.utils.AuthSMTPHandler level=WARN formatter=form07 args=(‘localhost’, ‘username’, ‘password’, 'from@abc‘, ['user1@abc‘, 'user2@xyz‘], ‘Logger Subject’)
Initialize the handler.
We have extended the constructor to accept a username/password for SMTP authentication.
Emit a record.
Format the record and send it to the specified addressees. It would be really nice if I could add authorization to this class without having to resort to cut and paste inheritance but, no.
A dictionary-like object that stores only a certain number of items, and discards its least recently used item when full.
>>> cache = LRUCache(3)
>>> cache['A'] = 0
>>> cache['B'] = 1
>>> cache['C'] = 2
>>> len(cache)
3
>>> cache['A']
0
Adding new items to the cache does not increase its size. Instead, the least recently used item is dropped:
>>> cache['D'] = 3
>>> len(cache)
3
>>> 'B' in cache
False
Iterating over the cache returns the keys, starting with the most recently used:
>>> for key in cache:
... print key
D
A
C
This code is based on the LRUCache class from Genshi which is based on Myghty‘s LRUCache from myghtyutils.util, written by Mike Bayer and released under the MIT license (Genshi uses the BSD License).
Password object that stores itself as hashed. Hash defaults to SHA512 if available, MD5 otherwise.
Load the string from an initial value, this should be the raw hashed password.
Returns a sha512 hash object; optionally initialized with a string
This can be extended and supplied to the connection object to gain access to request and response object after the request completes. One use for this would be to implement some specific request logging.
The STDIN and STDERR output of the command
The exit code for the command
Generates the aws canonical string for the given parameters
Compute MD5 hash on passed file and return results in a tuple of values.
Parameters: |
|
---|---|
Return type: | tuple |
Returns: | A tuple containing the hex digest version of the MD5 hash as the first element, the base64 encoded version of the plain digest as the second element and the data size as the third element. |
Fetch a file based on the URI provided. If you do not pass in a file pointer a tempfile.NamedTemporaryFile, or None if the file could not be retrieved is returned. The URI can be either an HTTP url, or “s3://bucket_name/key_name”
Takes a specific header name and a dict of headers {“name”: “value”}. Returns a list of matching header names, case-insensitive.
Returns the instance identity as a nested Python dictionary.
Returns the instance metadata as a nested Python dictionary. Simple values (e.g. local_hostname, hostname, etc.) will be stored as string values. Values such as ancestor-ami-ids will be stored in the dict as a list of string values. More complex fields such as public-keys and will be stored as nested dicts.
If the timeout is specified, the connection to the specified url will time out after the specified number of seconds.
Description: Guess the mime type of a block of text :param content: content we’re finding the type of :type str:
Parameters: | deftype – Default mime type |
---|---|
Return type: | <type>: |
Returns: | <description> |
Takes a specific header name and a dict of headers {“name”: “value”}. Returns a string of all header values, comma-separated, that match the input header name, case-insensitive.
Convert camel case to a “pythonic” name.
Examples:
pythonize_name('CamelCase') -> 'camel_case'
pythonize_name('already_pythonized') -> 'already_pythonized'
pythonize_name('HTTPRequest') -> 'http_request'
pythonize_name('HTTPStatus200Ok') -> 'http_status_200_ok'
pythonize_name('UPPER') -> 'upper'
pythonize_name('') -> ''
Retry a url. This is specifically used for accessing the metadata service on an instance. Since this address should never be proxied (for security reasons), we create a ProxyHandler with a NULL dictionary to override any proxy settings in the environment.
A context manager to set the locale in a threadsafe manner.
Update your Dynamic DNS record with DNSMadeEasy.com
Description: :param content: A list of tuples of name-content pairs. This is used instead of a dict to ensure that scripts run in order :type list of tuples:
Parameters: |
|
---|---|
Returns: | Final mime multipart |
Return type: | str: |