当前位置: 首页>>代码示例>>Python>>正文


Python s3.CommandArchitecture类代码示例

本文整理汇总了Python中awscli.customizations.s3.s3.CommandArchitecture的典型用法代码示例。如果您正苦于以下问题:Python CommandArchitecture类的具体用法?Python CommandArchitecture怎么用?Python CommandArchitecture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CommandArchitecture类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_run_sync

 def test_run_sync(self):
     """
     This ensures that the architecture sets up correctly for a ``sync``
     command.  It is just just a dry run, but all of the components need
     to be wired correctly for it to work.
     """
     s3_file = "s3://" + self.bucket + "/" + "text1.txt"
     local_file = self.loc_files[0]
     s3_prefix = "s3://" + self.bucket + "/"
     local_dir = self.loc_files[3]
     rel_local_file = os.path.relpath(local_file)
     filters = [["--include", "*"]]
     params = {
         "dir_op": True,
         "dryrun": True,
         "quiet": False,
         "src": local_dir,
         "dest": s3_prefix,
         "filters": filters,
         "paths_type": "locals3",
         "region": "us-east-1",
     }
     cmd_arc = CommandArchitecture(self.session, "sync", params)
     cmd_arc.create_instructions()
     cmd_arc.run()
     output_str = "(dryrun) upload: %s to %s" % (rel_local_file, s3_file)
     self.assertIn(output_str, self.output.getvalue())
开发者ID:nealma,项目名称:aws-cli,代码行数:27,代码来源:test_s3.py

示例2: test_run_ls

 def test_run_ls(self):
     # This ensures that the architecture sets up correctly for a ``ls``
     # command.  It is just just a dry run, but all of the components need
     # to be wired correctly for it to work.
     s3_prefix = 's3://' + self.bucket + '/'
     params = {'dir_op': True, 'dryrun': True, 'quiet': False,
               'src': s3_prefix, 'dest': s3_prefix, 'paths_type': 's3',
               'region': 'us-east-1'}
     cmd_arc = CommandArchitecture(self.session, 'ls', params)
     cmd_arc.create_instructions()
     cmd_arc.run()
开发者ID:CitizenB,项目名称:aws-cli,代码行数:11,代码来源:test_s3.py

示例3: test_run_mb

 def test_run_mb(self):
     # This ensures that the architecture sets up correctly for a ``rb``
     # command.  It is just just a dry run, but all of the components need
     # to be wired correctly for it to work.
     s3_prefix = 's3://' + self.bucket + '/'
     params = {'dir_op': True, 'dryrun': True, 'quiet': False,
               'src': s3_prefix, 'dest': s3_prefix, 'paths_type': 's3',
               'region': 'us-east-1', 'endpoint_url': None}
     cmd_arc = CommandArchitecture(self.session, 'mb', params)
     cmd_arc.create_instructions()
     cmd_arc.run()
     output_str = "(dryrun) make_bucket: %s" % s3_prefix
     self.assertIn(output_str, self.output.getvalue())
开发者ID:Gimpson,项目名称:aws-cli,代码行数:13,代码来源:test_s3.py

示例4: test_run_rb_nonzero_rc

 def test_run_rb_nonzero_rc(self):
     # This ensures that the architecture sets up correctly for a ``rb``
     # command.  It is just just a dry run, but all of the components need
     # to be wired correctly for it to work.
     s3_prefix = 's3://' + self.bucket + '/'
     params = {'dir_op': True, 'dryrun': False, 'quiet': False,
               'src': s3_prefix, 'dest': s3_prefix, 'paths_type': 's3',
               'region': 'us-east-1'}
     cmd_arc = CommandArchitecture(self.session, 'rb', params)
     cmd_arc.create_instructions()
     rc = cmd_arc.run()
     output_str = "remove_bucket failed: %s" % s3_prefix
     self.assertIn(output_str, self.output.getvalue())
     self.assertEqual(rc, 1)
开发者ID:danielgtaylor,项目名称:aws-cli,代码行数:14,代码来源:test_s3.py

示例5: test_run_remove

 def test_run_remove(self):
     # This ensures that the architecture sets up correctly for a ``rm``
     # command.  It is just just a dry run, but all of the components need
     # to be wired correctly for it to work.
     s3_file = 's3://' + self.bucket + '/' + 'text1.txt'
     filters = [['--include', '*']]
     params = {'dir_op': False, 'dryrun': True, 'quiet': False,
               'src': s3_file, 'dest': s3_file, 'filters': filters,
               'paths_type': 's3', 'region': 'us-east-1'}
     cmd_arc = CommandArchitecture(self.session, 'rm', params)
     cmd_arc.create_instructions()
     cmd_arc.run()
     output_str = "(dryrun) delete: %s" % s3_file
     self.assertIn(output_str, self.output.getvalue())
