https://192.168.99.100:8443/api/v1/namespaces/node-demo-1/pods/wfswarm-rest-http-s2i-5-build/log?pretty=false&follow=true';
494627
async function podLogEndpoint (config, build) {
  let response;
  try {
    response = await config.openshiftRestClient.api.v1.ns(config.namespace.name).pods(`${build}-build`).log.get();
  } catch (err) {
    response = err;
  }

  return response;
}
616797
def podbay_info(ip_address, path, timeout = 5)
      JSON.parse(
        get_request(
          "http://#{ip_address}:#{Podbay::SERVER_INFO_PORT}/#{path}",
          timeout: timeout
        ).body,
        symbolize_names: true
      )
    end
686762
function (hostId) {

        var swaggerDocResult = {};
        var registeredServices = Shared.registeredServices();
        var bodySchemaCounter = 0;
        var bodySchemaModels = [];
        var pathArray = [];

        registeredServices = registeredServices.sort(function (a, b) {
            var x = a["name"];
            var y = b["name"];
            return ((x < y) ? -1 : ((x > y) ? 1 : 0));
        });

        for (var index in registeredServices) {
            var service = registeredServices[index];
            var responses = service.responses;
            if (service.docs == true && service.hostId == hostId && service.url.match(/^\//)) {
                var parameters = service.parameters;
                var responseSchemes = {};
                if (!_.isEmpty(responses)) {


                    // Build swagger compatible parameters definition
                    var swaggerParameters = [];

                    if (!_.isEmpty(parameters)) {
                        for (var sectionName in parameters) {
                            var section = parameters[sectionName];
                            var parameterName;
                            if (sectionName != "body") {
                                var swaggerParameter = {};
                                var parameter;
                                for (parameterName in section) {

                                    parameter = section[parameterName];

                                    // Skip parameters which should not be shown in the documentation
                                    if (_.get(parameter, 'docs') === false) continue;

                                    var type = parameter.type ? parameter.type.toLowerCase() : "string";
                                    if (type != "string" && type != "number" && type != "boolean" && type != "array") {
                                        type = "string";
                                    }

                                    swaggerParameter = {
                                        "in": sectionName,
                                        "name": parameterName,
                                        "type": type,
                                        "description": parameter.desc || "",
                                        "required": parameter.required || false
                                    };
                                    swaggerParameters.push(swaggerParameter);
                                }
                            } else {

                                var thisHash = "def-" + ObjectHash(parameters[sectionName]);
                                var subSchemaObject = _createBodySchema(bodySchemaModels, parameters[sectionName]);
                                bodySchemaModels = subSchemaObject.bodySchemaModels;

                                _registeredSchemaDefs[thisHash] = true;
                                swaggerParameters.push({
                                    "in": "body",
                                    "name": "body",
                                    schema: {
                                        "$ref": "#/definitions/" + thisHash
                                    }
                                });

                                bodySchemaCounter++;
                            }
                        }
                    }

                    // Build swagger compatible response definition
                    var responseCodes = {};
                    var successHash = null;
                    var errorHash = null;

                    if (!_.isEmpty(service.responseSchemes)) {
                        if (service.responseSchemes.success) {
                            successHash = "def-" + ObjectHash(service.responseSchemes.success);
                            var subSchemaObjectSuccess = _createBodySchema(bodySchemaModels, service.responseSchemes.success);
                            bodySchemaModels = subSchemaObjectSuccess.bodySchemaModels;
                        }
                        if (service.responseSchemes.error) {
                            errorHash = "def-" + ObjectHash(service.responseSchemes.error);
                            var subSchemaObjectError = _createBodySchema(bodySchemaModels, service.responseSchemes.error);
                            bodySchemaModels = subSchemaObjectError.bodySchemaModels;
                        }
                    }

                    for (var responseCode in responses) {
                        if (parseInt(responseCode) == 204) {
                            responseCodes[responseCode] = {
                                "description": responses[responseCode].join(', ')
                            }
                        }
                        else {
                            if (parseInt(responseCode) < 300) {
                                if (successHash) {
                                    _registeredSchemaDefs[successHash] = true;
                                    responseCodes[responseCode] = {
                                        "description": responses[responseCode].join(', '),
                                        "schema": {
                                            "$ref": "#/definitions/" + successHash
                                        }
                                    }
                                }
                                else {
                                    responseCodes[responseCode] = {
                                        "description": responses[responseCode].join(', '),
                                        "schema": {
                                            "$ref": "#/definitions/Success"
                                        }
                                    }
                                }
                            }
                            else {
                                if (errorHash) {
                                    _registeredSchemaDefs[errorHash] = true;
                                    responseCodes[responseCode] = {
                                        "description": responses[responseCode].join(', '),
                                        "schema": {
                                            "$ref": "#/definitions/" + errorHash
                                        }
                                    }
                                }
                                else {
                                    responseCodes[responseCode] = {
                                        "description": responses[responseCode].join(', '),
                                        "schema": {
                                            "$ref": "#/definitions/Error"
                                        }
                                    }
                                }
                            }
                        }
                    }

                    var swaggerDoc = {
                        "description": service.description || "",
                        "responses": responseCodes
                    };

                    if (service.deprecated === true) {
                        swaggerDoc.description = "NOTICE: THIS SERVICE IS DEPRECATED\n" + swaggerDoc.description;
                    }

                    if (!_.isEmpty(swaggerParameters)) {
                        swaggerDoc.parameters = swaggerParameters;
                    }

                    //add swagger docu, if present
                    var swaggerPath = service.url.replace(/:(\w)+/ig, function (match) {

                        swaggerDoc.parameters = swaggerDoc.parameters || [];
                        var pathVaribleIsDefined = false;
                        for (var pIndex in swaggerParameters) {
                            if (swaggerParameters[pIndex].in == "path" && swaggerParameters[pIndex].name == match.substring(1)) {
                                pathVaribleIsDefined = true
                            }
                        }
                        if (pathVaribleIsDefined == false) {
                            swaggerDoc.parameters.push({
                                "in": "path",
                                "name": match.substring(1),
                                "description": match.substring(1),
                                "required": true,
                                "type": "string"
                            });
                        }

                        return '{' + match.substring(1) + '}';
                    });

                    var env = Shared.config("environment");

                    if (_.isEmpty(swaggerDocResult)) {
                        swaggerDocResult = {};
                        swaggerDocResult["swagger"] = "2.0";
                        swaggerDocResult["info"] = {
                            "title": env.title || "API",
                            "description": env.description || "API documentation",
                            "version": env.version || "1.0"
                        };
                        //swaggerDocResult["host"] = "localhost:3000";
                        swaggerDocResult["basePath"] = "/";
                        swaggerDocResult["produces"] = ["application/json"];
                        swaggerDocResult["definitions"] = {
                            "ServiceDescriptions": {
                                "properties": {
                                    "status": {
                                        "type": "number"
                                    },
                                    response: {
                                        "type": "array",
                                        "items": {
                                            "$ref": "#/definitions/ServiceDescription"
                                        }
                                    }
                                }
                            },
                            "ServiceDescription": {
                                "properties": {
                                    "modified": {
                                        "type": "string"
                                    },
                                    "url": {
                                        "type": "string"
                                    },
                                    "authorization": {
                                        "type": "boolean"
                                    },
                                    "name": {
                                        "type": "string"
                                    },
                                    "requestMethods": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "Error": {
                                "properties": {
                                    "status": {
                                        type: "number"
                                    },
                                    "errors": {
                                        "type": "array",
                                        "items": {
                                            "$ref": "#/definitions/ErrorDescription"
                                        }
                                    }
                                }
                            },
                            "ErrorDescription": {
                                "properties": {
                                    "code": {
                                        "type": "string"
                                    },
                                    "msg": {
                                        "type": "string"
                                    }
                                }
                            },
                            "Success": {
                                "properties": {
                                    "status": {
                                        "type": "number"
                                    },
                                    response: {}

                                }
                            }
                        };
                        var env = Shared.config('environment');
                        if (env.swagger) {
                            swaggerDocResult = _.merge(swaggerDocResult, _.cloneDeep(Shared.config('environment.swagger')));
                        }
                    }

                    //Register body schema models
                    for (var sIndex in bodySchemaModels) {
                        if (_registeredSchemaDefs[bodySchemaModels[sIndex].name]) {
                            swaggerDocResult.definitions[bodySchemaModels[sIndex].name] = bodySchemaModels[sIndex].schema;
                        }
                    }

                    for (var rSIndex in responseSchemes) {
                        //swaggerDocResult.definitions[rSIndex] = responseSchemes[rSIndex];
                    }

                    swaggerDocResult.paths = swaggerDocResult.paths || {};

                    var data = swaggerDoc;

                    if (service.deprecated === true) {
                        data.tags = [service.name + " (deprecated)"];
                    }
                    else {
                        data.tags = [service.name];
                    }

                    pathArray.push({
                        name: (service.name + swaggerPath + service.requestMethod.toLowerCase()).replace(/[^a-zA-Z0-9]+/g, ""),
                        requestMethod: service.requestMethod.toLowerCase(),
                        path: swaggerPath,
                        data: data
                    });
                }
            }
        }


        if (!_.isEmpty(pathArray)) {
            swaggerDocResult.paths = swaggerDocResult.paths || {};
            pathArray = pathArray.sort(function (a, b) {
                var x = a["name"];
                var y = b["name"];
                return ((x < y) ? -1 : ((x > y) ? 1 : 0));
            });

            for (var index in pathArray) {
                var path = pathArray[index]["path"];
                swaggerDocResult.paths[path] = swaggerDocResult.paths[path] || {};
                swaggerDocResult.paths[path][pathArray[index]["requestMethod"]] = pathArray[index]["data"]
            }
        }

        return swaggerDocResult;

    }
1067035
private static List<NodeInfo> buildPartitionHosts(List<NodeInfo> nodeInfos, CouchbasePartitionInfo partitionInfo) {
        List<NodeInfo> partitionHosts = new ArrayList<NodeInfo>();
        for (String rawHost : partitionInfo.partitionHosts()) {
            NetworkAddress convertedHost;
            int directPort;
            try {
                String parts[] = rawHost.split(":");
                String host = "";
                String port = parts[parts.length - 1];
                if (parts.length > 2) {
                    // Handle IPv6 syntax
                    for (int i = 0; i < parts.length - 1; i++) {
                        host += parts[i];
                        if (parts[i].endsWith("]")) {
                            break;
                        } else {
                            host += ":";
                        }
                    }
                } else {
                    // Simple IPv4 Handling
                    host = parts[0];
                }

                convertedHost = NetworkAddress.create(host);
                try {
                    directPort = Integer.parseInt(port);
                } catch (NumberFormatException e) {
                    LOGGER.warn("Could not parse port from the node address: {}, fallback to 0", system(rawHost));
                    directPort = 0;
                }
            } catch (Exception e) {
                throw new ConfigurationException("Could not resolve " + rawHost + "on config building.", e);
            }
            for (NodeInfo nodeInfo : nodeInfos) {
                // Make sure we only take into account nodes which contain KV
                if (!nodeInfo.services().containsKey(ServiceType.BINARY)) {
                    continue;
                }

                if (nodeInfo.hostname().equals(convertedHost) &&
                        (nodeInfo.services().get(ServiceType.BINARY) == directPort || directPort == 0)) {
                    partitionHosts.add(nodeInfo);
                }
            }
        }
        if (partitionHosts.size() != partitionInfo.partitionHosts().length) {
            throw new ConfigurationException("Partition size is not equal after conversion, this is a bug.");
        }
        return partitionHosts;
    }
1285773
function buildVpcFlowLogs({ name = 'S3FlowLog' } = {}) {
  return {
    [name]: {
      Type: 'AWS::EC2::FlowLog',
      DependsOn: 'LogBucketPolicy',
      Properties: {
        LogDestinationType: 's3',
        LogDestination: {
          'Fn::GetAtt': ['LogBucket', 'Arn'],
        },
        ResourceId: {
          Ref: 'VPC',
        },
        ResourceType: 'VPC',
        TrafficType: 'ALL',
      },
    },
  };
}
51542
def get_all_namespaces(offset=None, count=None, proxy=None, hostport=None):
    
    assert proxy or hostport, 'Need proxy or hostport'
    if proxy is None:
        proxy = connect_hostport(hostport)

    offset = 0 if offset is None else offset

    schema = {
        'type': 'object',
        'properties': {
            'namespaces': {
                'type': 'array',
                'items': {
                    'type': 'string',
                    'pattern': OP_NAMESPACE_PATTERN,
                },
            },
        },
        'required': [
            'namespaces'
        ],
    }

    namespaces_schema = json_response_schema(schema)

    resp = {}
    try:
        resp = proxy.get_all_namespaces()
        resp = json_validate(namespaces_schema, resp)
        if json_is_error(resp):
            return resp

    except ValidationError as e:
        if BLOCKSTACK_DEBUG:
            log.exception(e)

        resp = {'error': 'Server response did not match expected schema.  You are likely communicating with an out-of-date Blockstack node.', 'http_status': 502}
        return resp

    except socket.timeout:
        log.error("Connection timed out")
        resp = {'error': 'Connection to remote host timed out.', 'http_status': 503}
        return resp

    except socket.error as se:
        log.error("Connection error {}".format(se.errno))
        resp = {'error': 'Connection to remote host failed.', 'http_status': 502}
        return resp

    except Exception as ee:
        if BLOCKSTACK_DEBUG:
            log.exception(ee)

        log.error("Caught exception while connecting to Blockstack node: {}".format(ee))
        resp = {'error': 'Failed to contact Blockstack node.  Try again with `--debug`.', 'http_status': 500}
        return resp

    stride = len(resp['namespaces']) if count is None else offset + count
    return resp['namespaces'][offset:stride]
679288
public static ReplyDetailWarpper getDummyNewsReplyDetailWarpper() {
        ReplyDetail replyDetail1 = new ReplyDetail();
        replyDetail1.setTitle("fork me");
        replyDetail1.setMediaUrl("http://c.hiphotos.baidu.com/baike/c%3DbaikeA4%2C10%2C95/sign=c1767bbf4b36acaf4de0c1ad15b2e851/29381f30e924b899a39841be6e061d950b7b02087af4d6b3.jpg");
        replyDetail1.setUrl("https://github.com/usc/wechat-mp-sdk");
        replyDetail1.setDescription("hello world, wechat mp sdk is coming");

        ReplyDetail replyDetail2 = new ReplyDetail();
        replyDetail2.setTitle("star me");
        replyDetail2.setMediaUrl("http://e.hiphotos.baidu.com/baike/pic/item/96dda144ad345982665e49810df431adcaef84c9.jpg");
        replyDetail2.setUrl("https://github.com/usc/wechat-mp-web");
        replyDetail2.setDescription("wechat mp web demo");

        return new ReplyDetailWarpper("news", Arrays.asList(replyDetail1, replyDetail2));
    }
349382
function K8sutil() {
    // this.getNamespace();
    podName = os.hostname();
    podGenerateName = podName.substr(0, podName.lastIndexOf('-'));
    logger.debug('k8sutil', 'K8sutil()', 'The pod name: ', podName);
    fetchContainerID();
    try {
        // var kubeconfig = Api.config.fromKubeconfig();
        var kubeconfig = Api.config.getInCluster();
        kubeconfig.promises = true;
        // kubeconfig.namespace = 'default';
        logger.debug('k8sutil', 'K8sutil()', 'Kubeconfig', kubeconfig);
        core = new Api.Core(kubeconfig);
        ext = new Api.Extensions(kubeconfig);
        namespace = core.namespaces.namespace;
        logger.info('k8sutil', 'K8sutil()', 'Current namespace', namespace);
        if (!podJson) {
            core.ns(namespace).pods(this.getPodName()).get().then(parsePodInfo).catch(
                function(err) {
                    logger.error('k8sutil', 'K8sutil()', err.message);
                }
            );
        }

    } catch (e) {
        logger.debug('k8sutil', 'K8sutil()',
            'Failed to load K8S configuration, is not a ICp environment.');
    }
    findIngressSvc();
    setNodeIPs();
}
685796
async function maybeApi ({ apiAddress, apiOpts, ipfsConnectionTest, IpfsApi }) {
  try {
    const ipfs = new IpfsApi(apiAddress, apiOpts)
    await ipfsConnectionTest(ipfs)
    return { ipfs, provider, apiAddress }
  } catch (error) {
    console.log('Failed to connect to ipfs-api', apiAddress)
  }
}
565731
public void toRfc3164SyslogMessage(Writer out) throws IOException {

        int pri = facility.numericalCode() * 8 + severity.numericalCode();

        out.write('<');
        out.write(Integer.toString(pri));
        out.write('>');
        out.write(rfc3164DateFormat.format(timestamp == null ? new Date() : new Date(timestamp))); // message time
        out.write(SP);
        out.write((hostname == null) ? localhostNameReference.get() : hostname); // emitting server hostname
        out.write(SP);
        writeNillableValue(appName, out); // appname

        if (msg != null) {
            out.write(": ");
            msg.writeTo(out);
        }
    }
1304510
function search(term = _noSearchTermError()) {
	const url = `${API}/devrant/search`;
	const params = {
		app: 3,
		term
	};

	return http
		.GET(url, params)
		.then(data => data.results);
}
1092421
function createSchema() {
    return joi.object().keys({
        host: joi
            .string()
            .label('Webserver host'),
        port: joi
            .number()
            .integer()
            .min(1)
            .max(65535)
            .label('Webserver port number'),
        cors: joi
            .boolean()
            .label('Enable CORS'),
        ui: joi
            .boolean()
            .label('Enable sandbox UI'),
        silent: joi
            .boolean()
            .label('Enable silent mode'),
        level: joi
            .string()
            .lowercase()
            .valid('silly', 'debug', 'verbose', 'info', 'warn', 'error')
            .label('Logging level'),
        engine: joi
            .string()
            .lowercase()
            .valid('phantomjs', 'slimerjs')
            .label('Default engine'),
        timeout: joi
            .number()
            .integer()
            .min(1)
            .label('Timeout'),
        options: joi
            .object()
            .default({})
            .label('Engine default options'),
        command: joi
            .string()
            .label('Command to run screenshot capturing'),
        storage: joi
            .string()
            .label('Storage path'),
        cache: joi
            .number()
            .integer()
            .label('Cache life time'),
        cleanupStartup: joi
            .boolean()
            .label('Cleanup storage at startup'),
        cleanupRuntime: joi
            .boolean()
            .label('Cleanup storage after sending image'),
        compress: joi
            .boolean()
            .label('Compress screenshots'),
        whitelist: joi
            .array()
            .default([])
            .label('List of allowed sites (RegExps)')
    });
}
1330910
def v2_endpoint?
      return @has_v2_endpoint unless @has_v2_endpoint.nil?

      begin
        @conn.post '/api/v2/update', '{}'
      rescue SFRest::BadRequestError
        return @has_v2_endpoint = true
      rescue SFRest::InvalidResponse => e
        return @has_v2_endpoint = false if e.message =~ /Invalid data, status 404/

        raise e
      end
    end
633793
def describe(Name,
             region=None, key=None, keyid=None, profile=None):
    '''
    

    '''

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        trails = conn.describe_trails(trailNameList=[Name])
        if trails and trails.get('trailList'):
            keys = ('Name', 'S3BucketName', 'S3KeyPrefix',
                    'SnsTopicName', 'IncludeGlobalServiceEvents',
                    'IsMultiRegionTrail',
                    'HomeRegion', 'TrailARN',
                    'LogFileValidationEnabled', 'CloudWatchLogsLogGroupArn',
                    'CloudWatchLogsRoleArn', 'KmsKeyId')
            trail = trails['trailList'].pop()
            return {'trail': dict([(k, trail.get(k)) for k in keys])}
        else:
            return {'trail': None}
    except ClientError as e:
        err = __utils__['boto3.get_error'](e)
        if e.response.get('Error', {}).get('Code') == 'TrailNotFoundException':
            return {'trail': None}
        return {'error': __utils__['boto3.get_error'](e)}
129024
function buildRedshiftSubnetGroup(numZones = 0, { name = 'RedshiftSubnetGroup' } = {}) {
  if (numZones < 1) {
    return {};
  }

  const subnetIds = [];
  for (let i = 1; i <= numZones; i += 1) {
    subnetIds.push({ Ref: `${DB_SUBNET}Subnet${i}` });
  }

  return {
    [name]: {
      Type: 'AWS::Redshift::ClusterSubnetGroup',
      Properties: {
        Description: {
          Ref: 'AWS::StackName',
        },
        SubnetIds: subnetIds,
      },
    },
  };
}
1356983
function buildRouteTable(name, position, zone) {
  const cfName = `${name}RouteTable${position}`;
  return {
    [cfName]: {
      Type: 'AWS::EC2::RouteTable',
      Properties: {
        VpcId: {
          Ref: 'VPC',
        },
        Tags: [
          {
            Key: 'Name',
            Value: {
              'Fn::Join': [
                '-',
                [
                  {
                    Ref: 'AWS::StackName',
                  },
                  name.toLowerCase(),
                  zone,
                ],
              ],
            },
          },
        ],
      },
    },
  };
}
1311016
function proxy() {
  const defaultProxy = {
    changeOrigin: true,
    ws: true,
    logLevel: 'info',
    xfwd: true,
    logProvider() {
      return {
        log(...args) {
          Logger.log(proxyLogRewrite(args));
        },
        debug(...args) {
          Logger.debug(proxyLogRewrite(args));
        },
        info(...args) {
          Logger.info(proxyLogRewrite(args));
        },
        warn(...args) {
          Logger.warn(proxyLogRewrite(args));
        },
        error(...args) {
          Logger.error(proxyLogRewrite(args));
        }
      };
    }
  };

  const { proxies } = settings.configuration;

  if (!proxies) {
    return null;
  }

  const config = [];

  // Iterate through each proxy configuration
  proxies.forEach(proxyConfiguration => {
    // Merge in defaults including custom Logger and custom request/response function
    const proxyConfig = merge({}, defaultProxy, proxyConfiguration, {
      onProxyReq: (proxyReq, req) => {
        onRequest(proxyConfiguration, proxyReq, req);
        if (typeof proxyConfiguration.onProxyReq === 'function') {
          proxyConfiguration.onProxyReq(proxyReq, req);
        }
      },

      onProxyRes: (proxyRes, req, res) => {
        onResponse(proxyConfiguration, proxyRes, req, res);
        if (typeof proxyConfiguration.onProxyRes === 'function') {
          proxyConfiguration.onProxyRes(proxyRes, req, res);
        }
      },

      onError: (err, req, res) => {
        onProxyError(proxyConfiguration, err, req, res);
        if (typeof proxyConfiguration.onError === 'function') {
          proxyConfiguration.onError(err, req, res);
        }
      }
    });

    const proxyContext = Array.isArray(proxyConfig.context) ? proxyConfig.context[0] : proxyConfig.context;

    // Only create proxy if enabled
    if (proxyConfig.enabled) {
      config.push(proxyConfig);
    } else {
      Logger.info(
        `Proxy with context: ${chalk.dim(proxyContext)} and target: ${chalk.dim(proxyConfig.target)} is ${chalk.magenta(
          'DISABLED'
        )}`
      );
    }
  });

  // return null if the array is 0 to make the checks easier upstream
  return config.length === 0 ? null : config;
}