public PSDataLakeAnalyticsAccount(DataLakeAnalyticsAccount baseAccount) :
     base(
         baseAccount.Location,
         baseAccount.DefaultDataLakeStoreAccount,
         baseAccount.DataLakeStoreAccounts,
         baseAccount.Id,
         baseAccount.Name,
         baseAccount.Type,
         baseAccount.Tags,
         baseAccount.ProvisioningState,
         baseAccount.State,
         baseAccount.MaxDegreeOfParallelism,
         baseAccount.QueryStoreRetention,
         baseAccount.MaxJobCount,
         baseAccount.SystemMaxDegreeOfParallelism,
         baseAccount.SystemMaxJobCount,
         baseAccount.StorageAccounts,
         baseAccount.CreationTime,
         baseAccount.LastModifiedTime,
         baseAccount.Endpoint,
         baseAccount.NewTier,
         baseAccount.CurrentTier,
         baseAccount.FirewallState,
         baseAccount.FirewallAllowAzureIps,
         baseAccount.FirewallRules,
         baseAccount.MaxDegreeOfParallelismPerJob,
         baseAccount.MinPriorityPerJob,
         baseAccount.ComputePolicies)
 {
     Properties = new PSDataLakeAnalyticsAccountProperties(baseAccount);
 }
Ejemplo n.º 2
0
        public PSDataLakeAnalyticsAccountProperties(DataLakeAnalyticsAccount baseAccount)
        {
            MaxDegreeOfParallelism = baseAccount.MaxDegreeOfParallelism;
            MaxJobCount            = baseAccount.MaxJobCount;
            LastModifiedTime       = baseAccount.LastModifiedTime;
            CreationTime           = baseAccount.CreationTime;
            State                       = baseAccount.State;
            ProvisioningState           = baseAccount.ProvisioningState;
            DefaultDataLakeStoreAccount = baseAccount.DefaultDataLakeStoreAccount;
            Endpoint                    = baseAccount.Endpoint;

            if (baseAccount.DataLakeStoreAccounts != null)
            {
                DataLakeStoreAccounts = new List <PSDataLakeStoreAccountInfo>(baseAccount.DataLakeStoreAccounts.Count);
                foreach (var entry in baseAccount.DataLakeStoreAccounts)
                {
                    DataLakeStoreAccounts.Add(new PSDataLakeStoreAccountInfo(entry));
                }
            }

            if (baseAccount.StorageAccounts != null)
            {
                StorageAccounts = new List <PSStorageAccountInfo>(baseAccount.StorageAccounts.Count);
                foreach (var entry in baseAccount.StorageAccounts)
                {
                    StorageAccounts.Add(new PSStorageAccountInfo(entry));
                }
            }
        }
Ejemplo n.º 3
0
 public PSDataLakeAnalyticsAccount(DataLakeAnalyticsAccount baseAccount) :
     base(
         baseAccount.Location,
         baseAccount.DefaultDataLakeStoreAccount,
         baseAccount.DataLakeStoreAccounts,
         baseAccount.Id,
         baseAccount.Name,
         baseAccount.Type,
         baseAccount.Tags,
         baseAccount.ProvisioningState,
         baseAccount.State,
         baseAccount.MaxDegreeOfParallelism,
         baseAccount.QueryStoreRetention,
         baseAccount.MaxJobCount,
         baseAccount.SystemMaxDegreeOfParallelism,
         baseAccount.SystemMaxJobCount,
         baseAccount.StorageAccounts,
         baseAccount.CreationTime,
         baseAccount.LastModifiedTime,
         baseAccount.Endpoint,
         baseAccount.NewTier,
         baseAccount.CurrentTier)
 {
     Properties = new PSDataLakeAnalyticsAccountProperties(baseAccount);
 }
Ejemplo n.º 4
0
        public static void CreateAccounts()
        {
            //ADLS account first, ADLA requires an ADLS account
            var adlsParameters = new DataLakeStoreAccount(location: _location);

            _adlsClient.Account.Create(_resourceGroupName, _adlsAccountName, adlsParameters);

            var defaultAdlsAccount = new List <DataLakeStoreAccountInfo> {
                new DataLakeStoreAccountInfo(_adlsAccountName, new DataLakeStoreAccountInfoProperties())
            };
            var adlaProperties = new DataLakeAnalyticsAccountProperties(defaultDataLakeStoreAccount: _adlsAccountName, dataLakeStoreAccounts: defaultAdlsAccount);
            var adlaParameters = new DataLakeAnalyticsAccount(properties: adlaProperties, location: _location);

            _adlaClient.Account.Create(_resourceGroupName, _adlaAccountName, adlaParameters);
        }
Ejemplo n.º 5
0
        public PSDataLakeAnalyticsAccount(DataLakeAnalyticsAccount baseAccount) :
            base(
                id: baseAccount.Id,
                name: baseAccount.Name,
                type: baseAccount.Type,
                location: baseAccount.Location,
                tags: baseAccount.Tags,
                accountId: baseAccount.AccountId,
                provisioningState: baseAccount.ProvisioningState,
                state: baseAccount.State,
                creationTime: baseAccount.CreationTime,
                lastModifiedTime: baseAccount.LastModifiedTime,
                endpoint: baseAccount.Endpoint,
                defaultDataLakeStoreAccount: baseAccount.DefaultDataLakeStoreAccount,
                dataLakeStoreAccounts: baseAccount.DataLakeStoreAccounts,
                storageAccounts: baseAccount.StorageAccounts,
                computePolicies: baseAccount.ComputePolicies,
                firewallRules: baseAccount.FirewallRules,
                firewallState: baseAccount.FirewallState,
                firewallAllowAzureIps: baseAccount.FirewallAllowAzureIps,
                newTier: baseAccount.NewTier,
                currentTier: baseAccount.CurrentTier,
                maxJobCount: baseAccount.MaxJobCount,
                systemMaxJobCount: baseAccount.SystemMaxJobCount,
                maxDegreeOfParallelism: baseAccount.MaxDegreeOfParallelism,
                systemMaxDegreeOfParallelism: baseAccount.SystemMaxDegreeOfParallelism,
                maxDegreeOfParallelismPerJob: baseAccount.MaxDegreeOfParallelismPerJob,
                minPriorityPerJob: baseAccount.MinPriorityPerJob,
                queryStoreRetention: baseAccount.QueryStoreRetention)
        {
            if (baseAccount.DataLakeStoreAccounts != null)
            {
                DataLakeStoreAccounts = new List <PSDataLakeStoreAccountInfo>(baseAccount.DataLakeStoreAccounts.Count);
                foreach (var entry in baseAccount.DataLakeStoreAccounts)
                {
                    DataLakeStoreAccounts.Add(new PSDataLakeStoreAccountInfo(entry));
                }
            }

            if (baseAccount.StorageAccounts != null)
            {
                StorageAccounts = new List <PSStorageAccountInfo>(baseAccount.StorageAccounts.Count);
                foreach (var entry in baseAccount.StorageAccounts)
                {
                    StorageAccounts.Add(new PSStorageAccountInfo(entry));
                }
            }
        }
