Last active
August 18, 2020 21:24
-
-
Save rajitha1998/6a9686da7d799c9fb7e387d110dbd958 to your computer and use it in GitHub Desktop.
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
const { ContainerServiceClient } = require("@azure/arm-containerservice"); | |
/*This is an auto generated class, please do not change.*/ | |
/** | |
* Class to create a containerservice object | |
* @category Azure | |
*/ | |
class containerservice { | |
/** | |
* | |
* @param {module} azureRestSdk Azure Rest SDK | |
*/ | |
constructor(azureRestSdk) { | |
this._azureRestSdk = azureRestSdk; | |
} | |
/** | |
* Trigers the createOrUpdate function of containerservice | |
* @param {StringKeyword} resourceGroupName - Mandatory parameter | |
* @param {StringKeyword} resourceName - Mandatory parameter | |
* @param {TypeReference} parameters - Mandatory parameter | |
* @param {TypeReference} [options] - Optional parameter | |
* @returns {Promise<createOrUpdateResponse>} | |
*/ | |
create(resourceGroupName, resourceName, parameters, options = undefined) { | |
return new Promise((resolve, reject) => { | |
this._azureRestSdk | |
.loginWithServicePrincipalSecretWithAuthResponse( | |
process.env.AZURE_CLIENT_ID, | |
process.env.AZURE_CLIENT_SECRET, | |
process.env.AZURE_TENANT_ID | |
) | |
.then(authres => { | |
const client = new ContainerServiceClient( | |
authres.credentials, | |
process.env.AZURE_SUBSCRIPTION_ID | |
); | |
client.managedClusters | |
.createOrUpdate( | |
resourceGroupName, | |
resourceName, | |
parameters, | |
options | |
) | |
.then(result => { | |
resolve(result); | |
}); | |
}) | |
.catch(err => { | |
reject(err); | |
}); | |
}); | |
} | |
} | |
module.exports = containerservice; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment