Example #1
0
        public async Task SetSubscriptionContext(AzureSubscription azureSubscription)
        {
            if (BeforeAzureSubscriptionChange != null)
            {
                await BeforeAzureSubscriptionChange?.Invoke(this);
            }

            if (azureSubscription != null)
            {
                if (azureSubscription.Parent != null)
                {
                    if (azureSubscription.Parent != this._AzureTenant)
                    {
                        await SetTenantContext(azureSubscription.Parent);
                    }
                }
            }

            _AzureSubscription = azureSubscription;

            if (_AzureSubscription != null)
            {
                if (_TokenProvider != null)
                {
                    await _TokenProvider.GetToken(_AzureSubscription);
                }

                await _AzureRetriever.SetSubscriptionContext(_AzureSubscription);
            }

            if (AfterAzureSubscriptionChange != null)
            {
                await AfterAzureSubscriptionChange?.Invoke(this);
            }
        }
Example #2
0
        public async Task SetSubscriptionContext(AzureSubscription azureSubscription)
        {
            if (azureSubscription != _AzureSubscription)
            {
                if (BeforeAzureSubscriptionChange != null)
                {
                    await BeforeAzureSubscriptionChange?.Invoke(this);
                }

                if (azureSubscription != null)
                {
                    if (azureSubscription.AzureTenant != this.AzureTenant)
                    {
                        await SetTenantContext(azureSubscription.AzureTenant);
                    }
                }

                _AzureSubscription = azureSubscription;

                if (AfterAzureSubscriptionChange != null)
                {
                    await AfterAzureSubscriptionChange?.Invoke(this);
                }
            }
        }
Example #3
0
        public async Task SetSubscriptionContext(AzureSubscription azureSubscription)
        {
            if (azureSubscription != _AzureSubscription)
            {
                if (BeforeAzureSubscriptionChange != null)
                {
                    await BeforeAzureSubscriptionChange?.Invoke(this);
                }

                if (azureSubscription != null)
                {
                    if (azureSubscription.AzureTenant != this.AzureTenant)
                    {
                        await SetTenantContext(azureSubscription.AzureTenant);
                    }

                    await azureSubscription.InitializeChildrenAsync();

                    await azureSubscription.BindArmResources(_TargetSettings);
                }

                _AzureSubscription = azureSubscription;

                if (AfterAzureSubscriptionChange != null)
                {
                    await AfterAzureSubscriptionChange?.Invoke(this);
                }
            }
        }
Example #4
0
        public async Task SetSubscriptionContext(AzureSubscription azureSubscription)
        {
            if (BeforeAzureSubscriptionChange != null)
            {
                await BeforeAzureSubscriptionChange?.Invoke(this);
            }

            _AzureSubscription = azureSubscription;

            if (_AzureSubscription != null)
            {
                if (_TokenProvider != null)
                {
                    await _TokenProvider.GetToken(_AzureSubscription);
                }

                if (_AzureRetriever == null)
                {
                    _AzureRetriever = new AzureRetriever(this);
                }

                await _AzureRetriever.SetSubscriptionContext(_AzureSubscription);
            }

            if (AfterAzureSubscriptionChange != null)
            {
                await AfterAzureSubscriptionChange?.Invoke(this);
            }
        }
Example #5
0
 private async Task _AzureContext_BeforeAzureSubscriptionChange(AzureContext sender)
 {
     BeforeAzureSubscriptionChange?.Invoke(sender);
 }