开发者ID:danielgtaylor,项目名称:aws-cli,代码行数:14,代码来源:test_s3.py

示例6: test_run_cp_copy

 def test_run_cp_copy(self):
     # This ensures that the architecture sets up correctly for a ``cp`` copy
     # command.  It is just just a dry run, but all of the components need
     # to be wired correctly for it to work.
     s3_file = 's3://' + self.bucket + '/' + 'text1.txt'
     filters = [['--include', '*']]
     params = {'dir_op': False, 'dryrun': True, 'quiet': False,
               'src': s3_file, 'dest': s3_file, 'filters': filters,
               'paths_type': 's3s3', 'region': 'us-east-1',
               'endpoint_url': None, 'verify_ssl': None}
     cmd_arc = CommandArchitecture(self.session, 'cp', params)
     cmd_arc.create_instructions()
     cmd_arc.run()
     output_str = "(dryrun) copy: %s to %s" % (s3_file, s3_file)
     self.assertIn(output_str, self.output.getvalue())
开发者ID:HackedByChinese,项目名称:aws-cli,代码行数:15,代码来源:test_s3.py

示例7: test_run_cp_get

 def test_run_cp_get(self):
     # This ensures that the architecture sets up correctly for a ``cp`` get
     # command.  It is just just a dry run, but all of the components need
     # to be wired correctly for it to work.
     s3_file = 's3://' + self.bucket + '/' + 'text1.txt'
     local_file = self.loc_files[0]
     rel_local_file = os.path.relpath(local_file)
     filters = [['--include', '*']]
     params = {'dir_op': False, 'dryrun': True, 'quiet': False,
               'src': s3_file, 'dest': local_file, 'filters': filters,
               'paths_type': 's3local', 'region': 'us-east-1'}
     cmd_arc = CommandArchitecture(self.session, 'cp', params)
     cmd_arc.create_instructions()
     cmd_arc.run()
     output_str = "(dryrun) download: %s to %s" % (s3_file, rel_local_file)
     self.assertIn(output_str, self.output.getvalue())
开发者ID:danielgtaylor,项目名称:aws-cli,代码行数:16,代码来源:test_s3.py

示例8: test_error_on_same_line_as_status

 def test_error_on_same_line_as_status(self):
     s3_file = 's3://' + 'bucket-does-not-exist' + '/' + 'text1.txt'
     local_file = self.loc_files[0]
     rel_local_file = os.path.relpath(local_file)
     filters = [['--include', '*']]
     params = {'dir_op': False, 'dryrun': False, 'quiet': False,
               'src': local_file, 'dest': s3_file, 'filters': filters,
               'paths_type': 'locals3', 'region': 'us-east-1',
               'endpoint_url': None}
     cmd_arc = CommandArchitecture(self.session, 'cp', params)
     cmd_arc.create_instructions()
     cmd_arc.run()
     # Also, we need to verify that the error message is on the *same* line
     # as the upload failed line, to make it easier to track.
     output_str = (
         "upload failed: %s to %s Error: Bucket does not exist\n" % (
             rel_local_file, s3_file))
     self.assertIn(output_str, self.output.getvalue())
开发者ID:Gimpson,项目名称:aws-cli,代码行数:18,代码来源:test_s3.py

示例9: test_run_sync

 def test_run_sync(self):
     # This ensures that the architecture sets up correctly for a ``sync``
     # command.  It is just just a dry run, but all of the components need
     # to be wired correctly for it to work.
     s3_file = 's3://' + self.bucket + '/' + 'text1.txt'
     local_file = self.loc_files[0]
     s3_prefix = 's3://' + self.bucket + '/'
     local_dir = self.loc_files[3]
     rel_local_file = os.path.relpath(local_file)
     filters = [['--include', '*']]
     params = {'dir_op': True, 'dryrun': True, 'quiet': False,
               'src': local_dir, 'dest': s3_prefix, 'filters': filters,
               'paths_type': 'locals3', 'region': 'us-east-1',
               'endpoint_url': None, 'verify_ssl': None}
     cmd_arc = CommandArchitecture(self.session, 'sync', params)
     cmd_arc.create_instructions()
     cmd_arc.run()
     output_str = "(dryrun) upload: %s to %s" % (rel_local_file, s3_file)
     self.assertIn(output_str, self.output.getvalue())
开发者ID:HackedByChinese,项目名称:aws-cli,代码行数:19,代码来源:test_s3.py

