Python boto 模块,connection() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用boto.connection()

项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def confirm_connection(self, connection_id):
        """
        Confirm the creation of a hosted connection on an
        interconnect.

        Upon creation, the hosted connection is initially in the
        'Ordering' state, and will remain in this state until the
        owner calls ConfirmConnection to confirm creation of the
        hosted connection.

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        """
        params = {'connectionId': connection_id, }
        return self.make_request(action='ConfirmConnection',
                                 body=json.dumps(params))
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def delete_connection(self, connection_id):
        """
        Deletes the connection.

        Deleting a connection only stops the AWS Direct Connect port
        hour and data transfer charges. You need to cancel separately
        with the providers any services or charges for cross-connects
        or network circuits that connect you to the AWS Direct Connect
        location.

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        """
        params = {'connectionId': connection_id, }
        return self.make_request(action='DeleteConnection',
                                 body=json.dumps(params))
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def describe_connections(self, connection_id=None):
        """
        Displays all connections in this region.

        If a connection ID is provided, the call returns only that
        particular connection.

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        """
        params = {}
        if connection_id is not None:
            params['connectionId'] = connection_id
        return self.make_request(action='DescribeConnections',
                                 body=json.dumps(params))
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def describe_connections_on_interconnect(self, interconnect_id):
        """
        Return a list of connections that have been provisioned on the
        given interconnect.

        :type interconnect_id: string
        :param interconnect_id: ID of the interconnect on which a list of
            connection is provisioned.
        Example: dxcon-abc123

        Default: None

        """
        params = {'interconnectId': interconnect_id, }
        return self.make_request(action='DescribeConnectionsOnInterconnect',
                                 body=json.dumps(params))
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
                 is_secure=True, host=None, port=None,
                 proxy=None, proxy_port=None,
                 proxy_user=None, proxy_pass=None, debug=0,
                 https_connection_factory=None, region=None, path='/',
                 api_version=None, security_token=None,
                 validate_certs=True, profile_name=None):
        """
        Init method to create a new connection to EC2.
        """
        if not region:
            region = RegionInfo(self, self.DefaultRegionName,
                                self.DefaultRegionEndpoint)
        self.region = region
        super(EC2Connection, self).__init__(aws_access_key_id,
                                            aws_secret_access_key,
                                            is_secure, port, proxy, proxy_port,
                                            proxy_user, proxy_pass,
                                            self.region.endpoint, debug,
                                            https_connection_factory, path,
                                            security_token,
                                            validate_certs=validate_certs,
                                            profile_name=profile_name)
        if api_version:
            self.APIVersion = api_version
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
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='/',
                 security_token=None, validate_certs=True, profile_name=None):
        """
        Init method to create a new connection to EC2 Load Balancing Service.

        .. note:: The region argument is overridden by the region specified in
            the boto configuration file.
        """
        if not region:
            region = RegionInfo(self, self.DefaultRegionName,
                                self.DefaultRegionEndpoint)
        self.region = region
        super(ELBConnection, self).__init__(aws_access_key_id,
                                            aws_secret_access_key,
                                            is_secure, port, proxy, proxy_port,
                                            proxy_user, proxy_pass,
                                            self.region.endpoint, debug,
                                            https_connection_factory, path,
                                            security_token,
                                            validate_certs=validate_certs,
                                            profile_name=profile_name)
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def create_invalidation_request(self, distribution_id, paths,
                                    caller_reference=None):
        """Creates a new invalidation request
            :see: http://goo.gl/8vECq
        """
        # We allow you to pass in either an array or
        # an InvalidationBatch object
        if not isinstance(paths, InvalidationBatch):
            paths = InvalidationBatch(paths)
        paths.connection = self
        uri = '/%s/distribution/%s/invalidation' % (self.Version,
                                                    distribution_id)
        response = self.make_request('POST', uri,
                                     {'Content-Type': 'text/xml'},
                                     data=paths.to_xml())
        body = response.read()
        if response.status == 201:
            h = handler.XmlHandler(paths, self)
            xml.sax.parseString(body, h)
            return paths
        else:
            raise CloudFrontServerError(response.status, response.reason, body)
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def get_all_domains(self, max_domains=None, next_token=None):
        """
        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 string that was returned in an
            earlier call to this method as the ``next_token`` attribute
            on the returned :py:class:`ResultSet <boto.resultset.ResultSet>`
            object. This attribute is set if there are more than Domains than
            the value specified in the ``max_domains`` keyword. Pass the
            ``next_token`` value from you earlier query in this keyword to
            get the next 'page' of domains.
        """
        params = {}
        if max_domains:
            params['MaxNumberOfDomains'] = max_domains
        if next_token:
            params['NextToken'] = next_token
        return self.get_list('ListDomains', params, [('DomainName', Domain)])
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def describe_logging_status(self, cluster_identifier):
        """
        Describes whether information, such as queries and connection
        attempts, is being logged for the specified Amazon Redshift
        cluster.

        :type cluster_identifier: string
        :param cluster_identifier: The identifier of the cluster to get the
            logging status from.
        Example: `examplecluster`

        """
        params = {'ClusterIdentifier': cluster_identifier, }
        return self._make_request(
            action='DescribeLoggingStatus',
            verb='POST',
            path='/', params=params)
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
def confirm_connection(self, connection_id):
        """
        Confirm the creation of a hosted connection on an
        interconnect.

        Upon creation, the hosted connection is initially in the
        'Ordering' state, and will remain in this state until the
        owner calls ConfirmConnection to confirm creation of the
        hosted connection.

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        """
        params = {'connectionId': connection_id, }
        return self.make_request(action='ConfirmConnection',
                                 body=json.dumps(params))
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
def delete_connection(self, connection_id):
        """
        Deletes the connection.

        Deleting a connection only stops the AWS Direct Connect port
        hour and data transfer charges. You need to cancel separately
        with the providers any services or charges for cross-connects
        or network circuits that connect you to the AWS Direct Connect
        location.

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        """
        params = {'connectionId': connection_id, }
        return self.make_request(action='DeleteConnection',
                                 body=json.dumps(params))
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
def describe_connections(self, connection_id=None):
        """
        Displays all connections in this region.

        If a connection ID is provided, the call returns only that
        particular connection.

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        """
        params = {}
        if connection_id is not None:
            params['connectionId'] = connection_id
        return self.make_request(action='DescribeConnections',
                                 body=json.dumps(params))
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
def describe_connections_on_interconnect(self, interconnect_id):
        """
        Return a list of connections that have been provisioned on the
        given interconnect.

        :type interconnect_id: string
        :param interconnect_id: ID of the interconnect on which a list of
            connection is provisioned.
        Example: dxcon-abc123

        Default: None

        """
        params = {'interconnectId': interconnect_id, }
        return self.make_request(action='DescribeConnectionsOnInterconnect',
                                 body=json.dumps(params))
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
                 is_secure=True, host=None, port=None,
                 proxy=None, proxy_port=None,
                 proxy_user=None, proxy_pass=None, debug=0,
                 https_connection_factory=None, region=None, path='/',
                 api_version=None, security_token=None,
                 validate_certs=True, profile_name=None):
        """
        Init method to create a new connection to EC2.
        """
        if not region:
            region = RegionInfo(self, self.DefaultRegionName,
                                self.DefaultRegionEndpoint)
        self.region = region
        super(EC2Connection, self).__init__(aws_access_key_id,
                                            aws_secret_access_key,
                                            is_secure, port, proxy, proxy_port,
                                            proxy_user, proxy_pass,
                                            self.region.endpoint, debug,
                                            https_connection_factory, path,
                                            security_token,
                                            validate_certs=validate_certs,
                                            profile_name=profile_name)
        if api_version:
            self.APIVersion = api_version
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
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='/',
                 security_token=None, validate_certs=True, profile_name=None):
        """
        Init method to create a new connection to EC2 Load Balancing Service.

        .. note:: The region argument is overridden by the region specified in
            the boto configuration file.
        """
        if not region:
            region = RegionInfo(self, self.DefaultRegionName,
                                self.DefaultRegionEndpoint)
        self.region = region
        super(ELBConnection, self).__init__(aws_access_key_id,
                                            aws_secret_access_key,
                                            is_secure, port, proxy, proxy_port,
                                            proxy_user, proxy_pass,
                                            self.region.endpoint, debug,
                                            https_connection_factory, path,
                                            security_token,
                                            validate_certs=validate_certs,
                                            profile_name=profile_name)
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
def create_invalidation_request(self, distribution_id, paths,
                                    caller_reference=None):
        """Creates a new invalidation request
            :see: http://goo.gl/8vECq
        """
        # We allow you to pass in either an array or
        # an InvalidationBatch object
        if not isinstance(paths, InvalidationBatch):
            paths = InvalidationBatch(paths)
        paths.connection = self
        uri = '/%s/distribution/%s/invalidation' % (self.Version,
                                                    distribution_id)
        response = self.make_request('POST', uri,
                                     {'Content-Type': 'text/xml'},
                                     data=paths.to_xml())
        body = response.read()
        if response.status == 201:
            h = handler.XmlHandler(paths, self)
            xml.sax.parseString(body, h)
            return paths
        else:
            raise CloudFrontServerError(response.status, response.reason, body)
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
def get_all_domains(self, max_domains=None, next_token=None):
        """
        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 string that was returned in an
            earlier call to this method as the ``next_token`` attribute
            on the returned :py:class:`ResultSet <boto.resultset.ResultSet>`
            object. This attribute is set if there are more than Domains than
            the value specified in the ``max_domains`` keyword. Pass the
            ``next_token`` value from you earlier query in this keyword to
            get the next 'page' of domains.
        """
        params = {}
        if max_domains:
            params['MaxNumberOfDomains'] = max_domains
        if next_token:
            params['NextToken'] = next_token
        return self.get_list('ListDomains', params, [('DomainName', Domain)])
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
def describe_logging_status(self, cluster_identifier):
        """
        Describes whether information, such as queries and connection
        attempts, is being logged for the specified Amazon Redshift
        cluster.

        :type cluster_identifier: string
        :param cluster_identifier: The identifier of the cluster to get the
            logging status from.
        Example: `examplecluster`

        """
        params = {'ClusterIdentifier': cluster_identifier, }
        return self._make_request(
            action='DescribeLoggingStatus',
            verb='POST',
            path='/', params=params)
