예제 #1
0
  def make_gcp_api_scanner(self, project, credentials_path,
                           include_apis=None, exclude_apis=None):
    """Create a GcpApiScanner for the given project and credentials."""
    builder = ApiInvestigatorBuilder()
    builder.include_apis = include_apis or ['compute']
    builder.exclude_apis = exclude_apis or ['compute.*Operations']
    investigator = builder.build()

    default_variables = {'project': project}
    return ApiResourceScanner(investigator, credentials_path,
                              default_variables=default_variables)
예제 #2
0
    def main():
        """Runs the command-line program."""
        options = Main.__get_options()
        builder = ApiInvestigatorBuilder()
        builder.include_apis = options.apis
        builder.exclude_apis = (options.exclude.split(',')
                                if options.exclude else [])
        investigator = builder.build()

        bindings = binding_string_to_dict(options.bindings)
        if options.project and not bindings.get('project'):
            bindings['project'] = options.project

        scanner = ApiResourceScanner(investigator,
                                     options.credentials_path,
                                     default_variables=bindings)
        program = Main(options, scanner)
        return program.process_commands(options)