aws ecs register-task-definition --cli-input-json file://.ufo/output/demo-web-prod.json
498558
def register
      data = JSON.parse(IO.read(@template_definition_path))
      data = rubyize_format(data)

      message = "#{data[:family]} task definition registered."
      if @options[:noop]
        message = "NOOP: #{message}"
      else
        register_task_definition(data)
      end

      unless @options[:mute]
        puts "Equivalent aws cli command:"
        file_path = "file://#{@template_definition_path.sub(/^\.\//,'')}"
        puts "  aws ecs register-task-definition --cli-input-json #{file_path}".color(:green)
        puts message
      end
    end
904118
def define
      lib_path = @libs.join(File::PATH_SEPARATOR)
      actual_name = Hash === name ? name.keys.first : name
      unless Rake.application.last_comment
        desc "Analyze code coverage with tests" + 
          (@name==:rcov ? "" : " for #{actual_name}")
      end
      task @name do
        run_code = ''
        RakeFileUtils.verbose(@verbose) do
          run_code =
          case rcov_path
          when nil, ''
            "-S rcov"
          else %!"#{rcov_path}"!
          end
          ruby_opts = @ruby_opts.clone
          ruby_opts.push( "-I#{lib_path}" )
          ruby_opts.push run_code
          ruby_opts.push( "-w" ) if @warning
          ruby ruby_opts.join(" ") + " " + option_list +
          %[ -o "#{@output_dir}" ] +
          file_list.collect { |fn| %["#{fn}"] }.join(' ')
        end
      end

      desc "Remove rcov products for #{actual_name}"
      task paste("clobber_", actual_name) do
        rm_r @output_dir rescue nil
      end

      clobber_task = paste("clobber_", actual_name)
      task :clobber => [clobber_task]

      task actual_name => clobber_task
      self
    end
869154
function buildNetworkAcl(name) {
  const cfName = `${name}NetworkAcl`;

  return {
    [cfName]: {
      Type: 'AWS::EC2::NetworkAcl',
      Properties: {
        Tags: [
          {
            Key: 'Name',
            Value: {
              'Fn::Join': [
                '-',
                [
                  {
                    Ref: 'AWS::StackName',
                  },
                  name.toLowerCase(),
                ],
              ],
            },
          },
        ],
        VpcId: {
          Ref: 'VPC',
        },
      },
    },
  };
}
287902
function initTernServer(env, files) {
    ternOptions = {
        defs: env,
        async: true,
        getFile: getFile,
        plugins: {requirejs: {}, doc_comment: true, angular: true},
        ecmaVersion: 9
    };

    // If a server is already created just reset the analysis data before marking it for GC
    if (ternServer) {
        ternServer.reset();
        Infer.resetGuessing();
    }
        
    ternServer = new Tern.Server(ternOptions);

    files.forEach(function (file) {
        ternServer.addFile(file);
    });

}
83643
function Client(options){
	// Endpoint
	this.endpoint = 'ecs.amazonaws.com';
	this.path = '/onca/xml';
	// Identifiers (required parameters)
	this.awsAccessKeyId = options.awsAccessKeyId;
	this.associateTag = options.associateTag;
	this.service = 'AWSECommerceService';
	// Secret key 
	this.awsSecretKey = options.awsSecretKey;
	// API version
	this.version = '2011-08-01';
}
28299
def exit_if_failures!(resp)
      return if resp[:failures].nil? || resp[:failures].empty?

      puts "There was a failure running the ECS task.".color(:red)
      puts "This might be happen if you have a network_mode of awsvpc and have assigned_public_ip to DISABLED."
      puts "This cryptic error also shows up if the network settings have security groups and subnets that are not in the same vpc as the ECS cluster container instances.  Please double check that."
      puts "You can use this command to quickly reconfigure the network settings:"
      puts "  ufo network init --vpc-id XXX."
      puts "More details on the can be found under the 'Task Networking Considerations' section at: "
      puts "https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html"
      puts "Original response with failures:"
      pp resp
      exit 1
    end