项目:Chromium_DepotTools    作者:p07r0457    | 项目源码 | 文件源码
def __init__(self, **args):
        self.args = args
        self.check_for_credential_file()
        self.check_for_env_url()
        if 'host' not in self.args:
            if self.Regions:
                region_name = self.args.get('region_name',
                                            self.Regions[0]['name'])
                for region in self.Regions:
                    if region['name'] == region_name:
                        self.args['host'] = region['endpoint']
        if 'path' not in self.args:
            self.args['path'] = self.Path
        if 'port' not in self.args:
            self.args['port'] = self.Port
        try:
            boto.connection.AWSQueryConnection.__init__(self, **self.args)
            self.aws_response = None
        except boto.exception.NoAuthHandlerFound:
            raise NoCredentialsError()
项目:node-gn    作者:Shouqun    | 项目源码 | 文件源码
def _check_final_md5(self, key, etag):
        """
        Checks that etag from server agrees with md5 computed before upload.
        This is important, since the upload could have spanned a number of
        hours and multiple processes (e.g., gsutil runs), and the user could
        change some of the file and not realize they have inconsistent data.
        """
        if key.bucket.connection.debug >= 1:
            print 'Checking md5 against etag.'
        if key.md5 != etag.strip('"\''):
            # Call key.open_read() before attempting to delete the
            # (incorrect-content) key, so we perform that request on a
            # different HTTP connection. This is neededb because httplib
            # will return a "Response not ready" error if you try to perform
            # a second transaction on the connection.
            key.open_read()
            key.close()
            key.delete()
            raise ResumableUploadException(
                'File changed during upload: md5 signature doesn\'t match etag '
                '(incorrect uploaded object deleted)',
                ResumableTransferDisposition.ABORT)
