index
int64 0
731k
| package
stringlengths 2
98
⌀ | name
stringlengths 1
76
| docstring
stringlengths 0
281k
⌀ | code
stringlengths 4
1.07M
⌀ | signature
stringlengths 2
42.8k
⌀ |
---|---|---|---|---|---|
5,967 | boto | connect_cloudformation |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.cloudformation.CloudFormationConnection`
:return: A connection to Amazon's CloudFormation Service
| def connect_cloudformation(aws_access_key_id=None, aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.cloudformation.CloudFormationConnection`
:return: A connection to Amazon's CloudFormation Service
"""
from boto.cloudformation import CloudFormationConnection
return CloudFormationConnection(aws_access_key_id, aws_secret_access_key,
**kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,968 | boto | connect_cloudfront |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.fps.connection.FPSConnection`
:return: A connection to FPS
| def connect_cloudfront(aws_access_key_id=None, aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.fps.connection.FPSConnection`
:return: A connection to FPS
"""
from boto.cloudfront import CloudFrontConnection
return CloudFrontConnection(aws_access_key_id, aws_secret_access_key,
**kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,969 | boto | connect_cloudhsm |
Connect to AWS CloudHSM
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.cloudhsm.layer1.CloudHSMConnection`
:return: A connection to the AWS CloudHSM service
| def connect_cloudhsm(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to AWS CloudHSM
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.cloudhsm.layer1.CloudHSMConnection`
:return: A connection to the AWS CloudHSM service
"""
from boto.cloudhsm.layer1 import CloudHSMConnection
return CloudHSMConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,970 | boto | connect_cloudsearch |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.cloudsearch.layer2.Layer2`
:return: A connection to Amazon's CloudSearch service
| def connect_cloudsearch(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.cloudsearch.layer2.Layer2`
:return: A connection to Amazon's CloudSearch service
"""
from boto.cloudsearch.layer2 import Layer2
return Layer2(aws_access_key_id, aws_secret_access_key,
**kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,971 | boto | connect_cloudsearch2 |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:type sign_request: bool
:param sign_request: whether or not to sign search and
upload requests
:rtype: :class:`boto.cloudsearch2.layer2.Layer2`
:return: A connection to Amazon's CloudSearch2 service
| def connect_cloudsearch2(aws_access_key_id=None,
aws_secret_access_key=None,
sign_request=False,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:type sign_request: bool
:param sign_request: whether or not to sign search and
upload requests
:rtype: :class:`boto.cloudsearch2.layer2.Layer2`
:return: A connection to Amazon's CloudSearch2 service
"""
from boto.cloudsearch2.layer2 import Layer2
return Layer2(aws_access_key_id, aws_secret_access_key,
sign_request=sign_request,
**kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, sign_request=False, **kwargs) |
5,972 | boto | connect_cloudsearchdomain |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.cloudsearchdomain.layer1.CloudSearchDomainConnection`
:return: A connection to Amazon's CloudSearch Domain service
| def connect_cloudsearchdomain(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.cloudsearchdomain.layer1.CloudSearchDomainConnection`
:return: A connection to Amazon's CloudSearch Domain service
"""
from boto.cloudsearchdomain.layer1 import CloudSearchDomainConnection
return CloudSearchDomainConnection(aws_access_key_id,
aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,973 | boto | connect_cloudtrail |
Connect to AWS CloudTrail
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.cloudtrail.layer1.CloudtrailConnection`
:return: A connection to the AWS Cloudtrail service
| def connect_cloudtrail(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to AWS CloudTrail
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.cloudtrail.layer1.CloudtrailConnection`
:return: A connection to the AWS Cloudtrail service
"""
from boto.cloudtrail.layer1 import CloudTrailConnection
return CloudTrailConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,974 | boto | connect_cloudwatch |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.cloudwatch.CloudWatchConnection`
:return: A connection to Amazon's EC2 Monitoring service
| def connect_cloudwatch(aws_access_key_id=None, aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.cloudwatch.CloudWatchConnection`
:return: A connection to Amazon's EC2 Monitoring service
"""
from boto.ec2.cloudwatch import CloudWatchConnection
return CloudWatchConnection(aws_access_key_id, aws_secret_access_key,
**kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,975 | boto | connect_codedeploy |
Connect to AWS CodeDeploy
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.cognito.sync.layer1.CodeDeployConnection`
:return: A connection to the AWS CodeDeploy service
| def connect_codedeploy(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to AWS CodeDeploy
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.cognito.sync.layer1.CodeDeployConnection`
:return: A connection to the AWS CodeDeploy service
"""
from boto.codedeploy.layer1 import CodeDeployConnection
return CodeDeployConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,976 | boto | connect_cognito_identity |
Connect to Amazon Cognito Identity
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.cognito.identity.layer1.CognitoIdentityConnection`
:return: A connection to the Amazon Cognito Identity service
| def connect_cognito_identity(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to Amazon Cognito Identity
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.cognito.identity.layer1.CognitoIdentityConnection`
:return: A connection to the Amazon Cognito Identity service
"""
from boto.cognito.identity.layer1 import CognitoIdentityConnection
return CognitoIdentityConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,977 | boto | connect_cognito_sync |
Connect to Amazon Cognito Sync
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.cognito.sync.layer1.CognitoSyncConnection`
:return: A connection to the Amazon Cognito Sync service
| def connect_cognito_sync(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to Amazon Cognito Sync
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.cognito.sync.layer1.CognitoSyncConnection`
:return: A connection to the Amazon Cognito Sync service
"""
from boto.cognito.sync.layer1 import CognitoSyncConnection
return CognitoSyncConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,978 | boto | connect_configservice |
Connect to AWS Config
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.kms.layer1.ConfigServiceConnection`
:return: A connection to the AWS Config service
| def connect_configservice(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to AWS Config
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.kms.layer1.ConfigServiceConnection`
:return: A connection to the AWS Config service
"""
from boto.configservice.layer1 import ConfigServiceConnection
return ConfigServiceConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,979 | boto | connect_directconnect |
Connect to AWS DirectConnect
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.directconnect.layer1.DirectConnectConnection`
:return: A connection to the AWS DirectConnect service
| def connect_directconnect(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to AWS DirectConnect
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.directconnect.layer1.DirectConnectConnection`
:return: A connection to the AWS DirectConnect service
"""
from boto.directconnect.layer1 import DirectConnectConnection
return DirectConnectConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,980 | boto | connect_dynamodb |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.dynamodb.layer2.Layer2`
:return: A connection to the Layer2 interface for DynamoDB.
| def connect_dynamodb(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.dynamodb.layer2.Layer2`
:return: A connection to the Layer2 interface for DynamoDB.
"""
from boto.dynamodb.layer2 import Layer2
return Layer2(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,981 | boto | connect_ec2 |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.connection.EC2Connection`
:return: A connection to Amazon's EC2
| def connect_ec2(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.connection.EC2Connection`
:return: A connection to Amazon's EC2
"""
from boto.ec2.connection import EC2Connection
return EC2Connection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,982 | boto | connect_ec2_endpoint |
Connect to an EC2 Api endpoint. Additional arguments are passed
through to connect_ec2.
:type url: string
:param url: A url for the ec2 api endpoint to connect to
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.connection.EC2Connection`
:return: A connection to Eucalyptus server
| def connect_ec2_endpoint(url, aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to an EC2 Api endpoint. Additional arguments are passed
through to connect_ec2.
:type url: string
:param url: A url for the ec2 api endpoint to connect to
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.connection.EC2Connection`
:return: A connection to Eucalyptus server
"""
from boto.ec2.regioninfo import RegionInfo
purl = urlparse(url)
kwargs['port'] = purl.port
kwargs['host'] = purl.hostname
kwargs['path'] = purl.path
if not 'is_secure' in kwargs:
kwargs['is_secure'] = (purl.scheme == "https")
kwargs['region'] = RegionInfo(name=purl.hostname,
endpoint=purl.hostname)
kwargs['aws_access_key_id'] = aws_access_key_id
kwargs['aws_secret_access_key'] = aws_secret_access_key
return(connect_ec2(**kwargs))
| (url, aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,983 | boto | connect_ec2containerservice |
Connect to Amazon EC2 Container Service
rtype: :class:`boto.ec2containerservice.layer1.EC2ContainerServiceConnection`
:return: A connection to the Amazon EC2 Container Service
| def connect_ec2containerservice(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to Amazon EC2 Container Service
rtype: :class:`boto.ec2containerservice.layer1.EC2ContainerServiceConnection`
:return: A connection to the Amazon EC2 Container Service
"""
from boto.ec2containerservice.layer1 import EC2ContainerServiceConnection
return EC2ContainerServiceConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,984 | boto | connect_elastictranscoder |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ets.layer1.ElasticTranscoderConnection`
:return: A connection to Amazon's Elastic Transcoder service
| def connect_elastictranscoder(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ets.layer1.ElasticTranscoderConnection`
:return: A connection to Amazon's Elastic Transcoder service
"""
from boto.elastictranscoder.layer1 import ElasticTranscoderConnection
return ElasticTranscoderConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,985 | boto | connect_elb |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.elb.ELBConnection`
:return: A connection to Amazon's Load Balancing Service
| def connect_elb(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.elb.ELBConnection`
:return: A connection to Amazon's Load Balancing Service
"""
from boto.ec2.elb import ELBConnection
return ELBConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,986 | boto | connect_emr |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.emr.EmrConnection`
:return: A connection to Elastic mapreduce
| def connect_emr(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.emr.EmrConnection`
:return: A connection to Elastic mapreduce
"""
from boto.emr import EmrConnection
return EmrConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,987 | boto | connect_euca |
Connect to a Eucalyptus service.
:type host: string
:param host: the host name or ip address of the Eucalyptus server
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.connection.EC2Connection`
:return: A connection to Eucalyptus server
| def connect_euca(host=None, aws_access_key_id=None, aws_secret_access_key=None,
port=8773, path='/services/Eucalyptus', is_secure=False,
**kwargs):
"""
Connect to a Eucalyptus service.
:type host: string
:param host: the host name or ip address of the Eucalyptus server
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ec2.connection.EC2Connection`
:return: A connection to Eucalyptus server
"""
from boto.ec2 import EC2Connection
from boto.ec2.regioninfo import RegionInfo
# Check for values in boto config, if not supplied as args
if not aws_access_key_id:
aws_access_key_id = config.get('Credentials',
'euca_access_key_id',
None)
if not aws_secret_access_key:
aws_secret_access_key = config.get('Credentials',
'euca_secret_access_key',
None)
if not host:
host = config.get('Boto', 'eucalyptus_host', None)
reg = RegionInfo(name='eucalyptus', endpoint=host)
return EC2Connection(aws_access_key_id, aws_secret_access_key,
region=reg, port=port, path=path,
is_secure=is_secure, **kwargs)
| (host=None, aws_access_key_id=None, aws_secret_access_key=None, port=8773, path='/services/Eucalyptus', is_secure=False, **kwargs) |
5,988 | boto | connect_fps |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.fps.connection.FPSConnection`
:return: A connection to FPS
| def connect_fps(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.fps.connection.FPSConnection`
:return: A connection to FPS
"""
from boto.fps.connection import FPSConnection
return FPSConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,989 | boto | connect_glacier |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.glacier.layer2.Layer2`
:return: A connection to Amazon's Glacier Service
| def connect_glacier(aws_access_key_id=None, aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.glacier.layer2.Layer2`
:return: A connection to Amazon's Glacier Service
"""
from boto.glacier.layer2 import Layer2
return Layer2(aws_access_key_id, aws_secret_access_key,
**kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,990 | boto | connect_gs |
@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
| def connect_gs(gs_access_key_id=None, gs_secret_access_key=None, **kwargs):
"""
@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
"""
from boto.gs.connection import GSConnection
return GSConnection(gs_access_key_id, gs_secret_access_key, **kwargs)
| (gs_access_key_id=None, gs_secret_access_key=None, **kwargs) |
5,991 | boto | connect_ia |
Connect to the Internet Archive via their S3-like API.
:type ia_access_key_id: string
:param ia_access_key_id: Your IA Access Key ID. This will also look
in your boto config file for an entry in the Credentials
section called "ia_access_key_id"
:type ia_secret_access_key: string
:param ia_secret_access_key: Your IA Secret Access Key. This will also
look in your boto config file for an entry in the Credentials
section called "ia_secret_access_key"
:rtype: :class:`boto.s3.connection.S3Connection`
:return: A connection to the Internet Archive
| def connect_ia(ia_access_key_id=None, ia_secret_access_key=None,
is_secure=False, **kwargs):
"""
Connect to the Internet Archive via their S3-like API.
:type ia_access_key_id: string
:param ia_access_key_id: Your IA Access Key ID. This will also look
in your boto config file for an entry in the Credentials
section called "ia_access_key_id"
:type ia_secret_access_key: string
:param ia_secret_access_key: Your IA Secret Access Key. This will also
look in your boto config file for an entry in the Credentials
section called "ia_secret_access_key"
:rtype: :class:`boto.s3.connection.S3Connection`
:return: A connection to the Internet Archive
"""
from boto.s3.connection import S3Connection
from boto.s3.connection import OrdinaryCallingFormat
access_key = config.get('Credentials', 'ia_access_key_id',
ia_access_key_id)
secret_key = config.get('Credentials', 'ia_secret_access_key',
ia_secret_access_key)
return S3Connection(access_key, secret_key,
host='s3.us.archive.org',
calling_format=OrdinaryCallingFormat(),
is_secure=is_secure, **kwargs)
| (ia_access_key_id=None, ia_secret_access_key=None, is_secure=False, **kwargs) |
5,992 | boto | connect_iam |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.iam.IAMConnection`
:return: A connection to Amazon's IAM
| def connect_iam(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.iam.IAMConnection`
:return: A connection to Amazon's IAM
"""
from boto.iam import IAMConnection
return IAMConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,993 | boto | connect_kinesis |
Connect to Amazon Kinesis
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.kinesis.layer1.KinesisConnection`
:return: A connection to the Amazon Kinesis service
| def connect_kinesis(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to Amazon Kinesis
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.kinesis.layer1.KinesisConnection`
:return: A connection to the Amazon Kinesis service
"""
from boto.kinesis.layer1 import KinesisConnection
return KinesisConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,994 | boto | connect_kms |
Connect to AWS Key Management Service
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.kms.layer1.KMSConnection`
:return: A connection to the AWS Key Management Service
| def connect_kms(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to AWS Key Management Service
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.kms.layer1.KMSConnection`
:return: A connection to the AWS Key Management Service
"""
from boto.kms.layer1 import KMSConnection
return KMSConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,995 | boto | connect_logs |
Connect to Amazon CloudWatch Logs
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.kinesis.layer1.CloudWatchLogsConnection`
:return: A connection to the Amazon CloudWatch Logs service
| def connect_logs(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to Amazon CloudWatch Logs
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.kinesis.layer1.CloudWatchLogsConnection`
:return: A connection to the Amazon CloudWatch Logs service
"""
from boto.logs.layer1 import CloudWatchLogsConnection
return CloudWatchLogsConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,996 | boto | connect_machinelearning |
Connect to Amazon Machine Learning service
rtype: :class:`boto.machinelearning.layer1.MachineLearningConnection`
:return: A connection to the Amazon Machine Learning service
| def connect_machinelearning(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to Amazon Machine Learning service
rtype: :class:`boto.machinelearning.layer1.MachineLearningConnection`
:return: A connection to the Amazon Machine Learning service
"""
from boto.machinelearning.layer1 import MachineLearningConnection
return MachineLearningConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,997 | boto | connect_mturk |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.mturk.connection.MTurkConnection`
:return: A connection to MTurk
| def connect_mturk(aws_access_key_id=None, aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.mturk.connection.MTurkConnection`
:return: A connection to MTurk
"""
from boto.mturk.connection import MTurkConnection
return MTurkConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,998 | boto | connect_opsworks | null | def connect_opsworks(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
from boto.opsworks.layer1 import OpsWorksConnection
return OpsWorksConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
5,999 | boto | connect_rds |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.rds.RDSConnection`
:return: A connection to RDS
| def connect_rds(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.rds.RDSConnection`
:return: A connection to RDS
"""
from boto.rds import RDSConnection
return RDSConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,000 | boto | connect_rds2 |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.rds2.layer1.RDSConnection`
:return: A connection to RDS
| def connect_rds2(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.rds2.layer1.RDSConnection`
:return: A connection to RDS
"""
from boto.rds2.layer1 import RDSConnection
return RDSConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,001 | boto | connect_redshift |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.redshift.layer1.RedshiftConnection`
:return: A connection to Amazon's Redshift service
| def connect_redshift(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.redshift.layer1.RedshiftConnection`
:return: A connection to Amazon's Redshift service
"""
from boto.redshift.layer1 import RedshiftConnection
return RedshiftConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,002 | boto | connect_route53 |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.dns.Route53Connection`
:return: A connection to Amazon's Route53 DNS Service
| def connect_route53(aws_access_key_id=None, aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.dns.Route53Connection`
:return: A connection to Amazon's Route53 DNS Service
"""
from boto.route53 import Route53Connection
return Route53Connection(aws_access_key_id, aws_secret_access_key,
**kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,003 | boto | connect_route53domains |
Connect to Amazon Route 53 Domains
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.route53.domains.layer1.Route53DomainsConnection`
:return: A connection to the Amazon Route 53 Domains service
| def connect_route53domains(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to Amazon Route 53 Domains
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.route53.domains.layer1.Route53DomainsConnection`
:return: A connection to the Amazon Route 53 Domains service
"""
from boto.route53.domains.layer1 import Route53DomainsConnection
return Route53DomainsConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,004 | boto | connect_s3 |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.s3.connection.S3Connection`
:return: A connection to Amazon's S3
| def connect_s3(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.s3.connection.S3Connection`
:return: A connection to Amazon's S3
"""
from boto.s3.connection import S3Connection
return S3Connection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,005 | boto | connect_sdb |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.sdb.connection.SDBConnection`
:return: A connection to Amazon's SDB
| def connect_sdb(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.sdb.connection.SDBConnection`
:return: A connection to Amazon's SDB
"""
from boto.sdb.connection import SDBConnection
return SDBConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,006 | boto | connect_ses |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ses.SESConnection`
:return: A connection to Amazon's SES
| def connect_ses(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.ses.SESConnection`
:return: A connection to Amazon's SES
"""
from boto.ses import SESConnection
return SESConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,007 | boto | connect_sns |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.sns.SNSConnection`
:return: A connection to Amazon's SNS
| def connect_sns(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.sns.SNSConnection`
:return: A connection to Amazon's SNS
"""
from boto.sns import SNSConnection
return SNSConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,008 | boto | connect_sqs |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.sqs.connection.SQSConnection`
:return: A connection to Amazon's SQS
| def connect_sqs(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.sqs.connection.SQSConnection`
:return: A connection to Amazon's SQS
"""
from boto.sqs.connection import SQSConnection
return SQSConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,009 | boto | connect_sts |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.sts.STSConnection`
:return: A connection to Amazon's STS
| def connect_sts(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.sts.STSConnection`
:return: A connection to Amazon's STS
"""
from boto.sts import STSConnection
return STSConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,010 | boto | connect_support |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.support.layer1.SupportConnection`
:return: A connection to Amazon's Support service
| def connect_support(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.support.layer1.SupportConnection`
:return: A connection to Amazon's Support service
"""
from boto.support.layer1 import SupportConnection
return SupportConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,011 | boto | connect_swf |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.swf.layer1.Layer1`
:return: A connection to the Layer1 interface for SWF.
| def connect_swf(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.swf.layer1.Layer1`
:return: A connection to the Layer1 interface for SWF.
"""
from boto.swf.layer1 import Layer1
return Layer1(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,012 | boto | connect_vpc |
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.vpc.VPCConnection`
:return: A connection to VPC
| def connect_vpc(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.vpc.VPCConnection`
:return: A connection to VPC
"""
from boto.vpc import VPCConnection
return VPCConnection(aws_access_key_id, aws_secret_access_key, **kwargs)
| (aws_access_key_id=None, aws_secret_access_key=None, **kwargs) |
6,013 | boto | connect_walrus |
Connect to a Walrus service.
:type host: string
:param host: the host name or ip address of the Walrus server
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.s3.connection.S3Connection`
:return: A connection to Walrus
| def connect_walrus(host=None, aws_access_key_id=None,
aws_secret_access_key=None,
port=8773, path='/services/Walrus', is_secure=False,
**kwargs):
"""
Connect to a Walrus service.
:type host: string
:param host: the host name or ip address of the Walrus server
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
:rtype: :class:`boto.s3.connection.S3Connection`
:return: A connection to Walrus
"""
from boto.s3.connection import S3Connection
from boto.s3.connection import OrdinaryCallingFormat
# Check for values in boto config, if not supplied as args
if not aws_access_key_id:
aws_access_key_id = config.get('Credentials',
'euca_access_key_id',
None)
if not aws_secret_access_key:
aws_secret_access_key = config.get('Credentials',
'euca_secret_access_key',
None)
if not host:
host = config.get('Boto', 'walrus_host', None)
return S3Connection(aws_access_key_id, aws_secret_access_key,
host=host, port=port, path=path,
calling_format=OrdinaryCallingFormat(),
is_secure=is_secure, **kwargs)
| (host=None, aws_access_key_id=None, aws_secret_access_key=None, port=8773, path='/services/Walrus', is_secure=False, **kwargs) |
6,018 | boto | init_logging | null | def init_logging():
for file in BotoConfigLocations:
try:
logging.config.fileConfig(os.path.expanduser(file))
except:
pass
| () |
6,028 | boto | set_file_logger | null | def set_file_logger(name, filepath, level=logging.INFO, format_string=None):
global log
if not format_string:
format_string = "%(asctime)s %(name)s [%(levelname)s]:%(message)s"
logger = logging.getLogger(name)
logger.setLevel(level)
fh = logging.FileHandler(filepath)
fh.setLevel(level)
formatter = logging.Formatter(format_string)
fh.setFormatter(formatter)
logger.addHandler(fh)
log = logger
| (name, filepath, level=20, format_string=None) |
6,029 | boto | set_stream_logger | null | def set_stream_logger(name, level=logging.DEBUG, format_string=None):
global log
if not format_string:
format_string = "%(asctime)s %(name)s [%(levelname)s]:%(message)s"
logger = logging.getLogger(name)
logger.setLevel(level)
fh = logging.StreamHandler()
fh.setLevel(level)
formatter = logging.Formatter(format_string)
fh.setFormatter(formatter)
logger.addHandler(fh)
log = logger
| (name, level=10, format_string=None) |
6,030 | boto | storage_uri |
Instantiate a StorageUri from a URI string.
:type uri_str: string
:param uri_str: URI naming bucket + optional object.
:type default_scheme: string
:param default_scheme: default scheme for scheme-less URIs.
:type debug: int
:param debug: debug level to pass in to boto connection (range 0..2).
:type validate: bool
:param validate: whether to check for bucket name validity.
:type bucket_storage_uri_class: BucketStorageUri interface.
:param bucket_storage_uri_class: Allows mocking for unit tests.
:param suppress_consec_slashes: If provided, controls whether
consecutive slashes will be suppressed in key paths.
:type is_latest: bool
:param is_latest: whether this versioned object represents the
current version.
We allow validate to be disabled to allow caller
to implement bucket-level wildcarding (outside the boto library;
see gsutil).
:rtype: :class:`boto.StorageUri` subclass
:return: StorageUri subclass for given URI.
``uri_str`` must be one of the following formats:
* gs://bucket/name
* gs://bucket/name#ver
* s3://bucket/name
* gs://bucket
* s3://bucket
* filename (which could be a Unix path like /a/b/c or a Windows path like
C:\c)
The last example uses the default scheme ('file', unless overridden).
| def storage_uri(uri_str, default_scheme='file', debug=0, validate=True,
bucket_storage_uri_class=BucketStorageUri,
suppress_consec_slashes=True, is_latest=False):
"""
Instantiate a StorageUri from a URI string.
:type uri_str: string
:param uri_str: URI naming bucket + optional object.
:type default_scheme: string
:param default_scheme: default scheme for scheme-less URIs.
:type debug: int
:param debug: debug level to pass in to boto connection (range 0..2).
:type validate: bool
:param validate: whether to check for bucket name validity.
:type bucket_storage_uri_class: BucketStorageUri interface.
:param bucket_storage_uri_class: Allows mocking for unit tests.
:param suppress_consec_slashes: If provided, controls whether
consecutive slashes will be suppressed in key paths.
:type is_latest: bool
:param is_latest: whether this versioned object represents the
current version.
We allow validate to be disabled to allow caller
to implement bucket-level wildcarding (outside the boto library;
see gsutil).
:rtype: :class:`boto.StorageUri` subclass
:return: StorageUri subclass for given URI.
``uri_str`` must be one of the following formats:
* gs://bucket/name
* gs://bucket/name#ver
* s3://bucket/name
* gs://bucket
* s3://bucket
* filename (which could be a Unix path like /a/b/c or a Windows path like
C:\a\b\c)
The last example uses the default scheme ('file', unless overridden).
"""
version_id = None
generation = None
# Manually parse URI components instead of using urlparse because
# what we're calling URIs don't really fit the standard syntax for URIs
# (the latter includes an optional host/net location part).
end_scheme_idx = uri_str.find('://')
if end_scheme_idx == -1:
scheme = default_scheme.lower()
path = uri_str
else:
scheme = uri_str[0:end_scheme_idx].lower()
path = uri_str[end_scheme_idx + 3:]
if scheme not in ['file', 's3', 'gs']:
raise InvalidUriError('Unrecognized scheme "%s"' % scheme)
if scheme == 'file':
# For file URIs we have no bucket name, and use the complete path
# (minus 'file://') as the object name.
is_stream = False
if path == '-':
is_stream = True
return FileStorageUri(path, debug, is_stream)
else:
path_parts = path.split('/', 1)
bucket_name = path_parts[0]
object_name = ''
# If validate enabled, ensure the bucket name is valid, to avoid
# possibly confusing other parts of the code. (For example if we didn't
# catch bucket names containing ':', when a user tried to connect to
# the server with that name they might get a confusing error about
# non-integer port numbers.)
if (validate and bucket_name and
(not BUCKET_NAME_RE.match(bucket_name)
or TOO_LONG_DNS_NAME_COMP.search(bucket_name))):
raise InvalidUriError('Invalid bucket name in URI "%s"' % uri_str)
if scheme == 'gs':
match = GENERATION_RE.search(path)
if match:
md = match.groupdict()
versionless_uri_str = md['versionless_uri_str']
path_parts = versionless_uri_str.split('/', 1)
generation = int(md['generation'])
elif scheme == 's3':
match = VERSION_RE.search(path)
if match:
md = match.groupdict()
versionless_uri_str = md['versionless_uri_str']
path_parts = versionless_uri_str.split('/', 1)
version_id = md['version_id']
else:
raise InvalidUriError('Unrecognized scheme "%s"' % scheme)
if len(path_parts) > 1:
object_name = path_parts[1]
return bucket_storage_uri_class(
scheme, bucket_name, object_name, debug,
suppress_consec_slashes=suppress_consec_slashes,
version_id=version_id, generation=generation, is_latest=is_latest)
| (uri_str, default_scheme='file', debug=0, validate=True, bucket_storage_uri_class=<class 'boto.storage_uri.BucketStorageUri'>, suppress_consec_slashes=True, is_latest=False) |
6,031 | boto | storage_uri_for_key | Returns a StorageUri for the given key.
:type key: :class:`boto.s3.key.Key` or subclass
:param key: URI naming bucket + optional object.
| def storage_uri_for_key(key):
"""Returns a StorageUri for the given key.
:type key: :class:`boto.s3.key.Key` or subclass
:param key: URI naming bucket + optional object.
"""
if not isinstance(key, boto.s3.key.Key):
raise InvalidUriError('Requested key (%s) is not a subclass of '
'boto.s3.key.Key' % str(type(key)))
prov_name = key.bucket.connection.provider.get_provider_name()
uri_str = '%s://%s/%s' % (prov_name, key.bucket.name, key.name)
return storage_uri(uri_str)
| (key) |
6,033 | urllib.parse | urlparse | Parse a URL into 6 components:
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
The result is a named 6-tuple with fields corresponding to the
above. It is either a ParseResult or ParseResultBytes object,
depending on the type of the url parameter.
The username, password, hostname, and port sub-components of netloc
can also be accessed as attributes of the returned object.
The scheme argument provides the default value of the scheme
component when no scheme is found in url.
If allow_fragments is False, no attempt is made to separate the
fragment component from the previous component, which can be either
path or query.
Note that % escapes are not expanded.
| def urlparse(url, scheme='', allow_fragments=True):
"""Parse a URL into 6 components:
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
The result is a named 6-tuple with fields corresponding to the
above. It is either a ParseResult or ParseResultBytes object,
depending on the type of the url parameter.
The username, password, hostname, and port sub-components of netloc
can also be accessed as attributes of the returned object.
The scheme argument provides the default value of the scheme
component when no scheme is found in url.
If allow_fragments is False, no attempt is made to separate the
fragment component from the previous component, which can be either
path or query.
Note that % escapes are not expanded.
"""
url, scheme, _coerce_result = _coerce_args(url, scheme)
splitresult = urlsplit(url, scheme, allow_fragments)
scheme, netloc, url, query, fragment = splitresult
if scheme in uses_params and ';' in url:
url, params = _splitparams(url)
else:
params = ''
result = ParseResult(scheme, netloc, url, params, query, fragment)
return _coerce_result(result)
| (url, scheme='', allow_fragments=True) |
6,035 | flask_aserto.middleware | AsertoMiddleware | null | class AsertoMiddleware:
def __init__(
self,
*,
authorizer_options: AuthorizerOptions,
policy_path_root: str,
identity_provider: IdentityMapper,
policy_instance_name: Optional[str] = None,
policy_instance_label: Optional[str] = None,
policy_path_resolver: Optional[StringMapper] = None,
resource_context_provider: Optional[ResourceMapper] = None,
):
self._authorizer_options = authorizer_options
self._identity_provider = identity_provider
self._policy_instance_name = policy_instance_name
self._policy_instance_label = policy_instance_label
self._policy_path_root = policy_path_root
self._policy_path_resolver = (
policy_path_resolver
if policy_path_resolver is not None
else create_default_policy_path_resolver(policy_path_root)
)
self._resource_context_provider = (
resource_context_provider
if resource_context_provider is not None
else DEFAULT_RESOURCE_CONTEXT_PROVIDER_FOR_ENDPOINT
)
def _generate_client(self) -> AuthorizerClient:
identity = self._identity_provider()
return AuthorizerClient(
identity=identity,
options=self._authorizer_options,
)
def _with_overrides(self, **kwargs: Any) -> "AsertoMiddleware":
return (
self
if not kwargs
else AsertoMiddleware(
authorizer_options=kwargs.get("authorizer", self._authorizer_options),
policy_path_root=kwargs.get("policy_path_root", self._policy_path_root),
identity_provider=kwargs.get("identity_provider", self._identity_provider),
policy_instance_name=kwargs.get("policy_instance_name", self._policy_instance_name),
policy_instance_label=kwargs.get(
"policy_instance_label", self._policy_instance_label
),
policy_path_resolver=kwargs.get("policy_path_resolver", self._policy_path_resolver),
resource_context_provider=kwargs.get(
"resource_context_provider", self._resource_context_provider
),
)
)
@overload
def is_allowed(self, decision: str) -> bool:
...
@overload
def is_allowed(
self,
decision: str,
*,
authorizer_options: AuthorizerOptions = ...,
identity_provider: IdentityMapper = ...,
policy_instance_name: str = ...,
policy_instance_label: str = ...,
policy_path_root: str = ...,
policy_path_resolver: StringMapper = ...,
resource_context_provider: ResourceMapper = ...,
) -> bool:
...
def is_allowed(self, decision: str, **kwargs: Any) -> bool:
return self._with_overrides(**kwargs)._is_allowed(decision)
def _is_allowed(self, decision: str) -> bool:
client = self._generate_client()
resource_context = self._resource_context_provider()
policy_path = self._policy_path_resolver()
decisions = client.decisions(
policy_path=policy_path,
decisions=(decision,),
policy_instance_name=self._policy_instance_name,
policy_instance_label=self._policy_instance_label,
resource_context=resource_context,
)
return decisions[decision]
@overload
def authorize(self, handler: Handler) -> Handler:
...
@overload
def authorize(
self,
*,
authorizer_options: AuthorizerOptions = ...,
identity_provider: IdentityMapper = ...,
policy_instance_name: str = ...,
policy_instance_label: str = ...,
policy_path_root: str = ...,
policy_path_resolver: StringMapper = ...,
) -> Callable[[Handler], Handler]:
...
def authorize(
self,
*args: Any,
**kwargs: Any,
) -> Union[Handler, Callable[[Handler], Handler]]:
arguments_error = TypeError(
f"{self.authorize.__name__}() expects either exactly 1 callable"
" 'handler' argument or at least 1 'options' argument"
)
handler: Optional[Handler] = None
if not args and kwargs.keys() == {"handler"}:
handler = kwargs["handler"]
elif not kwargs and len(args) == 1:
(handler,) = args
if handler is not None:
if not callable(handler):
raise arguments_error
return self._authorize(handler)
if args:
raise arguments_error
return self._with_overrides(**kwargs)._authorize
def __call__(self, *args: Any, **kwargs: Any) -> Union[Handler, Callable[[Handler], Handler]]:
return self.authorize(*args, **kwargs)
def _authorize(self, handler: Handler) -> Handler:
if self._policy_instance_name == None:
raise TypeError(f"{self._policy_instance_name}() should not be None")
if self._policy_instance_label == None:
self._policy_instance_label = self._policy_instance_name
@wraps(handler)
def decorated(*args: Any, **kwargs: Any) -> Response:
client = self._generate_client()
resource_context = self._resource_context_provider()
policy_path = self._policy_path_resolver()
decisions = client.decisions(
policy_path=policy_path,
decisions=("allowed",),
policy_instance_name=self._policy_instance_name,
policy_instance_label=self._policy_instance_label,
resource_context=resource_context,
)
if not decisions["allowed"]:
raise AuthorizationError(policy_instance_name=self._policy_instance_name, policy_path=policy_path) # type: ignore[arg-type]
return handler(*args, **kwargs)
return cast(Handler, decorated)
def check(
self,
objId: Optional[str] = "",
objType: Optional[str] = "",
objIdMapper: Optional[StringMapper] = None,
objMapper: Optional[ObjectMapper] = None,
relationName: Optional[str] = "",
relationMapper: Optional[StringMapper] = None,
subjType: Optional[str] = "",
subjMapper: Optional[IdentityMapper] = None,
policyPath: Optional[str] = "",
policyRoot: Optional[str] = "",
policyPathMapper: Optional[StringMapper] = None,
) -> CheckMiddleware:
opts = CheckOptions(
objId=objId,
objType=objType,
objIdMapper=objIdMapper,
objMapper=objMapper,
relationName=relationName,
relationMapper=relationMapper,
subjType=subjType,
subjMapper=subjMapper,
policyRoot=policyRoot,
policyPath=policyPath,
policyPathMapper=policyPathMapper,
)
return CheckMiddleware(options=opts, aserto_middleware=self)
def register_display_state_map(
self,
app: Flask,
*,
endpoint: str = DEFAULT_DISPLAY_STATE_MAP_ENDPOINT,
resource_context_provider: Optional[ResourceMapper] = None,
) -> Flask:
@app.route(endpoint, methods=["GET", "POST"])
def __displaystatemap() -> Response:
nonlocal resource_context_provider
if resource_context_provider is None:
resource_context_provider = DEFAULT_RESOURCE_CONTEXT_PROVIDER_FOR_DISPLAY_STATE_MAP
client = self._generate_client()
resource_context = resource_context_provider()
display_state_map = client.decision_tree(
policy_path_root=self._policy_path_root,
decisions=["visible", "enabled"],
policy_instance_name=self._policy_instance_name,
policy_instance_label=self._policy_instance_label,
resource_context=resource_context,
policy_path_separator="SLASH",
)
return jsonify(display_state_map)
return app
| (*, authorizer_options: aserto.client.options.AuthorizerOptions, policy_path_root: str, identity_provider: Callable[[], aserto.client.identity.Identity], policy_instance_name: Optional[str] = None, policy_instance_label: Optional[str] = None, policy_path_resolver: Optional[Callable[[], str]] = None, resource_context_provider: Optional[Callable[[], Dict[str, object]]] = None) |
6,036 | flask_aserto.middleware | __call__ | null | def __call__(self, *args: Any, **kwargs: Any) -> Union[Handler, Callable[[Handler], Handler]]:
return self.authorize(*args, **kwargs)
| (self, *args: Any, **kwargs: Any) -> Union[~Handler, Callable[[~Handler], ~Handler]] |
6,037 | flask_aserto.middleware | __init__ | null | def __init__(
self,
*,
authorizer_options: AuthorizerOptions,
policy_path_root: str,
identity_provider: IdentityMapper,
policy_instance_name: Optional[str] = None,
policy_instance_label: Optional[str] = None,
policy_path_resolver: Optional[StringMapper] = None,
resource_context_provider: Optional[ResourceMapper] = None,
):
self._authorizer_options = authorizer_options
self._identity_provider = identity_provider
self._policy_instance_name = policy_instance_name
self._policy_instance_label = policy_instance_label
self._policy_path_root = policy_path_root
self._policy_path_resolver = (
policy_path_resolver
if policy_path_resolver is not None
else create_default_policy_path_resolver(policy_path_root)
)
self._resource_context_provider = (
resource_context_provider
if resource_context_provider is not None
else DEFAULT_RESOURCE_CONTEXT_PROVIDER_FOR_ENDPOINT
)
| (self, *, authorizer_options: aserto.client.options.AuthorizerOptions, policy_path_root: str, identity_provider: Callable[[], aserto.client.identity.Identity], policy_instance_name: Optional[str] = None, policy_instance_label: Optional[str] = None, policy_path_resolver: Optional[Callable[[], str]] = None, resource_context_provider: Optional[Callable[[], Dict[str, object]]] = None) |
6,038 | flask_aserto.middleware | _authorize | null | def _authorize(self, handler: Handler) -> Handler:
if self._policy_instance_name == None:
raise TypeError(f"{self._policy_instance_name}() should not be None")
if self._policy_instance_label == None:
self._policy_instance_label = self._policy_instance_name
@wraps(handler)
def decorated(*args: Any, **kwargs: Any) -> Response:
client = self._generate_client()
resource_context = self._resource_context_provider()
policy_path = self._policy_path_resolver()
decisions = client.decisions(
policy_path=policy_path,
decisions=("allowed",),
policy_instance_name=self._policy_instance_name,
policy_instance_label=self._policy_instance_label,
resource_context=resource_context,
)
if not decisions["allowed"]:
raise AuthorizationError(policy_instance_name=self._policy_instance_name, policy_path=policy_path) # type: ignore[arg-type]
return handler(*args, **kwargs)
return cast(Handler, decorated)
| (self, handler: ~Handler) -> ~Handler |
6,039 | flask_aserto.middleware | _generate_client | null | def _generate_client(self) -> AuthorizerClient:
identity = self._identity_provider()
return AuthorizerClient(
identity=identity,
options=self._authorizer_options,
)
| (self) -> aserto.client.authorizer.AuthorizerClient |
6,040 | flask_aserto.middleware | _is_allowed | null | def _is_allowed(self, decision: str) -> bool:
client = self._generate_client()
resource_context = self._resource_context_provider()
policy_path = self._policy_path_resolver()
decisions = client.decisions(
policy_path=policy_path,
decisions=(decision,),
policy_instance_name=self._policy_instance_name,
policy_instance_label=self._policy_instance_label,
resource_context=resource_context,
)
return decisions[decision]
| (self, decision: str) -> bool |
6,041 | flask_aserto.middleware | _with_overrides | null | def _with_overrides(self, **kwargs: Any) -> "AsertoMiddleware":
return (
self
if not kwargs
else AsertoMiddleware(
authorizer_options=kwargs.get("authorizer", self._authorizer_options),
policy_path_root=kwargs.get("policy_path_root", self._policy_path_root),
identity_provider=kwargs.get("identity_provider", self._identity_provider),
policy_instance_name=kwargs.get("policy_instance_name", self._policy_instance_name),
policy_instance_label=kwargs.get(
"policy_instance_label", self._policy_instance_label
),
policy_path_resolver=kwargs.get("policy_path_resolver", self._policy_path_resolver),
resource_context_provider=kwargs.get(
"resource_context_provider", self._resource_context_provider
),
)
)
| (self, **kwargs: Any) -> flask_aserto.middleware.AsertoMiddleware |
6,042 | flask_aserto.middleware | authorize | null | def authorize(
self,
*args: Any,
**kwargs: Any,
) -> Union[Handler, Callable[[Handler], Handler]]:
arguments_error = TypeError(
f"{self.authorize.__name__}() expects either exactly 1 callable"
" 'handler' argument or at least 1 'options' argument"
)
handler: Optional[Handler] = None
if not args and kwargs.keys() == {"handler"}:
handler = kwargs["handler"]
elif not kwargs and len(args) == 1:
(handler,) = args
if handler is not None:
if not callable(handler):
raise arguments_error
return self._authorize(handler)
if args:
raise arguments_error
return self._with_overrides(**kwargs)._authorize
| (self, *args: Any, **kwargs: Any) -> Union[~Handler, Callable[[~Handler], ~Handler]] |
6,043 | flask_aserto.middleware | check | null | def check(
self,
objId: Optional[str] = "",
objType: Optional[str] = "",
objIdMapper: Optional[StringMapper] = None,
objMapper: Optional[ObjectMapper] = None,
relationName: Optional[str] = "",
relationMapper: Optional[StringMapper] = None,
subjType: Optional[str] = "",
subjMapper: Optional[IdentityMapper] = None,
policyPath: Optional[str] = "",
policyRoot: Optional[str] = "",
policyPathMapper: Optional[StringMapper] = None,
) -> CheckMiddleware:
opts = CheckOptions(
objId=objId,
objType=objType,
objIdMapper=objIdMapper,
objMapper=objMapper,
relationName=relationName,
relationMapper=relationMapper,
subjType=subjType,
subjMapper=subjMapper,
policyRoot=policyRoot,
policyPath=policyPath,
policyPathMapper=policyPathMapper,
)
return CheckMiddleware(options=opts, aserto_middleware=self)
| (self, objId: Optional[str] = '', objType: Optional[str] = '', objIdMapper: Optional[Callable[[], str]] = None, objMapper: Optional[Callable[[], flask_aserto._defaults.Obj]] = None, relationName: Optional[str] = '', relationMapper: Optional[Callable[[], str]] = None, subjType: Optional[str] = '', subjMapper: Optional[Callable[[], aserto.client.identity.Identity]] = None, policyPath: Optional[str] = '', policyRoot: Optional[str] = '', policyPathMapper: Optional[Callable[[], str]] = None) -> flask_aserto.check.CheckMiddleware |
6,044 | flask_aserto.middleware | is_allowed | null | def is_allowed(self, decision: str, **kwargs: Any) -> bool:
return self._with_overrides(**kwargs)._is_allowed(decision)
| (self, decision: str, **kwargs: Any) -> bool |
6,045 | flask_aserto.middleware | register_display_state_map | null | def register_display_state_map(
self,
app: Flask,
*,
endpoint: str = DEFAULT_DISPLAY_STATE_MAP_ENDPOINT,
resource_context_provider: Optional[ResourceMapper] = None,
) -> Flask:
@app.route(endpoint, methods=["GET", "POST"])
def __displaystatemap() -> Response:
nonlocal resource_context_provider
if resource_context_provider is None:
resource_context_provider = DEFAULT_RESOURCE_CONTEXT_PROVIDER_FOR_DISPLAY_STATE_MAP
client = self._generate_client()
resource_context = resource_context_provider()
display_state_map = client.decision_tree(
policy_path_root=self._policy_path_root,
decisions=["visible", "enabled"],
policy_instance_name=self._policy_instance_name,
policy_instance_label=self._policy_instance_label,
resource_context=resource_context,
policy_path_separator="SLASH",
)
return jsonify(display_state_map)
return app
| (self, app: flask.app.Flask, *, endpoint: str = '/__displaystatemap', resource_context_provider: Optional[Callable[[], Dict[str, object]]] = None) -> flask.app.Flask |
6,046 | flask_aserto._defaults | AuthorizationError | AuthorizationError(policy_instance_name: str, policy_path: str) | class AuthorizationError(Exception):
policy_instance_name: str
policy_path: str
| (policy_instance_name: str, policy_path: str) -> None |
6,047 | flask_aserto._defaults | __delattr__ | null | import re
from dataclasses import dataclass
from typing import Callable, TypeVar, Any
from aserto.client import Identity, ResourceContext, IdentityType
from flask import request
__all__ = [
"create_default_policy_path_resolver",
"DEFAULT_RESOURCE_CONTEXT_PROVIDER_FOR_ENDPOINT",
"DEFAULT_RESOURCE_CONTEXT_PROVIDER_FOR_DISPLAY_STATE_MAP",
]
@dataclass
class Obj:
id: str
objType: str
| (self, name) |
6,053 | aserto.client.options | AuthorizerOptions | null | class AuthorizerOptions:
def __init__(
self,
*,
url: str = ASERTO_HOSTED_AUTHORIZER_URL,
tenant_id: Optional[str] = None,
api_key: Optional[str] = None,
cert_file_path: Optional[str] = None,
):
self._tenant_id = tenant_id
self._api_key = api_key
self._cert_file_path = cert_file_path
self._url = url
@property
def url(self) -> str:
return self._url
@property
def api_key(self) -> Optional[str]:
return self._api_key
@property
def tenant_id(self) -> Optional[str]:
return self._tenant_id
@property
def cert(self) -> Optional[bytes]:
if self._cert_file_path is None:
return None
with open(self._cert_file_path, "rb") as f:
return f.read()
@property
def ssl_context(self) -> Optional[ssl.SSLContext]:
return (
ssl.create_default_context(cafile=self._cert_file_path)
if self._cert_file_path
else None
)
@property
def auth_headers(self) -> Mapping[str, str]:
headers = {}
if self._api_key:
headers["authorization"] = f"basic {self._api_key}"
if self._tenant_id:
headers["aserto-tenant-id"] = self._tenant_id
return headers
| (*, url: str = 'authorizer.prod.aserto.com:8443', tenant_id: Optional[str] = None, api_key: Optional[str] = None, cert_file_path: Optional[str] = None) |
6,054 | aserto.client.options | __init__ | null | def __init__(
self,
*,
url: str = ASERTO_HOSTED_AUTHORIZER_URL,
tenant_id: Optional[str] = None,
api_key: Optional[str] = None,
cert_file_path: Optional[str] = None,
):
self._tenant_id = tenant_id
self._api_key = api_key
self._cert_file_path = cert_file_path
self._url = url
| (self, *, url: str = 'authorizer.prod.aserto.com:8443', tenant_id: Optional[str] = None, api_key: Optional[str] = None, cert_file_path: Optional[str] = None) |
6,055 | flask_aserto.check | CheckMiddleware | null | class CheckMiddleware:
def __init__(
self,
*,
options: CheckOptions,
aserto_middleware: "AsertoMiddleware",
):
self._aserto_middleware = aserto_middleware
self._identity_provider = (
options.subjMapper
if options.subjMapper is not None
else aserto_middleware._identity_provider
)
self._resource_context_provider = build_resource_context_mapper(options)
self._options = options
def _with_overrides(self, **kwargs: Any) -> "CheckMiddleware":
return (
self
if not kwargs
else CheckMiddleware(
aserto_middleware=self._aserto_middleware,
options=CheckOptions(
relationName=kwargs.get("relation_name", self._options.relationName),
relationMapper=kwargs.get("relation_mapper", self._options.relationMapper),
policyPath=kwargs.get("policy_path", self._options.policyPath),
policyRoot=kwargs.get("policy_root", self._options.policyRoot),
subjMapper=kwargs.get("identity_provider", self._identity_provider),
objId=kwargs.get("object_id", self._options.objId),
objType=kwargs.get("object_type", self._options.objType),
objIdMapper=kwargs.get("object_id_mapper", self._options.objIdMapper),
objMapper=kwargs.get("object_mapper", self._options.objMapper),
subjType=self._options.subjType,
policyPathMapper=self._options.policyPathMapper,
),
)
)
def _build_policy_path_mapper(self) -> StringMapper:
def mapper() -> str:
policy_path = ""
if self._options.policyPathMapper is not None:
policy_path = self._options.policyPathMapper()
if policy_path == "":
policy_path = "check"
policy_root = self._options.policyRoot or self._aserto_middleware._policy_path_root
if policy_root:
policy_path = f"{policy_root}.{policy_path}"
return policy_path
return mapper
@overload
def authorize(self, handler: Handler) -> Handler:
...
@overload
def authorize(
self,
objId: Optional[str] = "",
objType: Optional[str] = "",
objIdMapper: Optional[StringMapper] = None,
objMapper: Optional[ObjectMapper] = None,
relationName: Optional[str] = "",
relationMapper: Optional[StringMapper] = None,
subjType: Optional[str] = "",
subjMapper: Optional[IdentityMapper] = None,
policyPath: Optional[str] = "",
policyRoot: Optional[str] = "",
policyPathMapper: Optional[StringMapper] = None,
) -> Callable[[Handler], Handler]:
...
def authorize(
self,
*args: Any,
**kwargs: Any,
) -> Union[Handler, Callable[[Handler], Handler]]:
arguments_error = TypeError(
f"{self.authorize.__name__}() expects either exactly 1 callable"
" 'handler' argument or at least 1 'options' argument"
)
handler: Optional[Handler] = None
if not args and kwargs.keys() == {"handler"}:
handler = kwargs["handler"]
elif not kwargs and len(args) == 1:
(handler,) = args
if handler is not None:
if not callable(handler):
raise arguments_error
return self._authorize(handler)
if args:
raise arguments_error
return self._with_overrides(**kwargs)._authorize
def __call__(
self,
*args: Any,
**kwargs: Any,
) -> Union[Handler, Callable[[Handler], Handler]]:
return self.authorize(*args, **kwargs)
def _authorize(self, handler: Handler) -> Handler:
if self._aserto_middleware._policy_instance_name == None:
raise TypeError(f"{self._aserto_middleware._policy_instance_name}() should not be None")
if self._aserto_middleware._policy_instance_label == None:
self._aserto_middleware._policy_instance_label = (
self._aserto_middleware._policy_instance_name
)
@wraps(handler)
def decorated(*args: Any, **kwargs: Any) -> Response:
policy_mapper = self._build_policy_path_mapper()
decision = self._aserto_middleware.is_allowed(
decision="allowed",
authorizer_options=self._aserto_middleware._authorizer_options,
identity_provider=self._identity_provider,
policy_instance_name=self._aserto_middleware._policy_instance_name or "",
policy_instance_label=self._aserto_middleware._policy_instance_label or "",
policy_path_root=self._options.policyRoot
or self._aserto_middleware._policy_path_root,
policy_path_resolver=policy_mapper,
resource_context_provider=self._resource_context_provider,
)
if not decision:
raise AuthorizationError(policy_instance_name=self._aserto_middleware._policy_instance_name, policy_path=policy_mapper()) # type: ignore[arg-type]
return handler(*args, **kwargs)
return cast(Handler, decorated)
| (*, options: flask_aserto.check.CheckOptions, aserto_middleware: 'AsertoMiddleware') |
6,056 | flask_aserto.check | __call__ | null | def __call__(
self,
*args: Any,
**kwargs: Any,
) -> Union[Handler, Callable[[Handler], Handler]]:
return self.authorize(*args, **kwargs)
| (self, *args: Any, **kwargs: Any) -> Union[~Handler, Callable[[~Handler], ~Handler]] |
6,057 | flask_aserto.check | __init__ | null | def __init__(
self,
*,
options: CheckOptions,
aserto_middleware: "AsertoMiddleware",
):
self._aserto_middleware = aserto_middleware
self._identity_provider = (
options.subjMapper
if options.subjMapper is not None
else aserto_middleware._identity_provider
)
self._resource_context_provider = build_resource_context_mapper(options)
self._options = options
| (self, *, options: flask_aserto.check.CheckOptions, aserto_middleware: 'AsertoMiddleware') |
6,058 | flask_aserto.check | _authorize | null | def _authorize(self, handler: Handler) -> Handler:
if self._aserto_middleware._policy_instance_name == None:
raise TypeError(f"{self._aserto_middleware._policy_instance_name}() should not be None")
if self._aserto_middleware._policy_instance_label == None:
self._aserto_middleware._policy_instance_label = (
self._aserto_middleware._policy_instance_name
)
@wraps(handler)
def decorated(*args: Any, **kwargs: Any) -> Response:
policy_mapper = self._build_policy_path_mapper()
decision = self._aserto_middleware.is_allowed(
decision="allowed",
authorizer_options=self._aserto_middleware._authorizer_options,
identity_provider=self._identity_provider,
policy_instance_name=self._aserto_middleware._policy_instance_name or "",
policy_instance_label=self._aserto_middleware._policy_instance_label or "",
policy_path_root=self._options.policyRoot
or self._aserto_middleware._policy_path_root,
policy_path_resolver=policy_mapper,
resource_context_provider=self._resource_context_provider,
)
if not decision:
raise AuthorizationError(policy_instance_name=self._aserto_middleware._policy_instance_name, policy_path=policy_mapper()) # type: ignore[arg-type]
return handler(*args, **kwargs)
return cast(Handler, decorated)
| (self, handler: ~Handler) -> ~Handler |
6,059 | flask_aserto.check | _build_policy_path_mapper | null | def _build_policy_path_mapper(self) -> StringMapper:
def mapper() -> str:
policy_path = ""
if self._options.policyPathMapper is not None:
policy_path = self._options.policyPathMapper()
if policy_path == "":
policy_path = "check"
policy_root = self._options.policyRoot or self._aserto_middleware._policy_path_root
if policy_root:
policy_path = f"{policy_root}.{policy_path}"
return policy_path
return mapper
| (self) -> Callable[[], str] |
6,060 | flask_aserto.check | _with_overrides | null | def _with_overrides(self, **kwargs: Any) -> "CheckMiddleware":
return (
self
if not kwargs
else CheckMiddleware(
aserto_middleware=self._aserto_middleware,
options=CheckOptions(
relationName=kwargs.get("relation_name", self._options.relationName),
relationMapper=kwargs.get("relation_mapper", self._options.relationMapper),
policyPath=kwargs.get("policy_path", self._options.policyPath),
policyRoot=kwargs.get("policy_root", self._options.policyRoot),
subjMapper=kwargs.get("identity_provider", self._identity_provider),
objId=kwargs.get("object_id", self._options.objId),
objType=kwargs.get("object_type", self._options.objType),
objIdMapper=kwargs.get("object_id_mapper", self._options.objIdMapper),
objMapper=kwargs.get("object_mapper", self._options.objMapper),
subjType=self._options.subjType,
policyPathMapper=self._options.policyPathMapper,
),
)
)
| (self, **kwargs: Any) -> flask_aserto.check.CheckMiddleware |
6,062 | flask_aserto.check | CheckOptions |
Check options class used to create a new instance of Check Middleware
| class CheckOptions:
"""
Check options class used to create a new instance of Check Middleware
"""
objId: Optional[str] = ""
objType: Optional[str] = ""
objIdMapper: Optional[StringMapper] = None
objMapper: Optional[ObjectMapper] = None
relationName: Optional[str] = ""
relationMapper: Optional[StringMapper] = None
subjType: Optional[str] = ""
subjMapper: Optional[IdentityMapper] = None
policyPath: Optional[str] = ""
policyRoot: Optional[str] = ""
policyPathMapper: Optional[StringMapper] = None
| (objId: Optional[str] = '', objType: Optional[str] = '', objIdMapper: Optional[Callable[[], str]] = None, objMapper: Optional[Callable[[], flask_aserto._defaults.Obj]] = None, relationName: Optional[str] = '', relationMapper: Optional[Callable[[], str]] = None, subjType: Optional[str] = '', subjMapper: Optional[Callable[[], aserto.client.identity.Identity]] = None, policyPath: Optional[str] = '', policyRoot: Optional[str] = '', policyPathMapper: Optional[Callable[[], str]] = None) -> None |
6,063 | flask_aserto.check | __delattr__ | null | from dataclasses import dataclass
from functools import wraps
from typing import Any, Callable, Optional, TYPE_CHECKING, Union, cast, overload
from aserto.client import ResourceContext
from flask.wrappers import Response
from ._defaults import (
AuthorizationError,
Handler,
IdentityMapper,
Obj,
ObjectMapper,
ResourceMapper,
StringMapper,
)
if TYPE_CHECKING:
from .middleware import AsertoMiddleware
@dataclass(frozen=True)
class CheckOptions:
"""
Check options class used to create a new instance of Check Middleware
"""
objId: Optional[str] = ""
objType: Optional[str] = ""
objIdMapper: Optional[StringMapper] = None
objMapper: Optional[ObjectMapper] = None
relationName: Optional[str] = ""
relationMapper: Optional[StringMapper] = None
subjType: Optional[str] = ""
subjMapper: Optional[IdentityMapper] = None
policyPath: Optional[str] = ""
policyRoot: Optional[str] = ""
policyPathMapper: Optional[StringMapper] = None
| (self, name) |
6,069 | aserto.client.identity | Identity | Identity(type: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7efd00db0d00>, value: Optional[str] = None) | class Identity:
type: IdentityType
value: Optional[str] = None
| (type: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7efd00db0d00>, value: Optional[str] = None) -> None |
6,070 | aserto.client.identity | __eq__ | null | from dataclasses import dataclass
from typing import Optional
from aserto.authorizer.v2.api import IdentityType
@dataclass
class Identity:
type: IdentityType
value: Optional[str] = None
| (self, other) |
6,073 | flask_aserto._defaults | Obj | Obj(id: str, objType: str) | class Obj:
id: str
objType: str
| (id: str, objType: str) -> None |
6,080 | scrapy.item | Field | Container of field metadata | class Field(dict):
"""Container of field metadata"""
| null |
6,081 | scrapy.http.request.form | FormRequest | null | class FormRequest(Request):
valid_form_methods = ["GET", "POST"]
def __init__(self, *args, formdata: FormdataType = None, **kwargs) -> None:
if formdata and kwargs.get("method") is None:
kwargs["method"] = "POST"
super().__init__(*args, **kwargs)
if formdata:
items = formdata.items() if isinstance(formdata, dict) else formdata
form_query_str = _urlencode(items, self.encoding)
if self.method == "POST":
self.headers.setdefault(
b"Content-Type", b"application/x-www-form-urlencoded"
)
self._set_body(form_query_str)
else:
self._set_url(
urlunsplit(urlsplit(self.url)._replace(query=form_query_str))
)
@classmethod
def from_response(
cls: Type[FormRequestTypeVar],
response: TextResponse,
formname: Optional[str] = None,
formid: Optional[str] = None,
formnumber: int = 0,
formdata: FormdataType = None,
clickdata: Optional[dict] = None,
dont_click: bool = False,
formxpath: Optional[str] = None,
formcss: Optional[str] = None,
**kwargs,
) -> FormRequestTypeVar:
kwargs.setdefault("encoding", response.encoding)
if formcss is not None:
from parsel.csstranslator import HTMLTranslator
formxpath = HTMLTranslator().css_to_xpath(formcss)
form = _get_form(response, formname, formid, formnumber, formxpath)
formdata = _get_inputs(form, formdata, dont_click, clickdata)
url = _get_form_url(form, kwargs.pop("url", None))
method = kwargs.pop("method", form.method)
if method is not None:
method = method.upper()
if method not in cls.valid_form_methods:
method = "GET"
return cls(url=url, method=method, formdata=formdata, **kwargs)
| (*args, formdata: Union[dict, List[Tuple[str, Union[str, Iterable[str]]]], NoneType] = None, **kwargs) -> None |
6,082 | scrapy.http.request.form | __init__ | null | def __init__(self, *args, formdata: FormdataType = None, **kwargs) -> None:
if formdata and kwargs.get("method") is None:
kwargs["method"] = "POST"
super().__init__(*args, **kwargs)
if formdata:
items = formdata.items() if isinstance(formdata, dict) else formdata
form_query_str = _urlencode(items, self.encoding)
if self.method == "POST":
self.headers.setdefault(
b"Content-Type", b"application/x-www-form-urlencoded"
)
self._set_body(form_query_str)
else:
self._set_url(
urlunsplit(urlsplit(self.url)._replace(query=form_query_str))
)
| (self, *args, formdata: Union[dict, List[Tuple[str, Union[str, Iterable[str]]]], NoneType] = None, **kwargs) -> NoneType |
6,083 | scrapy.utils.trackref | __new__ | null | def __new__(cls, *args: Any, **kwargs: Any) -> "Self":
obj = object.__new__(cls)
live_refs[cls][obj] = time()
return obj
| (cls, *args: Any, **kwargs: Any) -> 'Self' |
6,084 | scrapy.http.request | __repr__ | null | def __repr__(self) -> str:
return f"<{self.method} {self.url}>"
| (self) -> str |
6,085 | scrapy.http.request | _get_body | null | def _get_body(self) -> bytes:
return self._body
| (self) -> bytes |
6,086 | scrapy.http.request | _get_url | null | def _get_url(self) -> str:
return self._url
| (self) -> str |
6,087 | scrapy.http.request | _set_body | null | def _set_body(self, body: Optional[Union[str, bytes]]) -> None:
self._body = b"" if body is None else to_bytes(body, self.encoding)
| (self, body: Union[bytes, str, NoneType]) -> NoneType |
6,088 | scrapy.http.request | _set_url | null | def _set_url(self, url: str) -> None:
if not isinstance(url, str):
raise TypeError(f"Request url must be str, got {type(url).__name__}")
s = safe_url_string(url, self.encoding)
self._url = escape_ajax(s)
if (
"://" not in self._url
and not self._url.startswith("about:")
and not self._url.startswith("data:")
):
raise ValueError(f"Missing scheme in request url: {self._url}")
| (self, url: str) -> NoneType |
6,089 | scrapy.http.request | copy | null | def copy(self) -> "Request":
return self.replace()
| (self) -> scrapy.http.request.Request |
6,090 | scrapy.http.request | replace | Create a new Request with the same attributes except for those given new values | def replace(self, *args, **kwargs) -> "Request":
"""Create a new Request with the same attributes except for those given new values"""
for x in self.attributes:
kwargs.setdefault(x, getattr(self, x))
cls = kwargs.pop("cls", self.__class__)
return cls(*args, **kwargs)
| (self, *args, **kwargs) -> scrapy.http.request.Request |
6,091 | scrapy.http.request | to_dict | Return a dictionary containing the Request's data.
Use :func:`~scrapy.utils.request.request_from_dict` to convert back into a :class:`~scrapy.Request` object.
If a spider is given, this method will try to find out the name of the spider methods used as callback
and errback and include them in the output dict, raising an exception if they cannot be found.
| def to_dict(self, *, spider: Optional["scrapy.Spider"] = None) -> dict:
"""Return a dictionary containing the Request's data.
Use :func:`~scrapy.utils.request.request_from_dict` to convert back into a :class:`~scrapy.Request` object.
If a spider is given, this method will try to find out the name of the spider methods used as callback
and errback and include them in the output dict, raising an exception if they cannot be found.
"""
d = {
"url": self.url, # urls are safe (safe_string_url)
"callback": _find_method(spider, self.callback)
if callable(self.callback)
else self.callback,
"errback": _find_method(spider, self.errback)
if callable(self.errback)
else self.errback,
"headers": dict(self.headers),
}
for attr in self.attributes:
d.setdefault(attr, getattr(self, attr))
if type(self) is not Request: # pylint: disable=unidiomatic-typecheck
d["_class"] = self.__module__ + "." + self.__class__.__name__
return d
| (self, *, spider: Optional[scrapy.spiders.Spider] = None) -> dict |
6,092 | scrapy.item | Item |
Base class for scraped items.
In Scrapy, an object is considered an ``item`` if it is an instance of either
:class:`Item` or :class:`dict`, or any subclass. For example, when the output of a
spider callback is evaluated, only instances of :class:`Item` or
:class:`dict` are passed to :ref:`item pipelines <topics-item-pipeline>`.
If you need instances of a custom class to be considered items by Scrapy,
you must inherit from either :class:`Item` or :class:`dict`.
Items must declare :class:`Field` attributes, which are processed and stored
in the ``fields`` attribute. This restricts the set of allowed field names
and prevents typos, raising ``KeyError`` when referring to undefined fields.
Additionally, fields can be used to define metadata and control the way
data is processed internally. Please refer to the :ref:`documentation
about fields <topics-items-fields>` for additional information.
Unlike instances of :class:`dict`, instances of :class:`Item` may be
:ref:`tracked <topics-leaks-trackrefs>` to debug memory leaks.
| class Item(MutableMapping, object_ref, metaclass=ItemMeta):
"""
Base class for scraped items.
In Scrapy, an object is considered an ``item`` if it is an instance of either
:class:`Item` or :class:`dict`, or any subclass. For example, when the output of a
spider callback is evaluated, only instances of :class:`Item` or
:class:`dict` are passed to :ref:`item pipelines <topics-item-pipeline>`.
If you need instances of a custom class to be considered items by Scrapy,
you must inherit from either :class:`Item` or :class:`dict`.
Items must declare :class:`Field` attributes, which are processed and stored
in the ``fields`` attribute. This restricts the set of allowed field names
and prevents typos, raising ``KeyError`` when referring to undefined fields.
Additionally, fields can be used to define metadata and control the way
data is processed internally. Please refer to the :ref:`documentation
about fields <topics-items-fields>` for additional information.
Unlike instances of :class:`dict`, instances of :class:`Item` may be
:ref:`tracked <topics-leaks-trackrefs>` to debug memory leaks.
"""
fields: Dict[str, Field]
def __init__(self, *args, **kwargs):
self._values = {}
if args or kwargs: # avoid creating dict for most common case
for k, v in dict(*args, **kwargs).items():
self[k] = v
def __getitem__(self, key):
return self._values[key]
def __setitem__(self, key, value):
if key in self.fields:
self._values[key] = value
else:
raise KeyError(f"{self.__class__.__name__} does not support field: {key}")
def __delitem__(self, key):
del self._values[key]
def __getattr__(self, name):
if name in self.fields:
raise AttributeError(f"Use item[{name!r}] to get field value")
raise AttributeError(name)
def __setattr__(self, name, value):
if not name.startswith("_"):
raise AttributeError(f"Use item[{name!r}] = {value!r} to set field value")
super().__setattr__(name, value)
def __len__(self):
return len(self._values)
def __iter__(self):
return iter(self._values)
__hash__ = object_ref.__hash__
def keys(self):
return self._values.keys()
def __repr__(self):
return pformat(dict(self))
def copy(self):
return self.__class__(self)
def deepcopy(self):
"""Return a :func:`~copy.deepcopy` of this item."""
return deepcopy(self)
| (*args, **kwargs) |
6,094 | scrapy.item | __delitem__ | null | def __delitem__(self, key):
del self._values[key]
| (self, key) |
6,096 | scrapy.item | __getattr__ | null | def __getattr__(self, name):
if name in self.fields:
raise AttributeError(f"Use item[{name!r}] to get field value")
raise AttributeError(name)
| (self, name) |
6,097 | scrapy.item | __getitem__ | null | def __getitem__(self, key):
return self._values[key]
| (self, key) |
6,098 | scrapy.item | __init__ | null | def __init__(self, *args, **kwargs):
self._values = {}
if args or kwargs: # avoid creating dict for most common case
for k, v in dict(*args, **kwargs).items():
self[k] = v
| (self, *args, **kwargs) |
6,099 | scrapy.item | __iter__ | null | def __iter__(self):
return iter(self._values)
| (self) |
6,100 | scrapy.item | __len__ | null | def __len__(self):
return len(self._values)
| (self) |
6,102 | scrapy.item | __repr__ | null | def __repr__(self):
return pformat(dict(self))
| (self) |
6,103 | scrapy.item | __setattr__ | null | def __setattr__(self, name, value):
if not name.startswith("_"):
raise AttributeError(f"Use item[{name!r}] = {value!r} to set field value")
super().__setattr__(name, value)
| (self, name, value) |
Subsets and Splits