254501
function setCliConfiguration() {
  return yargs
    .usage('usage: $0 [options] <aws-elasticsearch-cluster-endpoint>')
    .option('h', {
      alias: 'host',
      default: HOST || '127.0.0.1',
      demand: false,
      describe: 'Host IP Address',
      type: 'string',
    })
    .option('p', {
      alias: 'port',
      default: PORT || 9200,
      demand: false,
      describe: 'Host Port',
      type: 'number',
    })
    .option('r', {
      alias: 'region',
      default: REGION || 'us-west-2',
      demand: false,
      describe: 'AWS region',
      type: 'string',
    })
    .option('e', {
      alias: 'endpoint',
      default: ENDPOINT,
      demand: true,
      describe: 'AWS Elasticsearch Endpoint',
      type: 'string',
    })
    .option('c', {
      alias: 'profile',
      default: AWS_PROFILE || 'default',
      demand: false,
      describe: 'AWS Credentials Profile',
      type: 'string',
    })
    .option('d', {
      alias: 'debug',
      default: DEBUG || false,
      demand: false,
      describe: 'Provides debug logging',
      type: 'boolean',
    })
    .help()
    .version()
    .strict()
}
1370054
function invokeLambda(bucket, key, nextFileNum, lastFileNum, arn, retries) {
    // figure out if there's a next file to process
    if (nextFileNum && arn) {
      const stepfunctions = new AWS.StepFunctions()
      const params = {
        stateMachineArn: arn,
        input: JSON.stringify({ bucket, key, currentFileNum: nextFileNum, lastFileNum, arn, retries}),
        name: `ingest_${nextFileNum}_${Date.now()}`
      }
      stepfunctions.startExecution(params, function(err, data) {
        if (err) {
          console.log(err, err.stack)
        } else {
          console.log(`launched ${JSON.stringify(params)}`)
        }
      }) 
    }
}
37327
function buildCatTasks (opts) {
  // eslint-disable-next-line no-unused-vars
  const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
  /**
   * Perform a [cat.tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request
   *
   * @param {string} format - a short version of the Accept header, e.g. json, yaml
   * @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
   * @param {list} actions - A comma-separated list of actions that should be returned. Leave empty to return all.
   * @param {boolean} detailed - Return detailed task information (default: false)
   * @param {number} parent_task - Return tasks with specified parent task id. Set to -1 to return all.
   * @param {list} h - Comma-separated list of column names to display
   * @param {boolean} help - Return help information
   * @param {list} s - Comma-separated list of column names or column aliases to sort by
   * @param {boolean} v - Verbose mode. Display column headers
   */

  const acceptedQuerystring = [
    'format',
    'node_id',
    'actions',
    'detailed',
    'parent_task',
    'h',
    'help',
    's',
    'v',
    'pretty',
    'human',
    'error_trace',
    'source',
    'filter_path'
  ]

  const snakeCase = {
    nodeId: 'node_id',
    parentTask: 'parent_task',
    errorTrace: 'error_trace',
    filterPath: 'filter_path'
  }

  return function catTasks (params, options, callback) {
    options = options || {}
    if (typeof options === 'function') {
      callback = options
      options = {}
    }
    if (typeof params === 'function' || params == null) {
      callback = params
      params = {}
      options = {}
    }

    // check required parameters
    if (params.body != null) {
      const err = new ConfigurationError('This API does not require a body')
      return handleError(err, callback)
    }

    // validate headers object
    if (options.headers != null && typeof options.headers !== 'object') {
      const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
      return handleError(err, callback)
    }

    var warnings = []
    var { method, body, ...querystring } = params
    querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

    if (method == null) {
      method = 'GET'
    }

    var ignore = options.ignore
    if (typeof ignore === 'number') {
      options.ignore = [ignore]
    }

    var path = ''

    path = '/' + '_cat' + '/' + 'tasks'

    // build request object
    const request = {
      method,
      path,
      body: null,
      querystring
    }

    options.warnings = warnings.length === 0 ? null : warnings
    return makeRequest(request, options, callback)
  }
}
1324948
function creds(done) {
  var configPath = './config.json';
  try { CONFIG = JSON.parse(fs.readFileSync(configPath)); }
  catch(e) {
    beep();
    console.log('[AWS]'.bold.red + ' Sorry, there was an issue locating your config.json. Please see README.md');
    process.exit();
  }
  done();
}
1313821
function buildTasksList (opts) {
  // eslint-disable-next-line no-unused-vars
  const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
  /**
   * Perform a [tasks.list](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request
   *
   * @param {list} nodes - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
   * @param {list} actions - A comma-separated list of actions that should be returned. Leave empty to return all.
   * @param {boolean} detailed - Return detailed task information (default: false)
   * @param {string} parent_task_id - Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all.
   * @param {boolean} wait_for_completion - Wait for the matching tasks to complete (default: false)
   * @param {enum} group_by - Group tasks by nodes or parent/child relationships
   * @param {time} timeout - Explicit operation timeout
   */

  const acceptedQuerystring = [
    'nodes',
    'actions',
    'detailed',
    'parent_task_id',
    'wait_for_completion',
    'group_by',
    'timeout',
    'pretty',
    'human',
    'error_trace',
    'source',
    'filter_path'
  ]

  const snakeCase = {
    parentTaskId: 'parent_task_id',
    waitForCompletion: 'wait_for_completion',
    groupBy: 'group_by',
    errorTrace: 'error_trace',
    filterPath: 'filter_path'
  }

  return function tasksList (params, options, callback) {
    options = options || {}
    if (typeof options === 'function') {
      callback = options
      options = {}
    }
    if (typeof params === 'function' || params == null) {
      callback = params
      params = {}
      options = {}
    }

    // check required parameters
    if (params.body != null) {
      const err = new ConfigurationError('This API does not require a body')
      return handleError(err, callback)
    }

    // validate headers object
    if (options.headers != null && typeof options.headers !== 'object') {
      const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
      return handleError(err, callback)
    }

    var warnings = []
    var { method, body, ...querystring } = params
    querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

    if (method == null) {
      method = 'GET'
    }

    var ignore = options.ignore
    if (typeof ignore === 'number') {
      options.ignore = [ignore]
    }

    var path = ''

    path = '/' + '_tasks'

    // build request object
    const request = {
      method,
      path,
      body: null,
      querystring
    }

    options.warnings = warnings.length === 0 ? null : warnings
    return makeRequest(request, options, callback)
  }
}
860891
function(files, callback) {
            if (files.dest) {
                options['output'] = files.dest;
            }

			var commandLine = compcOptions.toCommandLine(options);

            if (files.src && files.src.length > 0) {                
                commandLine.push('-include-sources');
                commandLine.push.apply(commandLine, files.src);
                commandLine.push('--');
            }
            
			grunt.verbose.writeln('compc path: ' + binary);
			grunt.verbose.writeln('options: ' + commandLine);
		
			childProcess.execFile(binary, commandLine, function(error, stdout, stderr) {
                grunt.verbose.writeln('output: ' + stdout);
                
				if (error) {
					grunt.log.error(error.toString());
                    
                    if (options.force !== true) {
                        grunt.fail.warn('Compc task has failed.');
                    }                    
				}
                else if (files.dest) {
                    grunt.log.writeln('Build complete: ' + files.dest);
                }
                
                callback(error);
			});
		}
