How to use the HttpRequest function from aws-sdk
Find comprehensive JavaScript aws-sdk.HttpRequest code examples handpicked from public code repositorys.
11 12 13 14 15 16 17 18 19 20 21 22 23
var creds = new AWS.EnvironmentCredentials('AWS'); var endpoint = new AWS.Endpoint(openSearchDomain.endpoint); function postDocumentToOpenSearch(doc, context) { var req = new AWS.HttpRequest(endpoint); req.method = 'POST'; req.path = path.join('/', openSearchDomain.index, openSearchDomain.doctype); req.region = openSearchDomain.region;
201
952
0
52 53 54 55 56 57 58 59 60 61 62
} }; function buildPercolatorRequest(body) { const req = new AWS.HttpRequest(esEndpoint); req.method = 'POST'; req.path = '/terms/_search'; req.body = body; req.region = region;
5
12
0
44 45 46 47 48 49 50 51 52 53 54 55
function sendDocument(httpMethod, path, document, securitytenant, filename) { return new Promise(function (resolve, reject) { console.log({ httpMethod, path, document }); var endpoint = new AWS.Endpoint(domain); var request = new AWS.HttpRequest(endpoint, region); // if this is a kibana request // add a xsrf header if (path.startsWith("_plugin/kibana/")) {
2
4
0
4 5 6 7 8 9 10 11 12 13 14 15
var index = 'movies'; var type = '_search'; exports.lambdaHandler = (event, context, callback) => { let endpoint = new AWS.Endpoint(domain); let request = new AWS.HttpRequest(endpoint); // let credentials = new AWS.EnvironmentCredentials('AWS'); let query = { "size": 25,
0
1
0
47 48 49 50 51 52 53 54 55 56
if (esAws) { // TODO: Grab region from env-vars const region = 'us-east-2'; var endpoint = new AWS.Endpoint(esEndpoint); var aws_request = new AWS.HttpRequest(endpoint, region); aws_request.method = 'POST'; aws_request.path = path.join(aws_request.path, 'segment', '_search'); aws_request.body = JSON.stringify(body);
1
0
0
19 20 21 22 23 24 25 26 27 28 29 30
function putBook(id, json) { indexDocument('PUT', id, json) } function postBook(id, json) { indexDocument('POST', id, json) } function indexDocument(method, id, document, errorCallback, successCallback) { var endpoint = new AWS.Endpoint(DOMAIN); var request = new AWS.HttpRequest(endpoint, REGION); if(request.method != "GET"){ request.body = JSON.stringify(document); request.headers['Content-Length'] = Buffer.byteLength(request.body);
1
0
0
GitHub: TatCT/MARTA_infra
837 838 839 840 841 842 843 844 845 846
InstanceId: context.state.config.connect.instanceId, }; const uri = new URL(context.state.config.connect.apiGatewayEndpoint); const endpoint = new AWS.Endpoint(uri.hostname); const req = new AWS.HttpRequest(endpoint, context.state.config.region); req.method = 'POST'; req.path = uri.pathname; req.headers['Content-Type'] = 'application/json'; req.body = JSON.stringify(initiateChatRequest);
0
0
1
+ 33 other calls in file
30 31 32 33 34 35 36 37 38 39 40 41
const buildRequest = (method, path, body = null) => { const url = `https://@${domain}`; console.log(`url: ${url}`); const endpoint = new AWS.Endpoint(url); const request = new AWS.HttpRequest(endpoint, region); request.method = method; request.path += path; request.headers.host = domain;
0
0
0
21 22 23 24 25 26 27 28 29 30 31 32
signer.addAuthorization(credentials, new Date()) } const createRequest = () => { const endpoint = new AWS.Endpoint(domain) return new AWS.HttpRequest(endpoint, region) } module.exports.ES = {
0
0
0
7 8 9 10 11 12 13 14 15 16 17 18 19
let contentType = core.getInput('content_type'); let uri = core.getInput('uri'); let payload = core.getInput('payload') let endpoint = new AWS.Endpoint(domain); let request = new AWS.HttpRequest(endpoint, region); core.info(payload) request.method = method;
0
0
0
27 28 29 30 31 32 33 34 35 36 37
* @param {string} requestPath - The HTTP path (relative to the Elasticsearch domain), e.g. '.kibana' * @param {Object} [payload] - An optional JavaScript object that will be serialized to the HTTP request body * @returns {Promise} Promise - object with the result of the HTTP response */ async function sendRequest( httpMethod, requestPath, payload) { const request = new AWS.HttpRequest(endpoint, AWS_REGION); request.method = httpMethod; request.path = request.path + requestPath; console.log('path: ' + request.path);
0
0
0
GitHub: bkhajuri/awsservices
40 41 42 43 44 45 46 47 48 49 50
function log(message) { console.log(message); } function buildESRequest(method, path, body) { var req = new AWS.HttpRequest(endpointVehicle); req.method = method; req.path = path; req.region = esDomainVehicle.region; req.headers['presigned-expires'] = false;
0
0
0
aws-sdk.S3 is the most popular function in aws-sdk (7245 examples)