项目:node-gn    作者:Shouqun    | 项目源码 | 文件源码
def __init__(self, **args):
        self.args = args
        self.check_for_credential_file()
        self.check_for_env_url()
        if 'host' not in self.args:
            if self.Regions:
                region_name = self.args.get('region_name',
                                            self.Regions[0]['name'])
                for region in self.Regions:
                    if region['name'] == region_name:
                        self.args['host'] = region['endpoint']
        if 'path' not in self.args:
            self.args['path'] = self.Path
        if 'port' not in self.args:
            self.args['port'] = self.Port
        try:
            boto.connection.AWSQueryConnection.__init__(self, **self.args)
            self.aws_response = None
        except boto.exception.NoAuthHandlerFound:
            raise NoCredentialsError()
项目:alfred-ec2    作者:SoMuchToGrok    | 项目源码 | 文件源码
def confirm_connection(self, connection_id):
        """
        Confirm the creation of a hosted connection on an
        interconnect.

        Upon creation, the hosted connection is initially in the
        'Ordering' state, and will remain in this state until the
        owner calls ConfirmConnection to confirm creation of the
        hosted connection.

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        """
        params = {'connectionId': connection_id, }
        return self.make_request(action='ConfirmConnection',
                                 body=json.dumps(params))
项目:alfred-ec2    作者:SoMuchToGrok    | 项目源码 | 文件源码
def delete_connection(self, connection_id):
        """
        Deletes the connection.

        Deleting a connection only stops the AWS Direct Connect port
        hour and data transfer charges. You need to cancel separately
        with the providers any services or charges for cross-connects
        or network circuits that connect you to the AWS Direct Connect
        location.

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        """
        params = {'connectionId': connection_id, }
        return self.make_request(action='DeleteConnection',
                                 body=json.dumps(params))
