public override void ExecuteCmdlet()
        {
            var currentAccount = DataLakeStoreClient.GetAccount(ResourceGroupName, Name);
            var location       = currentAccount.Location;

            if (string.IsNullOrEmpty(DefaultGroup))
            {
                DefaultGroup = currentAccount.DefaultGroup;
            }

            if (Tags == null)
            {
                Tags = TagsConversionHelper.CreateTagHashtable(currentAccount.Tags);
            }

            if (!TrustedIdProviderState.HasValue)
            {
                TrustedIdProviderState = currentAccount.TrustedIdProviderState;
            }

            if (!FirewallState.HasValue)
            {
                FirewallState = currentAccount.FirewallState;
            }

            if (AllowAzureIpState.HasValue && FirewallState.Value == Management.DataLake.Store.Models.FirewallState.Disabled)
            {
                WriteWarning(string.Format(Resources.FirewallDisabledWarning, Name));
            }

            if (!AllowAzureIpState.HasValue)
            {
                AllowAzureIpState = currentAccount.FirewallAllowAzureIps;
            }

            WriteObject(
                new PSDataLakeStoreAccount(
                    DataLakeStoreClient.UpdateAccount(
                        ResourceGroupName,
                        Name,
                        DefaultGroup,
                        TrustedIdProviderState.GetValueOrDefault(),
                        FirewallState.GetValueOrDefault(),
                        AllowAzureIpState.GetValueOrDefault(),
                        Tags,
                        tier: Tier)));
        }
예제 #2
0
        public override void ExecuteCmdlet()
        {
            var currentAccount = DataLakeStoreClient.GetAccount(ResourceGroupName, Name);
            var location       = currentAccount.Location;

            if (string.IsNullOrEmpty(DefaultGroup))
            {
                DefaultGroup = currentAccount.DefaultGroup;
            }

            if (Tags == null)
            {
                Tags = TagsConversionHelper.CreateTagHashtable(currentAccount.Tags);
            }

            if (!TrustedIdProviderState.HasValue)
            {
                TrustedIdProviderState = currentAccount.TrustedIdProviderState;
            }

            if (!FirewallState.HasValue)
            {
                FirewallState = currentAccount.FirewallState;
            }

            WriteObject(
                new PSDataLakeStoreAccount(
                    DataLakeStoreClient.UpdateAccount(
                        ResourceGroupName,
                        Name,
                        DefaultGroup,
                        TrustedIdProviderState.GetValueOrDefault(),
                        FirewallState.GetValueOrDefault(),
                        Tags,
                        tier: Tier)));
        }
        public override void ExecuteCmdlet()
        {
            var currentAccount = DataLakeStoreClient.GetAccount(ResourceGroupName, Name);
            var location       = currentAccount.Location;

            if (string.IsNullOrEmpty(DefaultGroup))
            {
                DefaultGroup = currentAccount.DefaultGroup;
            }

            if (Tags == null)
            {
                Tags = TagsConversionHelper.CreateTagHashtable(currentAccount.Tags);
            }

            if (!TrustedIdProviderState.HasValue)
            {
                TrustedIdProviderState = currentAccount.TrustedIdProviderState;
            }

            if (!FirewallState.HasValue)
            {
                FirewallState = currentAccount.FirewallState;
            }

            if (AllowAzureIpState.HasValue && FirewallState.Value == Management.DataLake.Store.Models.FirewallState.Disabled)
            {
                WriteWarning(string.Format(Resources.FirewallDisabledWarning, Name));
            }

            if (!AllowAzureIpState.HasValue)
            {
                AllowAzureIpState = currentAccount.FirewallAllowAzureIps;
            }

            UpdateEncryptionConfig updateConfig = null;

            if (!string.IsNullOrEmpty(KeyVersion))
            {
                if (currentAccount.EncryptionConfig.Type == EncryptionConfigType.ServiceManaged)
                {
                    throw new ArgumentException(Resources.IncorrectEncryptionTypeForUpdate);
                }

                updateConfig = new UpdateEncryptionConfig
                {
                    KeyVaultMetaInfo = new UpdateKeyVaultMetaInfo
                    {
                        EncryptionKeyVersion = KeyVersion
                    }
                };
            }

            WriteObject(
                new PSDataLakeStoreAccount(
                    DataLakeStoreClient.UpdateAccount(
                        ResourceGroupName,
                        Name,
                        DefaultGroup,
                        TrustedIdProviderState.GetValueOrDefault(),
                        FirewallState.GetValueOrDefault(),
                        AllowAzureIpState.GetValueOrDefault(),
                        Tags,
                        tier: Tier,
                        userConfig: updateConfig)));
        }