MCPcopy Create free account
hub / github.com/aws/aws-cli / _run_main

Method _run_main

awscli/customizations/s3/subcommands.py:1317–1344  ·  view source on GitHub ↗
(self, parsed_args, parsed_globals)

Source from the content-addressed store, hash-verified

1315 ]
1316
1317 def _run_main(self, parsed_args, parsed_globals):
1318 super(RbCommand, self)._run_main(parsed_args, parsed_globals)
1319
1320 if not parsed_args.path.startswith('s3://'):
1321 raise ParamValidationError(
1322 "%s\nError: Invalid argument type" % self.USAGE
1323 )
1324 bucket, key = split_s3_bucket_key(parsed_args.path)
1325
1326 if key:
1327 raise ParamValidationError(
1328 'Please specify a valid bucket name only. '
1329 'E.g. s3://%s' % bucket
1330 )
1331
1332 if parsed_args.force:
1333 self._force(parsed_args.path, parsed_globals)
1334
1335 try:
1336 self.client.delete_bucket(Bucket=bucket)
1337 uni_print("remove_bucket: %s\n" % bucket)
1338 return 0
1339 except Exception as e:
1340 uni_print(
1341 "remove_bucket failed: %s %s\n" % (parsed_args.path, e),
1342 sys.stderr,
1343 )
1344 return 1
1345
1346 def _force(self, path, parsed_globals):
1347 """Calls rm --recursive on the given path."""

Callers

nothing calls this directly

Calls 6

_forceMethod · 0.95
split_s3_bucket_keyFunction · 0.90
uni_printFunction · 0.90
_run_mainMethod · 0.45
delete_bucketMethod · 0.45

Tested by

no test coverage detected