Beispiel #1
0
def s3_client_new(secure, region, part_size=0):

    event_loop_group = EventLoopGroup()
    host_resolver = DefaultHostResolver(event_loop_group)
    bootstrap = ClientBootstrap(event_loop_group, host_resolver)
    credential_provider = AwsCredentialsProvider.new_default_chain(bootstrap)
    tls_option = None
    if secure:
        opt = TlsContextOptions()
        ctx = ClientTlsContext(opt)
        tls_option = TlsConnectionOptions(ctx)

    s3_client = S3Client(bootstrap=bootstrap,
                         region=region,
                         credential_provider=credential_provider,
                         tls_connection_options=tls_option,
                         part_size=part_size)

    return s3_client
Beispiel #2
0
 def test_server_name(self):
     opt = TlsContextOptions()
     ctx = ClientTlsContext(opt)
     conn_opt = TlsConnectionOptions(ctx)
     conn_opt.set_server_name('localhost')
Beispiel #3
0
 def test_alpn_list(self):
     opt = TlsContextOptions()
     ctx = ClientTlsContext(opt)
     conn_opt = TlsConnectionOptions(ctx)
     conn_opt.set_alpn_list(['h2', 'http/1.1'])
Beispiel #4
0
 def test_init(self):
     opt = TlsContextOptions()
     ctx = ClientTlsContext(opt)
     conn_opt = TlsConnectionOptions(ctx)