MCPcopy
hub / github.com/scality/cloudserver / confirmInstanceCredentials

Function confirmInstanceCredentials

lib/management/credentials.js:57–81  ·  view source on GitHub ↗
(
    managementEndpoint, instanceId, creds, log, callback)

Source from the content-addressed store, hash-verified

55}
56
57function confirmInstanceCredentials(
58 managementEndpoint, instanceId, creds, log, callback) {
59 const postData = {
60 serial: creds.serial || 0,
61 publicKey: creds.publicKey,
62 };
63
64 const opts = {
65 headers: {
66 'x-instance-authentication-token': creds.token,
67 },
68 body: postData,
69 };
70
71 request.post(`${managementEndpoint}/${instanceId}/confirm`,
72 opts, (error, response) => {
73 if (error) {
74 return callback(error);
75 }
76 if (response.statusCode === 200) {
77 return callback(null, instanceId, creds.token);
78 }
79 return callback(arsenal.errors.InternalError);
80 });
81}
82
83/**
84 * Initializes credentials and PKI in the management database.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected