コード例 #1
0
        public DataLakeStoreAccount UpdateAccount(
            string resourceGroupName,
            string accountName,
            string defaultGroup,
            TrustedIdProviderState providerState,
            FirewallState firewallState,
            Hashtable customTags = null)
        {
            if (string.IsNullOrEmpty(resourceGroupName))
            {
                resourceGroupName = GetResourceGroupByAccount(accountName);
            }

            var tags = TagsConversionHelper.CreateTagDictionary(customTags, true);

            var parameters = new DataLakeStoreAccountUpdateParameters
            {
                DefaultGroup           = defaultGroup,
                Tags                   = tags ?? new Dictionary <string, string>(),
                TrustedIdProviderState = providerState,
                FirewallState          = firewallState
            };

            return(_client.Account.Update(resourceGroupName, accountName, parameters));
        }
コード例 #2
0
        internal static string ToSerializedValue(this TrustedIdProviderState value)
        {
            switch (value)
            {
            case TrustedIdProviderState.Enabled:
                return("Enabled");

            case TrustedIdProviderState.Disabled:
                return("Disabled");
            }
            return(null);
        }
コード例 #3
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;
            }

            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)));
        }
コード例 #4
0
        public DataLakeStoreAccount UpdateAccount(
            string resourceGroupName,
            string accountName,
            string defaultGroup,
            TrustedIdProviderState providerState,
            FirewallState firewallState,
            FirewallAllowAzureIpsState azureIpState,
            Hashtable customTags = null,
            TierType?tier        = null,
            UpdateEncryptionConfig userConfig = null)
        {
            if (string.IsNullOrEmpty(resourceGroupName))
            {
                resourceGroupName = GetResourceGroupByAccount(accountName);
            }

            var tags = TagsConversionHelper.CreateTagDictionary(customTags, true);

            var parameters = new DataLakeStoreAccountUpdateParameters
            {
                DefaultGroup           = defaultGroup,
                Tags                   = tags ?? new Dictionary <string, string>(),
                TrustedIdProviderState = providerState,
                FirewallState          = firewallState,
                FirewallAllowAzureIps  = azureIpState,
                EncryptionConfig       = userConfig
            };

            if (tier.HasValue)
            {
                parameters.NewTier = tier;
            }

            var toReturn = _client.Account.Update(resourceGroupName, accountName, parameters);

            // auto enable the key vault for the user if they updated it.
            if (userConfig != null)
            {
                this.EnableKeyVault(resourceGroupName, accountName);
            }

            return(toReturn);
        }
コード例 #5
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)));
        }
コード例 #6
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;
            }

            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)));
        }