项目:alfred-ec2    作者:SoMuchToGrok    | 项目源码 | 文件源码
def describe_connections(self, connection_id=None):
        """
        Displays all connections in this region.

        If a connection ID is provided, the call returns only that
        particular connection.

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        """
        params = {}
        if connection_id is not None:
            params['connectionId'] = connection_id
        return self.make_request(action='DescribeConnections',
                                 body=json.dumps(params))
项目:alfred-ec2    作者:SoMuchToGrok    | 项目源码 | 文件源码
def describe_connections_on_interconnect(self, interconnect_id):
        """
        Return a list of connections that have been provisioned on the
        given interconnect.

        :type interconnect_id: string
        :param interconnect_id: ID of the interconnect on which a list of
            connection is provisioned.
        Example: dxcon-abc123

        Default: None

        """
        params = {'interconnectId': interconnect_id, }
        return self.make_request(action='DescribeConnectionsOnInterconnect',
                                 body=json.dumps(params))
项目:alfred-ec2    作者:SoMuchToGrok    | 项目源码 | 文件源码
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
                 is_secure=True, host=None, port=None,
                 proxy=None, proxy_port=None,
                 proxy_user=None, proxy_pass=None, debug=0,
                 https_connection_factory=None, region=None, path='/',
                 api_version=None, security_token=None,
                 validate_certs=True, profile_name=None):
        """
        Init method to create a new connection to EC2.
        """
        if not region:
            region = RegionInfo(self, self.DefaultRegionName,
                                self.DefaultRegionEndpoint)
        self.region = region
        super(EC2Connection, self).__init__(aws_access_key_id,
                                            aws_secret_access_key,
                                            is_secure, port, proxy, proxy_port,
                                            proxy_user, proxy_pass,
                                            self.region.endpoint, debug,
                                            https_connection_factory, path,
                                            security_token,
                                            validate_certs=validate_certs,
                                            profile_name=profile_name)
        if api_version:
            self.APIVersion = api_version
项目:alfred-ec2    作者:SoMuchToGrok    | 项目源码 | 文件源码
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='/',
                 security_token=None, validate_certs=True, profile_name=None):
        """
        Init method to create a new connection to EC2 Load Balancing Service.

        .. note:: The region argument is overridden by the region specified in
            the boto configuration file.
        """
        if not region:
            region = RegionInfo(self, self.DefaultRegionName,
                                self.DefaultRegionEndpoint)
        self.region = region
        super(ELBConnection, self).__init__(aws_access_key_id,
                                            aws_secret_access_key,
                                            is_secure, port, proxy, proxy_port,
                                            proxy_user, proxy_pass,
                                            self.region.endpoint, debug,
                                            https_connection_factory, path,
                                            security_token,
                                            validate_certs=validate_certs,
                                            profile_name=profile_name)
项目:alfred-ec2    作者:SoMuchToGrok    | 项目源码 | 文件源码
def create_invalidation_request(self, distribution_id, paths,
                                    caller_reference=None):
        """Creates a new invalidation request
            :see: http://goo.gl/8vECq
        """
        # We allow you to pass in either an array or
        # an InvalidationBatch object
        if not isinstance(paths, InvalidationBatch):
            paths = InvalidationBatch(paths)
        paths.connection = self
        uri = '/%s/distribution/%s/invalidation' % (self.Version,
                                                    distribution_id)
        response = self.make_request('POST', uri,
                                     {'Content-Type': 'text/xml'},
                                     data=paths.to_xml())
        body = response.read()
        if response.status == 201:
            h = handler.XmlHandler(paths, self)
            xml.sax.parseString(body, h)
            return paths
        else:
            raise CloudFrontServerError(response.status, response.reason, body)
