changes from arary to set

This commit is contained in:
Zainuden Veetikadam 2020-12-08 14:49:48 +05:30
commit ab062435f9
2 changed files with 4 additions and 4 deletions

View file

@ -50,7 +50,7 @@ function main() {
core.exportVariable('AZUREPS_HOST_ENVIRONMENT', azurePSHostEnv);
azPath = yield io.which("az", true);
yield executeAzCliCommand("--version");
let azureSupportedCloudName = ["azureusgovernment", "azurechinacloud", "azuregermancloud", "azurecloud", "azurestack"];
let azureSupportedCloudName = new Set(["azureusgovernment", "azurechinacloud", "azuregermancloud", "azurecloud", "azurestack"]);
let creds = core.getInput('creds', { required: true });
let secrets = new actions_secret_parser_1.SecretParser(creds, actions_secret_parser_1.FormatType.JSON);
let servicePrincipalId = secrets.getSecret("$.clientId", false);
@ -64,7 +64,7 @@ function main() {
if (!servicePrincipalId || !servicePrincipalKey || !tenantId || !subscriptionId) {
throw new Error("Not all values are present in the creds object. Ensure clientId, clientSecret, tenantId and subscriptionId are supplied.");
}
if (!azureSupportedCloudName.includes(environment)) {
if (!azureSupportedCloudName.has(environment)) {
throw new Error("Unsupported value for environment is passed.The list of supported values for environment are azureusgovernment', azurechinacloud, azuregermancloud, azurecloud or azurestack");
}
// Attempting Az cli login

View file

@ -23,7 +23,7 @@ async function main() {
azPath = await io.which("az", true);
await executeAzCliCommand("--version");
let azureSupportedCloudName:string[] = ["azureusgovernment", "azurechinacloud", "azuregermancloud","azurecloud","azurestack"];
let azureSupportedCloudName = new Set(["azureusgovernment", "azurechinacloud", "azuregermancloud","azurecloud","azurestack"]);
let creds = core.getInput('creds', { required: true });
let secrets = new SecretParser(creds, FormatType.JSON);
let servicePrincipalId = secrets.getSecret("$.clientId", false);
@ -39,7 +39,7 @@ async function main() {
throw new Error("Not all values are present in the creds object. Ensure clientId, clientSecret, tenantId and subscriptionId are supplied.");
}
if(!azureSupportedCloudName.includes(environment)){
if(!azureSupportedCloudName.has(environment)){
throw new Error("Unsupported value for environment is passed.The list of supported values for environment are azureusgovernment', azurechinacloud, azuregermancloud, azurecloud or azurestack");
}