(self, parsed_args, parsed_globals)
| 72 | ] |
| 73 | |
| 74 | def _run_main(self, parsed_args, parsed_globals): |
| 75 | params = parsed_args |
| 76 | params.session = self._session |
| 77 | validate_region(params, parsed_globals) |
| 78 | validate_instance_name(params) |
| 79 | validate_tags(params) |
| 80 | validate_iam_user_arn(params) |
| 81 | |
| 82 | self.codedeploy = self._session.create_client( |
| 83 | 'codedeploy', |
| 84 | region_name=params.region, |
| 85 | endpoint_url=parsed_globals.endpoint_url, |
| 86 | verify=parsed_globals.verify_ssl, |
| 87 | ) |
| 88 | self.iam = self._session.create_client( |
| 89 | 'iam', region_name=params.region |
| 90 | ) |
| 91 | |
| 92 | try: |
| 93 | if not params.iam_user_arn: |
| 94 | self._create_iam_user(params) |
| 95 | self._create_access_key(params) |
| 96 | self._create_user_policy(params) |
| 97 | self._create_config(params) |
| 98 | self._register_instance(params) |
| 99 | if params.tags: |
| 100 | self._add_tags(params) |
| 101 | sys.stdout.write( |
| 102 | f'Copy the on-premises configuration file named {DEFAULT_CONFIG_FILE} to the ' |
| 103 | 'on-premises instance, and run the following command on the ' |
| 104 | 'on-premises instance to install and configure the AWS ' |
| 105 | 'CodeDeploy Agent:\n' |
| 106 | f'aws deploy install --config-file {DEFAULT_CONFIG_FILE}\n' |
| 107 | ) |
| 108 | except Exception as e: |
| 109 | sys.stdout.flush() |
| 110 | sys.stderr.write( |
| 111 | 'ERROR\n' |
| 112 | f'{e}\n' |
| 113 | 'Register the on-premises instance by following the ' |
| 114 | 'instructions in "Configure Existing On-Premises Instances by ' |
| 115 | 'Using AWS CodeDeploy" in the AWS CodeDeploy User ' |
| 116 | 'Guide.\n' |
| 117 | ) |
| 118 | return 255 |
| 119 | return 0 |
| 120 | |
| 121 | def _create_iam_user(self, params): |
| 122 | sys.stdout.write('Creating the IAM user... ') |
nothing calls this directly
no test coverage detected