项目:alfred-ec2    作者:SoMuchToGrok    | 项目源码 | 文件源码
def get_all_domains(self, max_domains=None, next_token=None):
        """
        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 string that was returned in an
            earlier call to this method as the ``next_token`` attribute
            on the returned :py:class:`ResultSet <boto.resultset.ResultSet>`
            object. This attribute is set if there are more than Domains than
            the value specified in the ``max_domains`` keyword. Pass the
            ``next_token`` value from you earlier query in this keyword to
            get the next 'page' of domains.
        """
        params = {}
        if max_domains:
            params['MaxNumberOfDomains'] = max_domains
        if next_token:
            params['NextToken'] = next_token
        return self.get_list('ListDomains', params, [('DomainName', Domain)])
项目:alfred-ec2    作者:SoMuchToGrok    | 项目源码 | 文件源码
def describe_logging_status(self, cluster_identifier):
        """
        Describes whether information, such as queries and connection
        attempts, is being logged for the specified Amazon Redshift
        cluster.

        :type cluster_identifier: string
        :param cluster_identifier: The identifier of the cluster to get the
            logging status from.
        Example: `examplecluster`

        """
        params = {'ClusterIdentifier': cluster_identifier, }
        return self._make_request(
            action='DescribeLoggingStatus',
            verb='POST',
            path='/', params=params)
项目:depot_tools    作者:webrtc-uwp    | 项目源码 | 文件源码
def _check_final_md5(self, key, etag):
        """
        Checks that etag from server agrees with md5 computed before upload.
        This is important, since the upload could have spanned a number of
        hours and multiple processes (e.g., gsutil runs), and the user could
        change some of the file and not realize they have inconsistent data.
        """
        if key.bucket.connection.debug >= 1:
            print 'Checking md5 against etag.'
        if key.md5 != etag.strip('"\''):
            # Call key.open_read() before attempting to delete the
            # (incorrect-content) key, so we perform that request on a
            # different HTTP connection. This is neededb because httplib
            # will return a "Response not ready" error if you try to perform
            # a second transaction on the connection.
            key.open_read()
            key.close()
            key.delete()
            raise ResumableUploadException(
                'File changed during upload: md5 signature doesn\'t match etag '
                '(incorrect uploaded object deleted)',
                ResumableTransferDisposition.ABORT)
