How to use the ms-rest-azure.AzureEnvironment.AzureChina function in ms-rest-azure

To help you get started, we’ve selected a few ms-rest-azure examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / meta-azure-service-broker / test / unit / common / utils-tests.js View on Github external
it('should get the environment by the name', function () {
      var envName = 'AzureCloud';
      var env = Common.getEnvironment(envName);
      env.should.be.exactly(AzureEnvironment.Azure);
      envName = 'AzureChinaCloud';
      var env = Common.getEnvironment(envName);
      env.should.be.exactly(AzureEnvironment.AzureChina);
    });
  });
github Azure / meta-azure-service-broker / lib / common / index.js View on Github external
module.exports.getEnvironment = function(environmentName) {
  var azureEnv;
  switch(environmentName) {
    case 'AzureCloud':
        azureEnv = AzureEnvironment.Azure;
        break;
    case 'AzureChinaCloud':
        azureEnv = AzureEnvironment.AzureChina;
        break;
    case 'AzureGermanCloud':
        azureEnv = AzureEnvironment.AzureGermanCloud;
        break;
    case 'AzureUSGovernment':
        azureEnv = AzureEnvironment.AzureUSGovernment;
        break;
    default:
        throw new Error(util.format('Environment %s is not supported', environmentName));
  }

  var len = azureEnv.resourceManagerEndpointUrl.length;
  if (azureEnv.resourceManagerEndpointUrl[len - 1] != '/') {
    azureEnv.resourceManagerEndpointUrl = azureEnv.resourceManagerEndpointUrl + '/' ;
  }
  return azureEnv;