Created
May 5, 2017 00:04
-
-
Save slamb2k/714a934c2e8e5cac21f47691cd81af74 to your computer and use it in GitHub Desktop.
VSMobileCenterBuildConnection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Retrieves the details from the service endpoint defined for Mobile Center in VSTS | |
*/ | |
function getMobileCenterEndpointDetails(endpointInputFieldName) { | |
'use strict'; | |
var errorMessage = "Can't decode endpoint."; | |
var endpoint = tl.getInput(endpointInputFieldName, true); | |
console.log(`Endpoint: ${endpoint}`); | |
if (!endpoint) { | |
throw new Error(errorMessage); | |
} | |
let url = tl.getEndpointUrl(endpoint, false); | |
console.log(`URL: ${url}`); | |
let apiServer = url.substr(0, url.lastIndexOf('/')); | |
console.log(`API Server: ${apiServer}`); | |
let apiVersion = url.substr(url.lastIndexOf('/') + 1); | |
console.log(`API Version: ${apiVersion}`); | |
var authToken = tl.getEndpointAuthorizationParameter(endpoint, 'apitoken', false); | |
if (!authToken) | |
{ | |
console.log("NO AUTHTOKEN"); | |
} | |
return { | |
apiServer: apiServer, | |
apiVersion: apiVersion, | |
authToken: authToken | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment