Esempio n. 1
0
        public override void ExecuteCmdlet()
        {
            DataLakeStoreAccountInfo defaultAccount = null;

            if (!string.IsNullOrEmpty(DefaultDataLakeStore))
            {
                defaultAccount = new DataLakeStoreAccountInfo
                {
                    Name = DefaultDataLakeStore
                };
            }

            WriteObject(DataLakeAnalyticsClient.CreateOrUpdateAccount(ResourceGroupName, Name, null, defaultAccount,
                                                                      null, null, Tags));
        }
Esempio n. 2
0
        protected override void ProcessRecord()
        {
            DataLakeStoreAccount defaultAccount = null;

            if (!string.IsNullOrEmpty(DefaultDataLakeStore))
            {
                defaultAccount = new DataLakeStoreAccount
                {
                    Name = DefaultDataLakeStore
                };
            }

            WriteObject(DataLakeAnalyticsClient.CreateOrUpdateAccount(ResourceGroupName, Name, null, defaultAccount,
                                                                      null, null, Tags));
        }
Esempio n. 3
0
 public override void ExecuteCmdlet()
 {
     WriteObject(
         new PSDataLakeAnalyticsAccount(
             DataLakeAnalyticsClient.CreateOrUpdateAccount(
                 ResourceGroupName,
                 Name,
                 null,
                 null,
                 null,
                 null,
                 Tags,
                 MaxDegreeOfParallelism,
                 MaxJobCount,
                 QueryStoreRetention,
                 Tier)));
 }
        public override void ExecuteCmdlet()
        {
            try
            {
                if (DataLakeAnalyticsClient.GetAccount(ResourceGroupName, Name) != null)
                {
                    throw new CloudException(string.Format(Resources.DataLakeAnalyticsAccountExists, Name));
                }
            }
            catch (CloudException ex)
            {
                if (ex.Body != null && !string.IsNullOrEmpty(ex.Body.Code) && ex.Body.Code == "ResourceNotFound" ||
                    ex.Message.Contains("ResourceNotFound"))
                {
                    // account does not exists so go ahead and create one
                }
                else if (ex.Body != null && !string.IsNullOrEmpty(ex.Body.Code) &&
                         ex.Body.Code == "ResourceGroupNotFound" || ex.Message.Contains("ResourceGroupNotFound"))
                {
                    // resource group not found, let create throw error don't throw from here
                }
                else
                {
                    // all other exceptions should be thrown
                    throw;
                }
            }

            var defaultStorage = new AddDataLakeStoreWithAccountParameters
            {
                Name = DefaultDataLakeStore
            };

            WriteObject(
                new PSDataLakeAnalyticsAccount(
                    DataLakeAnalyticsClient.CreateOrUpdateAccount(
                        ResourceGroupName,
                        Name,
                        Location,
                        defaultStorage,
                        customTags: Tag,
                        maxAnalyticsUnits: MaxAnalyticsUnits,
                        maxJobCount: MaxJobCount,
                        queryStoreRetention: QueryStoreRetention,
                        tier: Tier)));
        }
Esempio n. 5
0
        public override void ExecuteCmdlet()
        {
            if (Tags != null && Tags.Length > 0)
            {
                WriteWarningWithTimestamp(Properties.Resources.TagsWarning);
            }

            DataLakeStoreAccountInfo defaultAccount = null;

            if (!string.IsNullOrEmpty(DefaultDataLakeStore))
            {
                defaultAccount = new DataLakeStoreAccountInfo
                {
                    Name = DefaultDataLakeStore
                };
            }

            WriteObject(DataLakeAnalyticsClient.CreateOrUpdateAccount(ResourceGroupName, Name, null, defaultAccount,
                                                                      null, null, Tags));
        }
Esempio n. 6
0
        public override void ExecuteCmdlet()
        {
            if (Tags != null && Tags.Length > 0)
            {
                WriteWarningWithTimestamp(Properties.Resources.TagsWarning);
            }

            try
            {
                if (DataLakeAnalyticsClient.GetAccount(ResourceGroupName, Name) != null)
                {
                    throw new CloudException(string.Format(Resources.DataLakeAnalyticsAccountExists, Name));
                }
            }
            catch (CloudException ex)
            {
                if (ex.Body != null && !string.IsNullOrEmpty(ex.Body.Code) && ex.Body.Code == "ResourceNotFound" ||
                    ex.Message.Contains("ResourceNotFound"))
                {
                    // account does not exists so go ahead and create one
                }
                else if (ex.Body != null && !string.IsNullOrEmpty(ex.Body.Code) &&
                         ex.Body.Code == "ResourceGroupNotFound" || ex.Message.Contains("ResourceGroupNotFound"))
                {
                    // resource group not found, let create throw error don't throw from here
                }
                else
                {
                    // all other exceptions should be thrown
                    throw;
                }
            }

            var defaultStorage = new DataLakeStoreAccountInfo
            {
                Name = DefaultDataLakeStore
            };

            WriteObject(DataLakeAnalyticsClient.CreateOrUpdateAccount(ResourceGroupName, Name, Location, defaultStorage,
                                                                      customTags: Tags));
        }
Esempio n. 7
0
        protected override void ProcessRecord()
        {
            try
            {
                if (DataLakeAnalyticsClient.GetAcount(ResourceGroupName, Name) != null)
                {
                    throw new CloudException(string.Format(Resources.DataLakeAnalyticsAccountExists, Name));
                }
            }
            catch (CloudException ex)
            {
                if (ex.Error != null && !string.IsNullOrEmpty(ex.Error.Code) && ex.Error.Code == "ResourceNotFound" ||
                    ex.Message.Contains("ResourceNotFound"))
                {
                    // account does not exists so go ahead and create one
                }
                else if (ex.Error != null && !string.IsNullOrEmpty(ex.Error.Code) &&
                         ex.Error.Code == "ResourceGroupNotFound" || ex.Message.Contains("ResourceGroupNotFound"))
                {
                    // resource group not found, let create throw error don't throw from here
                }
                else
                {
                    // all other exceptions should be thrown
                    throw;
                }
            }

            var defaultStorage = new DataLakeStoreAccount
            {
                Name = DefaultDataLakeStore
            };

            WriteObject(DataLakeAnalyticsClient.CreateOrUpdateAccount(ResourceGroupName, Name, Location, defaultStorage,
                                                                      customTags: Tags));
        }
Esempio n. 8
0
        public override void ExecuteCmdlet()
        {
            if (string.IsNullOrEmpty(ResourceGroupName))
            {
                ResourceGroupName = DataLakeAnalyticsClient.GetResourceGroupByAccountName(Name);
            }

            var account = DataLakeAnalyticsClient.GetAccount(ResourceGroupName, Name);

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

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

            WriteObject(
                new PSDataLakeAnalyticsAccount(
                    DataLakeAnalyticsClient.CreateOrUpdateAccount(
                        ResourceGroupName,
                        Name,
                        null,
                        null,
                        null,
                        null,
                        Tags,
                        MaxAnalyticsUnits,
                        MaxJobCount,
                        QueryStoreRetention,
                        Tier,
                        FirewallState,
                        AllowAzureIpState)));
        }