607591
function createFunctionFiles(name, callback) {
  const regExp = /^[a-zA-Z][a-zA-Z0-9-]+$/;
  let q = d3.queue(1);

  if (!name.match(regExp)) {
    return callback('Not a valid AWS CloudFormation stack name - must contain only letters, numbers, dashes and start with an alpha character');
  }

  fs.mkdir(name, function(err) {
    if (err) {
      if (err.code !== 'EEXIST') {
        return callback(err);
      }
    }
    process.chdir(name);
    let files = fs.readdirSync(process.cwd());
    if (files.indexOf('function.js') === -1) {
      let functionJsContent = 'var lambdaCfn = require(\'@mapbox/lambda-cfn\');\n\n'
            + 'module.exports.fn = function(event, context, callback) {\n'
            + '// write Lambda function code here\n\n};';
      q.defer(fs.writeFile, 'function.js', functionJsContent);
    }
    if (files.indexOf('function.template.js') === -1) {
      let functionTemplateContent = 'var lambdaCfn = require(\'@mapbox/lambda-cfn\');\n\n'
            + 'module.exports = lambdaCfn.build({\n'
            + '  name: \'' + name + '\'\n'
            + '});';
      q.defer(fs.writeFile, 'function.template.js', functionTemplateContent);
    }

    q.awaitAll(function(err) {
      if(err) return callback(err);
      return callback(null, 'Created function skeleton files');
    });
  });
}
1101515
function outputFile(configId, outputdata){
  var fname= configId+ '_accounts.csv';
  console.log("Outputing file... "+fname);
  var input= {
    data: outputdata,
    fields: ['id','name','status','subscriptionStarts','subscriptionExpires']
  };
  json2csv(input, function(err, csv) {
    if (err) {
      console.log('ERROR!');
      console.log(err);
    } else {
      fs.writeFileSync(fname,csv);
    }
  });
}
821411
function yakeFileMain(argv, cwd)
{    
    if( cwd === undefined) cwd = process.cwd();
    if( argv === undefined ) argv = process.argv


    const [options, args, helpText] = CLI.CliParse(argv);
    const collection = getTasksFromYakefile(cwd, options.getValueFor('file'));
    const p = loadPackageJson();
    if( tryShowVersion(options, p.version) )
        return;
    if( tryShowTasks(options, collection) )
        return;
    if( tryShowHelp(options, helpText) )
        return;

    tryRunTask(args, collection);
}
543517
def run_ec2_import(self, config_file_location, description, region='us-east-1'):
        
        import_cmd = "aws ec2 import-image --description '{}' --profile '{}' --region '{}' --output 'json'" \
                     " --disk-containers file://{}"\
            .format(description, self.aws_project, region, config_file_location)
        try:
            res = subprocess.check_output(shlex.split(import_cmd), stderr=subprocess.STDOUT)
        except subprocess.CalledProcessError as e:
            print "Error importing to ec2"
            print "output: {}".format(e.output)
            sys.exit(5)

        print "got res: {}".format(res)
        res_json = json.loads(res)
        task_running, import_id = self.check_task_status_and_id(res_json)
        return import_id
201535
def json(directory)
      path = File.join(directory, 'elm-package.json')
      JSON.parse(File.read(path))
    rescue JSON::ParserError
      warn "Invalid JSON in file: #{path.bold}"
    rescue Errno::ENOENT
      warn "Could not find file: #{path.bold}"
    end