Ejemplo n.º 6
0
        public PSDataLakeAnalyticsAccount(DataLakeAnalyticsAccount baseAccount) :
            base(
                baseAccount.Location,
                baseAccount.DefaultDataLakeStoreAccount,
                baseAccount.DataLakeStoreAccounts,
                baseAccount.Id,
                baseAccount.Name,
                baseAccount.Type,
                baseAccount.Tags,
                baseAccount.ProvisioningState,
                baseAccount.State,
                baseAccount.CreationTime,
                baseAccount.LastModifiedTime,
                baseAccount.Endpoint,
                baseAccount.AccountId,
                baseAccount.MaxDegreeOfParallelism,
                baseAccount.QueryStoreRetention,
                baseAccount.MaxJobCount,
                baseAccount.SystemMaxDegreeOfParallelism,
                baseAccount.SystemMaxJobCount,
                baseAccount.StorageAccounts,
                baseAccount.NewTier,
                baseAccount.CurrentTier,
                baseAccount.FirewallState,
                baseAccount.FirewallAllowAzureIps,
                baseAccount.FirewallRules,
                baseAccount.MaxDegreeOfParallelismPerJob,
                baseAccount.MinPriorityPerJob,
                baseAccount.ComputePolicies)
        {
            if (baseAccount.DataLakeStoreAccounts != null)
            {
                DataLakeStoreAccounts = new List <PSDataLakeStoreAccountInfo>(baseAccount.DataLakeStoreAccounts.Count);
                foreach (var entry in baseAccount.DataLakeStoreAccounts)
                {
                    DataLakeStoreAccounts.Add(new PSDataLakeStoreAccountInfo(entry));
                }
            }

            if (baseAccount.StorageAccounts != null)
            {
                StorageAccounts = new List <PSStorageAccountInfo>(baseAccount.StorageAccounts.Count);
                foreach (var entry in baseAccount.StorageAccounts)
                {
                    StorageAccounts.Add(new PSStorageAccountInfo(entry));
                }
            }
        }
        public DataLakeAnalyticsAccount CreateOrUpdateAccount(string resourceGroupName, string accountName,
                                                              string location,
                                                              DataLakeStoreAccountInfo defaultDataLakeStoreAccount             = null,
                                                              IList <DataLakeStoreAccountInfo> additionalDataLakeStoreAccounts = null,
                                                              IList <StorageAccountInfo> additionalStorageAccounts             = null,
                                                              Hashtable customTags = null)
        {
            if (string.IsNullOrEmpty(resourceGroupName))
            {
                resourceGroupName = GetResourceGroupByAccountName(accountName);
            }

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

            var parameters = new DataLakeAnalyticsAccount
            {
                Name     = accountName,
                Location = location,
                Tags     = tags ?? new Dictionary <string, string>()
            };


            parameters.Properties = new DataLakeAnalyticsAccountProperties();

            if (defaultDataLakeStoreAccount != null)
            {
                parameters.Properties.DefaultDataLakeStoreAccount =
                    defaultDataLakeStoreAccount.Name;
            }

            if (additionalStorageAccounts != null && additionalStorageAccounts.Count > 0)
            {
                parameters.Properties.StorageAccounts = additionalStorageAccounts;
            }

            if (additionalDataLakeStoreAccounts != null && additionalDataLakeStoreAccounts.Count > 0)
            {
                if (defaultDataLakeStoreAccount != null)
                {
                    additionalDataLakeStoreAccounts.Add(defaultDataLakeStoreAccount);
                }

                parameters.Properties.DataLakeStoreAccounts = additionalDataLakeStoreAccounts;
            }
            else if (defaultDataLakeStoreAccount != null)
            {
                parameters.Properties.DataLakeStoreAccounts = new List <DataLakeStoreAccountInfo>
                {
                    defaultDataLakeStoreAccount
                };
            }

            var accountExists = false;

            try
            {
                if (GetAccount(resourceGroupName, accountName) != null)
                {
                    accountExists = true;
                }
            }
            catch
            {
                // intentionally empty since if there is any exception attempting to
                // get the account we know it doesn't exist and we will attempt to create it fresh.
            }

            return(accountExists
                ? _accountClient.Account.Update(resourceGroupName, accountName, parameters)
                : _accountClient.Account.Create(resourceGroupName, accountName, parameters));
        }
        public DataLakeAnalyticsAccount CreateOrUpdateAccount(string resourceGroupName, string accountName,
                                                              string location,
                                                              DataLakeStoreAccountInfo defaultDataLakeStoreAccount             = null,
                                                              IList <DataLakeStoreAccountInfo> additionalDataLakeStoreAccounts = null,
                                                              IList <StorageAccountInfo> additionalStorageAccounts             = null,
                                                              Hashtable customTags       = null,
                                                              int?maxDegreeOfParallelism = 0,
                                                              int?maxJobCount            = 0,
                                                              int?queryStoreRetention    = 0,
                                                              TierType?tier = null)
        {
            if (string.IsNullOrEmpty(resourceGroupName))
            {
                resourceGroupName = GetResourceGroupByAccountName(accountName);
            }

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

            var parameters = new DataLakeAnalyticsAccount
            {
                Location = location,
                Tags     = tags ?? new Dictionary <string, string>()
            };

            if (defaultDataLakeStoreAccount != null)
            {
                parameters.DefaultDataLakeStoreAccount =
                    defaultDataLakeStoreAccount.Name;
            }

            if (additionalStorageAccounts != null && additionalStorageAccounts.Count > 0)
            {
                parameters.StorageAccounts = additionalStorageAccounts;
            }

            if (additionalDataLakeStoreAccounts != null && additionalDataLakeStoreAccounts.Count > 0)
            {
                if (defaultDataLakeStoreAccount != null)
                {
                    additionalDataLakeStoreAccounts.Add(defaultDataLakeStoreAccount);
                }

                parameters.DataLakeStoreAccounts = additionalDataLakeStoreAccounts;
            }
            else if (defaultDataLakeStoreAccount != null)
            {
                parameters.DataLakeStoreAccounts = new List <DataLakeStoreAccountInfo>
                {
                    defaultDataLakeStoreAccount
                };
            }

            if (maxDegreeOfParallelism.HasValue && maxDegreeOfParallelism > 0)
            {
                parameters.MaxDegreeOfParallelism = maxDegreeOfParallelism;
            }

            if (maxJobCount.HasValue && maxJobCount > 0)
            {
                parameters.MaxJobCount = maxJobCount;
            }

            if (queryStoreRetention.HasValue && queryStoreRetention > 0)
            {
                parameters.QueryStoreRetention = queryStoreRetention;
            }

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

            var accountExists = false;

            try
            {
                if (GetAccount(resourceGroupName, accountName) != null)
                {
                    accountExists = true;
                }
            }
            catch
            {
                // intentionally empty since if there is any exception attempting to
                // get the account we know it doesn't exist and we will attempt to create it fresh.
            }

            return(accountExists
                ? _accountClient.Account.Update(resourceGroupName, accountName, new DataLakeAnalyticsAccountUpdateParameters
            {
                MaxDegreeOfParallelism = parameters.MaxDegreeOfParallelism,
                MaxJobCount = parameters.MaxJobCount,
                QueryStoreRetention = parameters.QueryStoreRetention,
                Tags = parameters.Tags,
                NewTier = parameters.NewTier
            })
                : _accountClient.Account.Create(resourceGroupName, accountName, parameters));
        }