示例10: test_run_ls

 def test_run_ls(self):
     """
     This ensures that the architecture sets up correctly for a ``ls``
     command.  It is just just a dry run, but all of the components need
     to be wired correctly for it to work.
     """
     s3_file = "s3://" + self.bucket + "/" + "text1.txt"
     s3_prefix = "s3://" + self.bucket + "/"
     params = {
         "dir_op": True,
         "dryrun": True,
         "quiet": False,
         "src": s3_prefix,
         "dest": s3_prefix,
         "paths_type": "s3",
         "region": "us-east-1",
     }
     cmd_arc = CommandArchitecture(self.session, "ls", params)
     cmd_arc.create_instructions()
     cmd_arc.run()
开发者ID:nealma,项目名称:aws-cli,代码行数:20,代码来源:test_s3.py

示例11: test_run_rb

 def test_run_rb(self):
     """
     This ensures that the architecture sets up correctly for a ``mb``
     command.  It is just just a dry run, but all of the components need
     to be wired correctly for it to work.
     """
     s3_prefix = "s3://" + self.bucket + "/"
     params = {
         "dir_op": True,
         "dryrun": True,
         "quiet": False,
         "src": s3_prefix,
         "dest": s3_prefix,
         "paths_type": "s3",
         "region": "us-east-1",
     }
     cmd_arc = CommandArchitecture(self.session, "rb", params)
     cmd_arc.create_instructions()
     cmd_arc.run()
     output_str = "(dryrun) remove_bucket: %s" % s3_prefix
     self.assertIn(output_str, self.output.getvalue())
开发者ID:nealma,项目名称:aws-cli,代码行数:21,代码来源:test_s3.py

示例12: test_create_instructions

    def test_create_instructions(self):
        """
        This tests to make sure the instructions for any command is generated
        properly.
        """
        cmds = ['cp', 'mv', 'rm', 'sync', 'mb', 'rb']

        instructions = {'cp': ['file_generator', 's3_handler'],
                        'mv': ['file_generator', 's3_handler'],
                        'rm': ['file_generator', 's3_handler'],
                        'sync': ['file_generator', 'comparator', 's3_handler'],
                        'mb': ['s3_handler'],
                        'rb': ['s3_handler']}

        params = {'filters': True, 'region': 'us-east-1', 'endpoint_url': None}
        for cmd in cmds:
            cmd_arc = CommandArchitecture(self.session, cmd, {'region': 'us-east-1', 'endpoint_url': None})
            cmd_arc.create_instructions()
            self.assertEqual(cmd_arc.instructions, instructions[cmd])

        # Test if there is a filter.
        cmd_arc = CommandArchitecture(self.session, 'cp', params)
        cmd_arc.create_instructions()
        self.assertEqual(cmd_arc.instructions, ['file_generator', 'filters',
                                                's3_handler'])
开发者ID:Gimpson,项目名称:aws-cli,代码行数:25,代码来源:test_s3.py

示例13: test_create_instructions

    def test_create_instructions(self):
        """
        This tests to make sure the instructions for any command is generated
        properly.
        """
        cmds = ["cp", "mv", "rm", "sync", "ls", "mb", "rb"]

        instructions = {
            "cp": ["file_generator", "s3_handler"],
            "mv": ["file_generator", "s3_handler"],
            "rm": ["file_generator", "s3_handler"],
            "sync": ["file_generator", "comparator", "s3_handler"],
            "ls": ["s3_handler"],
            "mb": ["s3_handler"],
            "rb": ["s3_handler"],
        }

        params = {"filters": True}
        for cmd in cmds:
            cmd_arc = CommandArchitecture(self.session, cmd, {})
            cmd_arc.create_instructions()
            self.assertEqual(cmd_arc.instructions, instructions[cmd])

        # Test if there is a filter.
        cmd_arc = CommandArchitecture(self.session, "cp", params)
        cmd_arc.create_instructions()
        self.assertEqual(cmd_arc.instructions, ["file_generator", "filters", "s3_handler"])
开发者ID:nealma,项目名称:aws-cli,代码行数:27,代码来源:test_s3.py

示例14: test_run_remove

 def test_run_remove(self):
     """
     This ensures that the architecture sets up correctly for a ``rm``
     command.  It is just just a dry run, but all of the components need
     to be wired correctly for it to work.
     """
     s3_file = "s3://" + self.bucket + "/" + "text1.txt"
     filters = [["--include", "*"]]
     params = {
         "dir_op": False,
         "dryrun": True,
         "quiet": False,
         "src": s3_file,
         "dest": s3_file,
         "filters": filters,
         "paths_type": "s3",
         "region": "us-east-1",
     }
     cmd_arc = CommandArchitecture(self.session, "rm", params)
     cmd_arc.create_instructions()
     cmd_arc.run()
     output_str = "(dryrun) delete: %s" % s3_file
     self.assertIn(output_str, self.output.getvalue())
开发者ID:nealma,项目名称:aws-cli,代码行数:23,代码来源:test_s3.py


注:本文中的awscli.customizations.s3.s3.CommandArchitecture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。