项目:depot_tools    作者:webrtc-uwp    | 项目源码 | 文件源码
def __init__(self, **args):
        self.args = args
        self.check_for_credential_file()
        self.check_for_env_url()
        if 'host' not in self.args:
            if self.Regions:
                region_name = self.args.get('region_name',
                                            self.Regions[0]['name'])
                for region in self.Regions:
                    if region['name'] == region_name:
                        self.args['host'] = region['endpoint']
        if 'path' not in self.args:
            self.args['path'] = self.Path
        if 'port' not in self.args:
            self.args['port'] = self.Port
        try:
            boto.connection.AWSQueryConnection.__init__(self, **self.args)
            self.aws_response = None
        except boto.exception.NoAuthHandlerFound:
            raise NoCredentialsError()
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def allocate_private_virtual_interface(self, connection_id,
                                           owner_account,
                                           new_private_virtual_interface_allocation):
        """
        Provisions a private virtual interface to be owned by a
        different customer.

        The owner of a connection calls this function to provision a
        private virtual interface which will be owned by another AWS
        customer.

        Virtual interfaces created using this function must be
        confirmed by the virtual interface owner by calling
        ConfirmPrivateVirtualInterface. Until this step has been
        completed, the virtual interface will be in 'Confirming'
        state, and will not be available for handling traffic.

        :type connection_id: string
        :param connection_id: The connection ID on which the private virtual
            interface is provisioned.
        Default: None

        :type owner_account: string
        :param owner_account: The AWS account that will own the new private
            virtual interface.
        Default: None

        :type new_private_virtual_interface_allocation: dict
        :param new_private_virtual_interface_allocation: Detailed information
            for the private virtual interface to be provisioned.
        Default: None

        """
        params = {
            'connectionId': connection_id,
            'ownerAccount': owner_account,
            'newPrivateVirtualInterfaceAllocation': new_private_virtual_interface_allocation,
        }
        return self.make_request(action='AllocatePrivateVirtualInterface',
                                 body=json.dumps(params))
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def allocate_public_virtual_interface(self, connection_id, owner_account,
                                          new_public_virtual_interface_allocation):
        """
        Provisions a public virtual interface to be owned by a
        different customer.

        The owner of a connection calls this function to provision a
        public virtual interface which will be owned by another AWS
        customer.

        Virtual interfaces created using this function must be
        confirmed by the virtual interface owner by calling
        ConfirmPublicVirtualInterface. Until this step has been
        completed, the virtual interface will be in 'Confirming'
        state, and will not be available for handling traffic.

        :type connection_id: string
        :param connection_id: The connection ID on which the public virtual
            interface is provisioned.
        Default: None

        :type owner_account: string
        :param owner_account: The AWS account that will own the new public
            virtual interface.
        Default: None

        :type new_public_virtual_interface_allocation: dict
        :param new_public_virtual_interface_allocation: Detailed information
            for the public virtual interface to be provisioned.
        Default: None

        """
        params = {
            'connectionId': connection_id,
            'ownerAccount': owner_account,
            'newPublicVirtualInterfaceAllocation': new_public_virtual_interface_allocation,
        }
        return self.make_request(action='AllocatePublicVirtualInterface',
                                 body=json.dumps(params))
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def create_connection(self, location, bandwidth, connection_name):
        """
        Creates a new connection between the customer network and a
        specific AWS Direct Connect location.

        A connection links your internal network to an AWS Direct
        Connect location over a standard 1 gigabit or 10 gigabit
        Ethernet fiber-optic cable. One end of the cable is connected
        to your router, the other to an AWS Direct Connect router. An
        AWS Direct Connect location provides access to Amazon Web
        Services in the region it is associated with. You can
        establish connections with AWS Direct Connect locations in
        multiple regions, but a connection in one region does not
        provide connectivity to other regions.

        :type location: string
        :param location: Where the connection is located.
        Example: EqSV5

        Default: None

        :type bandwidth: string
        :param bandwidth: Bandwidth of the connection.
        Example: 1Gbps

        Default: None

        :type connection_name: string
        :param connection_name: The name of the connection.
        Example: " My Connection to AWS "

        Default: None

        """
        params = {
            'location': location,
            'bandwidth': bandwidth,
            'connectionName': connection_name,
        }
        return self.make_request(action='CreateConnection',
                                 body=json.dumps(params))
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def create_private_virtual_interface(self, connection_id,
                                         new_private_virtual_interface):
        """
        Creates a new private virtual interface. A virtual interface
        is the VLAN that transports AWS Direct Connect traffic. A
        private virtual interface supports sending traffic to a single
        virtual private cloud (VPC).

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        :type new_private_virtual_interface: dict
        :param new_private_virtual_interface: Detailed information for the
            private virtual interface to be created.
        Default: None

        """
        params = {
            'connectionId': connection_id,
            'newPrivateVirtualInterface': new_private_virtual_interface,
        }
        return self.make_request(action='CreatePrivateVirtualInterface',
                                 body=json.dumps(params))
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def create_public_virtual_interface(self, connection_id,
                                        new_public_virtual_interface):
        """
        Creates a new public virtual interface. A virtual interface is
        the VLAN that transports AWS Direct Connect traffic. A public
        virtual interface supports sending traffic to public services
        of AWS such as Amazon Simple Storage Service (Amazon S3).

        :type connection_id: string
        :param connection_id: ID of the connection.
        Example: dxcon-fg5678gh

        Default: None

        :type new_public_virtual_interface: dict
        :param new_public_virtual_interface: Detailed information for the
            public virtual interface to be created.
        Default: None

        """
        params = {
            'connectionId': connection_id,
            'newPublicVirtualInterface': new_public_virtual_interface,
        }
        return self.make_request(action='CreatePublicVirtualInterface',
                                 body=json.dumps(params))
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
    :class:`boto.ec2.cloudwatch.CloudWatchConnection`.

    :param str region_name: The name of the region to connect to.

    :rtype: :class:`boto.ec2.CloudWatchConnection` or ``None``
    :return: A connection to the given region, or None if an invalid region
        name is given
    """
    for region in regions():
        if region.name == region_name:
            return region.connect(**kw_params)
    return None
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
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='/',
                 security_token=None, validate_certs=True, profile_name=None):
        """
        Init method to create a new connection to EC2 Monitoring Service.

        B{Note:} The host argument is overridden by the host specified in the
        boto configuration file.
        """
        if not region:
            region = RegionInfo(self, self.DefaultRegionName,
                                self.DefaultRegionEndpoint)
        self.region = region

        # Ugly hack to get around both a bug in Python and a
        # misconfigured SSL cert for the eu-west-1 endpoint
        if self.region.name == 'eu-west-1':
            validate_certs = False

        super(CloudWatchConnection, self).__init__(aws_access_key_id,
                                                   aws_secret_access_key,
                                                   is_secure, port, proxy, proxy_port,
                                                   proxy_user, proxy_pass,
                                                   self.region.endpoint, debug,
                                                   https_connection_factory, path,
                                                   security_token,
                                                   validate_certs=validate_certs,
                                                   profile_name=profile_name)
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def get_params(self):
        """
        Returns a dictionary containing the value of all of the keyword
        arguments passed when constructing this connection.
        """
        param_names = ['aws_access_key_id', 'aws_secret_access_key',
                       'is_secure', 'port', 'proxy', 'proxy_port',
                       'proxy_user', 'proxy_pass',
                       'debug', 'https_connection_factory']
        params = {}
        for name in param_names:
            params[name] = getattr(self, name)
        return params
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
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='/',
                 security_token=None, validate_certs=True, profile_name=None,
                 use_block_device_types=False):
        """
        Init method to create a new connection to the AutoScaling service.

        B{Note:} The host argument is overridden by the host specified in the
                 boto configuration file.


        """
        if not region:
            region = RegionInfo(self, self.DefaultRegionName,
                                self.DefaultRegionEndpoint,
                                AutoScaleConnection)
        self.region = region
        self.use_block_device_types = use_block_device_types
        super(AutoScaleConnection, self).__init__(aws_access_key_id,
                                                  aws_secret_access_key,
                                                  is_secure, port, proxy, proxy_port,
                                                  proxy_user, proxy_pass,
                                                  self.region.endpoint, debug,
                                                  https_connection_factory, path=path,
                                                  security_token=security_token,
                                                  validate_certs=validate_certs,
                                                  profile_name=profile_name)
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
    :class:`boto.ec2.elb.ELBConnection`.

    :param str region_name: The name of the region to connect to.

    :rtype: :class:`boto.ec2.ELBConnection` or ``None``
    :return: A connection to the given region, or None if an invalid region
        name is given
    """
    for region in regions():
        if region.name == region_name:
            return region.connect(**kw_params)
    return None
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def _get_info(self, id, resource, dist_class):
        uri = '/%s/%s/%s' % (self.Version, resource, id)
        response = self.make_request('GET', uri)
        body = response.read()
        boto.log.debug(body)
        if response.status >= 300:
            raise CloudFrontServerError(response.status, response.reason, body)
        d = dist_class(connection=self)
        response_headers = response.msg
        for key in response_headers.keys():
            if key.lower() == 'etag':
                d.etag = response_headers[key]
        h = handler.XmlHandler(d, self)
        xml.sax.parseString(body, h)
        return d
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def _get_config(self, id, resource, config_class):
        uri = '/%s/%s/%s/config' % (self.Version, resource, id)
        response = self.make_request('GET', uri)
        body = response.read()
        boto.log.debug(body)
        if response.status >= 300:
            raise CloudFrontServerError(response.status, response.reason, body)
        d = config_class(connection=self)
        d.etag = self.get_etag(response)
        h = handler.XmlHandler(d, self)
        xml.sax.parseString(body, h)
        return d
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def set_item_cls(self, cls):
        """
        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.
        """
        self.item_cls = cls
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def get_usage(self):
        """
        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: float
        :return: The accumulated BoxUsage of all requests made on the connection.
        """
        return self.box_usage
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def create_queue(self, queue_name, visibility_timeout=None):
        """
        Create an SQS Queue.

        :type queue_name: str or unicode
        :param queue_name: The name of the new queue.  Names are
            scoped to an account and need to be unique within that
            account.  Calling this method on an existing queue name
            will not return an error from SQS unless the value for
            visibility_timeout is different than the value of the
            existing queue of that name.  This is still an expensive
            operation, though, and not the preferred way to check for
            the existence of a queue.  See the
            :func:`boto.sqs.connection.SQSConnection.lookup` method.

        :type visibility_timeout: int
        :param visibility_timeout: The default visibility timeout for
            all messages written in the queue.  This can be overridden
            on a per-message.

        :rtype: :class:`boto.sqs.queue.Queue`
        :return: The newly created queue.

        """
        params = {'QueueName': queue_name}
        if visibility_timeout:
            params['Attribute.1.Name'] = 'VisibilityTimeout'
            params['Attribute.1.Value'] = int(visibility_timeout)
        return self.get_object('CreateQueue', params, Queue)
