Beispiel #1
0
        public AciExecutor(RuntimeConfig runtimeConfig)
        {
            if (!(runtimeConfig is AciConfig))
            {
                throw new ArgumentException("AciExecutor can only accept AciConfig as runtime config");
            }

            this.aciConfig = runtimeConfig as AciConfig;
            this.ValidateAciConfig(this.aciConfig);
        }
Beispiel #2
0
        private void ValidateAciConfig(AciConfig aciConfig)
        {
            if (string.IsNullOrWhiteSpace(aciConfig.AzureTenantId))
            {
                throw new ArgumentNullException("aciConfig.AzureTenantId");
            }

            if (string.IsNullOrWhiteSpace(aciConfig.AzureSubscriptionId))
            {
                throw new ArgumentNullException("aciConfig.AzureSubscriptionId");
            }

            if (string.IsNullOrWhiteSpace(aciConfig.AzureClientId))
            {
                throw new ArgumentNullException("aciConfig.AzureClientId");
            }

            if (string.IsNullOrWhiteSpace(aciConfig.AzureClientSecret) &&
                (string.IsNullOrWhiteSpace(aciConfig.Username) ||
                 string.IsNullOrWhiteSpace(aciConfig.Password)))
            {
                throw new ArgumentException("Must specify either aciConfig.AzureClientSecret or aciConfig.Username and aciConfig.Password");
            }
        }