项目:cuny-bdif    作者:aristotle-tek    | 项目源码 | 文件源码
def poll_for_activity_task(self, domain, task_list, identity=None):
        """
        Used by workers to get an ActivityTask from the specified
        activity taskList. This initiates a long poll, where the
        service holds the HTTP connection open and responds as soon as
        a task becomes available. The maximum time the service holds
        on to the request before responding is 60 seconds. If no task
        is available within 60 seconds, the poll will return an empty
        result. An empty result, in this context, means that an
        ActivityTask is returned, but that the value of taskToken is
        an empty string. If a task is returned, the worker should use
        its type to identify and process it correctly.

        :type domain: string
        :param domain: The name of the domain that contains the task
            lists being polled.

        :type task_list: string
        :param task_list: Specifies the task list to poll for activity tasks.

        :type identity: string
        :param identity: Identity of the worker making the request, which
            is recorded in the ActivityTaskStarted event in the workflow
            history. This enables diagnostic tracing when problems arise.
            The form of this identity is user defined.

        :raises: UnknownResourceFault, SWFOperationNotPermittedError
        """
        return self.json_request('PollForActivityTask', {
            'domain': domain,
            'taskList': {'name': task_list},
            'identity': identity,
        })
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
def allocate_private_virtual_interface(self, connection_id,
                                           owner_account,
                                           new_private_virtual_interface_allocation):
        """
        Provisions a private virtual interface to be owned by a
        different customer.

        The owner of a connection calls this function to provision a
        private virtual interface which will be owned by another AWS
        customer.

        Virtual interfaces created using this function must be
        confirmed by the virtual interface owner by calling
        ConfirmPrivateVirtualInterface. Until this step has been
        completed, the virtual interface will be in 'Confirming'
        state, and will not be available for handling traffic.

        :type connection_id: string
        :param connection_id: The connection ID on which the private virtual
            interface is provisioned.
        Default: None

        :type owner_account: string
        :param owner_account: The AWS account that will own the new private
            virtual interface.
        Default: None

        :type new_private_virtual_interface_allocation: dict
        :param new_private_virtual_interface_allocation: Detailed information
            for the private virtual interface to be provisioned.
        Default: None

        """
        params = {
            'connectionId': connection_id,
            'ownerAccount': owner_account,
            'newPrivateVirtualInterfaceAllocation': new_private_virtual_interface_allocation,
        }
        return self.make_request(action='AllocatePrivateVirtualInterface',
                                 body=json.dumps(params))
项目:learneveryword    作者:karan    | 项目源码 | 文件源码
def allocate_public_virtual_interface(self, connection_id, owner_account,
                                          new_public_virtual_interface_allocation):
        """
        Provisions a public virtual interface to be owned by a
        different customer.

        The owner of a connection calls this function to provision a
        public virtual interface which will be owned by another AWS
        customer.

        Virtual interfaces created using this function must be
        confirmed by the virtual interface owner by calling
        ConfirmPublicVirtualInterface. Until this step has been
        completed, the virtual interface will be in 'Confirming'
        state, and will not be available for handling traffic.

        :type connection_id: string
        :param connection_id: The connection ID on which the public virtual
            interface is provisioned.
        Default: None

        :type owner_account: string
        :param owner_account: The AWS account that will own the new public
            virtual interface.
        Default: None

        :type new_public_virtual_interface_allocation: dict
        :param new_public_virtual_interface_allocation: Detailed information
            for the public virtual interface to be provisioned.
        Default: None

        """
        params = {
            'connectionId': connection_id,
            'ownerAccount': owner_account,
            'newPublicVirtualInterfaceAllocation': new_public_virtual_interface_allocation,
        }
        return self.make_request(action='AllocatePublicVirtualInterface',
                                 body=json.dumps(params))